Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-14 06:09:09 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-14 06:09:09 +0300
commit805f27a3271cab8f6000e8140df6a7bf9e7f2152 (patch)
tree6656244faf1622b1d3788671a6174a5e17b0f7ef /qa
parent3e81e2db0bf51f14987bbe87aaf085798c31c45f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/project/pipeline/new.rb4
-rw-r--r--qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb88
-rw-r--r--qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb2
3 files changed, 91 insertions, 3 deletions
diff --git a/qa/qa/page/project/pipeline/new.rb b/qa/qa/page/project/pipeline/new.rb
index 96a48e6240a..6cf5c3b1134 100644
--- a/qa/qa/page/project/pipeline/new.rb
+++ b/qa/qa/page/project/pipeline/new.rb
@@ -16,9 +16,9 @@ module QA
click_element(:run_pipeline_button, Page::Project::Pipeline::Show)
end
- def add_variable(key, value, row_index: 0)
+ def configure_variable(key: nil, value: 'foo', row_index: 0)
within_element_by_index(:ci_variable_row_container, row_index) do
- fill_element(:ci_variable_key_field, key)
+ fill_element(:ci_variable_key_field, key) unless key.nil?
fill_element(:ci_variable_value_field, value)
end
end
diff --git a/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb
new file mode 100644
index 00000000000..63801536c34
--- /dev/null
+++ b/qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb
@@ -0,0 +1,88 @@
+# frozen_string_literal: true
+
+module QA
+ RSpec.describe 'Verify', :runner do
+ describe 'Pipeline with customizable variable' do
+ let(:executor) { "qa-runner-#{Time.now.to_i}" }
+ let(:pipeline_job_name) { 'customizable-variable' }
+ let(:variable_custom_value) { 'Custom Foo' }
+
+ let(:project) do
+ Resource::Project.fabricate_via_api! do |project|
+ project.name = 'project-with-customizable-variable-pipeline'
+ end
+ end
+
+ let!(:runner) do
+ Resource::Runner.fabricate! do |runner|
+ runner.project = project
+ runner.name = executor
+ runner.tags = [executor]
+ end
+ end
+
+ let!(:commit) do
+ Resource::Repository::Commit.fabricate_via_api! do |commit|
+ commit.project = project
+ commit.commit_message = 'Add .gitlab-ci.yml'
+ commit.add_files(
+ [
+ {
+ file_path: '.gitlab-ci.yml',
+ content: <<~YAML
+ variables:
+ FOO:
+ value: "Default Foo"
+ description: "This is a description for the foo variable"
+ #{pipeline_job_name}:
+ tags:
+ - #{executor}
+ script: echo "$FOO"
+ YAML
+ }
+ ]
+ )
+ end
+ end
+
+ before do
+ Flow::Login.sign_in
+ project.visit!
+ Page::Project::Menu.perform(&:click_ci_cd_pipelines)
+ Page::Project::Pipeline::Index.perform do |index|
+ index.click_run_pipeline_button
+ end
+ end
+
+ after do
+ [runner, project].each(&:remove_via_api!)
+ end
+
+ it(
+ 'manually creates a pipeline and uses the defined custom variable value',
+ testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/361814'
+ ) do
+ Page::Project::Pipeline::New.perform do |new|
+ new.configure_variable(value: variable_custom_value)
+ new.click_run_pipeline_button
+ end
+
+ Page::Project::Pipeline::Show.perform do |show|
+ Support::Waiter.wait_until { show.passed? }
+ end
+
+ job = Resource::Job.fabricate_via_api! do |job|
+ job.id = project.job_by_name(pipeline_job_name)[:id]
+ job.name = pipeline_job_name
+ job.project = project
+ end
+
+ job.visit!
+
+ Page::Project::Job::Show.perform do |show|
+ expect(show.output).to have_content(variable_custom_value)
+ end
+ end
+ end
+ end
+end
diff --git a/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb b/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb
index 12869d517b1..fbe517f51f8 100644
--- a/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb
+++ b/qa/qa/specs/features/shared_contexts/variable_inheritance_shared_context.rb
@@ -59,7 +59,7 @@ module QA
Flow::Pipeline.wait_for_latest_pipeline
Page::Project::Pipeline::Index.perform(&:click_run_pipeline_button)
Page::Project::Pipeline::New.perform do |new|
- new.add_variable(key, value)
+ new.configure_variable(key: key, value: value)
new.click_run_pipeline_button
end
end