diff options
Diffstat (limited to 'qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb')
-rw-r--r-- | qa/qa/specs/features/browser_ui/4_verify/ci_variable/custom_variable_spec.rb | 86 |
1 files changed, 60 insertions, 26 deletions
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 index 63801536c34..4a0a8be3659 100644 --- 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 @@ -2,7 +2,10 @@ module QA RSpec.describe 'Verify', :runner do - describe 'Pipeline with customizable variable' do + describe 'Pipeline with customizable variable', feature_flag: { + name: :run_pipeline_graphql, + scope: :project + } do let(:executor) { "qa-runner-#{Time.now.to_i}" } let(:pipeline_job_name) { 'customizable-variable' } let(:variable_custom_value) { 'Custom Foo' } @@ -45,43 +48,74 @@ module QA 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 + shared_examples 'pipeline with custom variable' do + before do + Flow::Login.sign_in + + project.visit! + Page::Project::Menu.perform(&:click_ci_cd_pipelines) + Page::Project::Pipeline::Index.perform(&:click_run_pipeline_button) + + # Sometimes the variables will not be prefilled because of reactive cache so we revisit the page again. + # TODO: Investigate alternatives to deal with cache implementation + # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/381233 + page.refresh end - end - after do - [runner, project].each(&:remove_via_api!) + after do + runner&.remove_via_api! + end + + it 'manually creates a pipeline and uses the defined custom variable value' 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 - it( - 'manually creates a pipeline and uses the defined custom variable value', + # TODO: Clean up tests when run_pipeline_graphql is enabled + # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/372310 + context( + 'with feature flag disabled', 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 + before do + Runtime::Feature.disable(:run_pipeline_graphql, project: project) end - Page::Project::Pipeline::Show.perform do |show| - Support::Waiter.wait_until { show.passed? } - end + it_behaves_like 'pipeline with custom variable' + 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 + context( + 'with feature flag enabled', + testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/378975' + ) do + before do + Runtime::Feature.enable(:run_pipeline_graphql, project: project) end - job.visit! - - Page::Project::Job::Show.perform do |show| - expect(show.output).to have_content(variable_custom_value) + after do + Runtime::Feature.disable(:run_pipeline_graphql, project: project) end + + it_behaves_like 'pipeline with custom variable' end end end |