diff options
Diffstat (limited to 'spec/features/projects/pipelines')
4 files changed, 111 insertions, 53 deletions
diff --git a/spec/features/projects/pipelines/legacy_pipeline_spec.rb b/spec/features/projects/pipelines/legacy_pipeline_spec.rb index 14f60dfe061..250a336469c 100644 --- a/spec/features/projects/pipelines/legacy_pipeline_spec.rb +++ b/spec/features/projects/pipelines/legacy_pipeline_spec.rb @@ -73,9 +73,9 @@ RSpec.describe 'Pipeline', :js do visit_pipeline expect(page).to have_selector('.js-pipeline-graph') - expect(page).to have_content('Build') - expect(page).to have_content('Test') - expect(page).to have_content('Deploy') + expect(page).to have_content('build') + expect(page).to have_content('test') + expect(page).to have_content('deploy') expect(page).to have_content('Retry') expect(page).to have_content('Cancel running') end @@ -668,9 +668,9 @@ RSpec.describe 'Pipeline', :js do it 'shows the pipeline graph' do expect(page).to have_selector('.js-pipeline-graph') - expect(page).to have_content('Build') - expect(page).to have_content('Test') - expect(page).to have_content('Deploy') + expect(page).to have_content('build') + expect(page).to have_content('test') + expect(page).to have_content('deploy') expect(page).to have_content('Retry') expect(page).to have_content('Cancel running') end @@ -769,13 +769,17 @@ RSpec.describe 'Pipeline', :js do let(:resource_group) { create(:ci_resource_group, project: project) } let!(:test_job) do - create(:ci_build, :pending, stage: 'test', name: 'test', - stage_idx: 1, pipeline: pipeline, project: project) + create(:ci_build, :pending, stage: 'test', name: 'test', stage_idx: 1, pipeline: pipeline, project: project) end let!(:deploy_job) do - create(:ci_build, :created, stage: 'deploy', name: 'deploy', - stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) + create(:ci_build, :created, + stage: 'deploy', + name: 'deploy', + stage_idx: 2, + pipeline: pipeline, + project: project, + resource_group: resource_group) end describe 'GET /:project/-/pipelines/:id' do @@ -873,8 +877,14 @@ RSpec.describe 'Pipeline', :js do context 'when deploy job is a bridge to trigger a downstream pipeline' do let!(:deploy_job) do - create(:ci_bridge, :created, stage: 'deploy', name: 'deploy', - stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) + create(:ci_bridge, :created, + stage: 'deploy', + name: 'deploy', + stage_idx: 2, + pipeline: pipeline, + project: project, + resource_group: resource_group + ) end it 'shows deploy job as waiting for resource' do @@ -895,8 +905,14 @@ RSpec.describe 'Pipeline', :js do context 'when deploy job is a bridge to trigger a downstream pipeline' do let!(:deploy_job) do - create(:ci_bridge, :created, stage: 'deploy', name: 'deploy', - stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) + create(:ci_bridge, :created, + stage: 'deploy', + name: 'deploy', + stage_idx: 2, + pipeline: pipeline, + project: project, + resource_group: resource_group + ) end it 'shows deploy job as waiting for resource' do @@ -1207,7 +1223,7 @@ RSpec.describe 'Pipeline', :js do subject expect(page).to have_content(failed_build.name) - expect(page).to have_content(failed_build.stage) + expect(page).to have_content(failed_build.stage_name) end it 'shows build failure logs' do @@ -1253,7 +1269,7 @@ RSpec.describe 'Pipeline', :js do subject expect(page).to have_content(failed_build.name) - expect(page).to have_content(failed_build.stage) + expect(page).to have_content(failed_build.stage_name) end it 'does not show log' do diff --git a/spec/features/projects/pipelines/legacy_pipelines_spec.rb b/spec/features/projects/pipelines/legacy_pipelines_spec.rb index eb8f2de3aba..2e0ea695ab3 100644 --- a/spec/features/projects/pipelines/legacy_pipelines_spec.rb +++ b/spec/features/projects/pipelines/legacy_pipelines_spec.rb @@ -546,8 +546,8 @@ RSpec.describe 'Pipelines', :js do context 'for a failed pipeline' do let!(:build) do create(:ci_build, :failed, pipeline: pipeline, - stage: 'build', - name: 'build') + stage: 'build', + name: 'build') end it 'displays the failure reason' do @@ -652,10 +652,10 @@ RSpec.describe 'Pipelines', :js do expect(page).to have_link(pipeline.user.name, href: user_path(pipeline.user)) # stages - expect(page).to have_text('Build') - expect(page).to have_text('Test') - expect(page).to have_text('Deploy') - expect(page).to have_text('External') + expect(page).to have_text('build') + expect(page).to have_text('test') + expect(page).to have_text('deploy') + expect(page).to have_text('external') # builds expect(page).to have_text('rspec') @@ -674,6 +674,7 @@ RSpec.describe 'Pipelines', :js do let(:project) { create(:project, :repository) } before do + stub_feature_flags(run_pipeline_graphql: false) visit new_project_pipeline_path(project) end diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index cfdd851cb80..51a6fbc4d36 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -72,9 +72,9 @@ RSpec.describe 'Pipeline', :js do visit_pipeline expect(page).to have_selector('.js-pipeline-graph') - expect(page).to have_content('Build') - expect(page).to have_content('Test') - expect(page).to have_content('Deploy') + expect(page).to have_content('build') + expect(page).to have_content('test') + expect(page).to have_content('deploy') expect(page).to have_content('Retry') expect(page).to have_content('Cancel running') end @@ -793,9 +793,9 @@ RSpec.describe 'Pipeline', :js do it 'shows the pipeline graph' do expect(page).to have_selector('.js-pipeline-graph') - expect(page).to have_content('Build') - expect(page).to have_content('Test') - expect(page).to have_content('Deploy') + expect(page).to have_content('build') + expect(page).to have_content('test') + expect(page).to have_content('deploy') expect(page).to have_content('Retry') expect(page).to have_content('Cancel running') end @@ -895,12 +895,12 @@ RSpec.describe 'Pipeline', :js do let!(:test_job) do create(:ci_build, :pending, stage: 'test', name: 'test', - stage_idx: 1, pipeline: pipeline, project: project) + stage_idx: 1, pipeline: pipeline, project: project) end let!(:deploy_job) do create(:ci_build, :created, stage: 'deploy', name: 'deploy', - stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) + stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) end describe 'GET /:project/-/pipelines/:id' do @@ -998,8 +998,14 @@ RSpec.describe 'Pipeline', :js do context 'when deploy job is a bridge to trigger a downstream pipeline' do let!(:deploy_job) do - create(:ci_bridge, :created, stage: 'deploy', name: 'deploy', - stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) + create(:ci_bridge, :created, + stage: 'deploy', + name: 'deploy', + stage_idx: 2, + pipeline: pipeline, + project: project, + resource_group: resource_group + ) end it 'shows deploy job as waiting for resource' do @@ -1126,7 +1132,7 @@ RSpec.describe 'Pipeline', :js do subject expect(page).to have_content(failed_build.name) - expect(page).to have_content(failed_build.stage) + expect(page).to have_content(failed_build.stage_name) end it 'shows build failure logs' do @@ -1172,7 +1178,7 @@ RSpec.describe 'Pipeline', :js do subject expect(page).to have_content(failed_build.name) - expect(page).to have_content(failed_build.stage) + expect(page).to have_content(failed_build.stage_name) end it 'does not show log' do diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index bf521971ae0..404e51048bc 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -536,8 +536,8 @@ RSpec.describe 'Pipelines', :js do context 'for a failed pipeline' do let!(:build) do create(:ci_build, :failed, pipeline: pipeline, - stage: 'build', - name: 'build') + stage: 'build', + name: 'build') end it 'displays the failure reason' do @@ -635,10 +635,10 @@ RSpec.describe 'Pipelines', :js do expect(page).to have_link(pipeline.user.name, href: user_path(pipeline.user)) # stages - expect(page).to have_text('Build') - expect(page).to have_text('Test') - expect(page).to have_text('Deploy') - expect(page).to have_text('External') + expect(page).to have_text('build') + expect(page).to have_text('test') + expect(page).to have_text('deploy') + expect(page).to have_text('external') # builds expect(page).to have_text('rspec') @@ -656,19 +656,7 @@ RSpec.describe 'Pipelines', :js do describe 'POST /:project/-/pipelines' do let(:project) { create(:project, :repository) } - before do - visit new_project_pipeline_path(project) - end - - context 'for valid commit', :js do - before do - click_button project.default_branch - wait_for_requests - - find('p', text: 'master').click - wait_for_requests - end - + shared_examples 'run pipeline form with gitlab-ci.yml' do context 'with gitlab-ci.yml', :js do before do stub_ci_pipeline_to_return_yaml_file @@ -702,7 +690,9 @@ RSpec.describe 'Pipelines', :js do end end end + end + shared_examples 'run pipeline form without gitlab-ci.yml' do context 'without gitlab-ci.yml' do before do click_on 'Run pipeline' @@ -722,6 +712,51 @@ RSpec.describe 'Pipelines', :js do end end end + + # Run Pipeline form with REST endpoints + # TODO: Clean up tests when run_pipeline_graphql is enabled + context 'with feature flag disabled' do + before do + stub_feature_flags(run_pipeline_graphql: false) + visit new_project_pipeline_path(project) + end + + context 'for valid commit', :js do + before do + click_button project.default_branch + wait_for_requests + + find('p', text: 'master').click + wait_for_requests + end + + it_behaves_like 'run pipeline form with gitlab-ci.yml' + + it_behaves_like 'run pipeline form without gitlab-ci.yml' + end + end + + # Run Pipeline form with GraphQL + context 'with feature flag enabled' do + before do + stub_feature_flags(run_pipeline_graphql: true) + visit new_project_pipeline_path(project) + end + + context 'for valid commit', :js do + before do + click_button project.default_branch + wait_for_requests + + find('p', text: 'master').click + wait_for_requests + end + + it_behaves_like 'run pipeline form with gitlab-ci.yml' + + it_behaves_like 'run pipeline form without gitlab-ci.yml' + end + end end describe 'Reset runner caches' do |