Skip to content
Snippets Groups Projects

Update QA specs for Run Pipeline form

Merged Mireya Andres requested to merge update-run-pipeline-qa into master
All threads resolved!
3 files
+ 106
52
Compare changes
  • Side-by-side
  • Inline
Files
3
# frozen_string_literal: true
# frozen_string_literal: true
module QA
module QA
RSpec.describe 'Verify', :runner, product_group: :pipeline_authoring do
RSpec.describe 'Verify', :runner do
describe 'Pipeline with customizable variable' do
describe 'Pipeline with customizable variable', feature_flag: {
 
name: :run_pipeline_graphql,
 
scope: :global
 
} do
let(:executor) { "qa-runner-#{Time.now.to_i}" }
let(:executor) { "qa-runner-#{Time.now.to_i}" }
let(:pipeline_job_name) { 'customizable-variable' }
let(:pipeline_job_name) { 'customizable-variable' }
let(:variable_custom_value) { 'Custom Foo' }
let(:variable_custom_value) { 'Custom Foo' }
@@ -45,43 +48,66 @@ module QA
@@ -45,43 +48,66 @@ module QA
end
end
end
end
before do
shared_examples 'pipeline with custom variable' do
Flow::Login.sign_in
before do
project.visit!
Flow::Login.sign_in
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::Index.perform do |index|
index.click_run_pipeline_button
end
end
after do
project.visit!
[runner, project].each(&:remove_via_api!)
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
end
Page::Project::Pipeline::Index.perform(&:click_run_pipeline_button)
it(
# Sometimes the variables will not be prefilled because of reactive cache
'manually creates a pipeline and uses the defined custom variable value',
# So we revisit the page again
testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/361814'
project.visit!
) do
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
Page::Project::Pipeline::New.perform do |new|
Page::Project::Pipeline::Index.perform(&:click_run_pipeline_button)
new.configure_variable(value: variable_custom_value)
new.click_run_pipeline_button
end
end
Page::Project::Pipeline::Show.perform do |show|
after do
Support::Waiter.wait_until { show.passed? }
[runner, project].each(&:remove_via_api!)
end
end
job = Resource::Job.fabricate_via_api! do |job|
it 'manually creates a pipeline and uses the defined custom variable value' do
job.id = project.job_by_name(pipeline_job_name)[:id]
Page::Project::Pipeline::New.perform do |new|
job.name = pipeline_job_name
new.configure_variable(value: variable_custom_value)
job.project = project
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
 
 
# 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
 
it_behaves_like 'pipeline with custom variable'
 
end
job.visit!
context 'with feature flag enabled' do
 
before do
 
Runtime::Feature.enable(:run_pipeline_graphql)
 
end
Page::Project::Job::Show.perform do |show|
after do
expect(show.output).to have_content(variable_custom_value)
Runtime::Feature.disable(:run_pipeline_graphql)
end
end
 
 
it_behaves_like 'pipeline with custom variable'
end
end
end
end
end
end
Loading