diff options
Diffstat (limited to 'spec/features/projects/pipelines/pipeline_spec.rb')
-rw-r--r-- | spec/features/projects/pipelines/pipeline_spec.rb | 221 |
1 files changed, 184 insertions, 37 deletions
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb index ac3566fbbdd..94800717677 100644 --- a/spec/features/projects/pipelines/pipeline_spec.rb +++ b/spec/features/projects/pipelines/pipeline_spec.rb @@ -14,7 +14,6 @@ RSpec.describe 'Pipeline', :js do before do sign_in(user) project.add_role(user, role) - stub_feature_flags(graphql_pipeline_details: false) end shared_context 'pipeline builds' do @@ -57,7 +56,7 @@ RSpec.describe 'Pipeline', :js do end end - describe 'GET /:project/pipelines/:id' do + describe 'GET /:project/-/pipelines/:id' do include_context 'pipeline builds' let(:group) { create(:group) } @@ -69,7 +68,7 @@ RSpec.describe 'Pipeline', :js do it 'shows the pipeline graph' do visit_pipeline - expect(page).to have_selector('.pipeline-visualization') + 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') @@ -625,20 +624,6 @@ RSpec.describe 'Pipeline', :js do end end end - - context 'when FF dag_pipeline_tab is disabled' do - before do - stub_feature_flags(dag_pipeline_tab: false) - visit_pipeline - end - - it 'does not show DAG link' do - expect(page).to have_link('Pipeline') - expect(page).to have_link('Jobs') - expect(page).not_to have_link('DAG') - expect(page).to have_link('Failed Jobs') - end - end end context 'when user does not have access to read jobs' do @@ -646,7 +631,7 @@ RSpec.describe 'Pipeline', :js do project.update(public_builds: false) end - describe 'GET /:project/pipelines/:id' do + describe 'GET /:project/-/pipelines/:id' do include_context 'pipeline builds' let(:project) { create(:project, :repository) } @@ -657,7 +642,7 @@ RSpec.describe 'Pipeline', :js do end it 'shows the pipeline graph' do - expect(page).to have_selector('.pipeline-visualization') + 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') @@ -691,13 +676,13 @@ RSpec.describe 'Pipeline', :js do downstream: downstream) end - describe 'GET /:project/pipelines/:id' do + describe 'GET /:project/-/pipelines/:id' do before do visit project_pipeline_path(project, pipeline) end it 'shows the pipeline with a bridge job' do - expect(page).to have_selector('.pipeline-visualization') + expect(page).to have_selector('.js-pipeline-graph') expect(page).to have_content('cross-build') end @@ -740,7 +725,7 @@ RSpec.describe 'Pipeline', :js do end end - describe 'GET /:project/pipelines/:id/builds' do + describe 'GET /:project/-/pipelines/:id/builds' do before do visit builds_project_pipeline_path(project, pipeline) end @@ -767,9 +752,64 @@ RSpec.describe 'Pipeline', :js do stage_idx: 2, pipeline: pipeline, project: project, resource_group: resource_group) end - describe 'GET /:project/pipelines/:id' do + describe 'GET /:project/-/pipelines/:id' do subject { visit project_pipeline_path(project, pipeline) } + # remove when :graphql_pipeline_details flag is removed + # https://gitlab.com/gitlab-org/gitlab/-/issues/299112 + context 'when :graphql_pipeline_details flag is off' do + before do + stub_feature_flags(graphql_pipeline_details: false) + stub_feature_flags(graphql_pipeline_details_users: false) + end + + it 'shows deploy job as created' do + subject + + within('.pipeline-header-container') do + expect(page).to have_content('pending') + end + + within('.js-pipeline-graph') do + within '.stage-column:nth-child(1)' do + expect(page).to have_content('test') + expect(page).to have_css('.ci-status-icon-pending') + end + + within '.stage-column:nth-child(2)' do + expect(page).to have_content('deploy') + expect(page).to have_css('.ci-status-icon-created') + end + end + end + + context 'when test job succeeded' do + before do + test_job.success! + end + + it 'shows deploy job as pending' do + subject + + within('.pipeline-header-container') do + expect(page).to have_content('running') + end + + within('.pipeline-graph') do + within '.stage-column:nth-child(1)' do + expect(page).to have_content('test') + expect(page).to have_css('.ci-status-icon-success') + end + + within '.stage-column:nth-child(2)' do + expect(page).to have_content('deploy') + expect(page).to have_css('.ci-status-icon-pending') + end + end + end + end + end + it 'shows deploy job as created' do subject @@ -777,13 +817,13 @@ RSpec.describe 'Pipeline', :js do expect(page).to have_content('pending') end - within('.pipeline-graph') do - within '.stage-column:nth-child(1)' do + within('.js-pipeline-graph') do + within(all('[data-testid="stage-column"]')[0]) do expect(page).to have_content('test') expect(page).to have_css('.ci-status-icon-pending') end - within '.stage-column:nth-child(2)' do + within(all('[data-testid="stage-column"]')[1]) do expect(page).to have_content('deploy') expect(page).to have_css('.ci-status-icon-created') end @@ -802,13 +842,13 @@ RSpec.describe 'Pipeline', :js do expect(page).to have_content('running') end - within('.pipeline-graph') do - within '.stage-column:nth-child(1)' do + within('.js-pipeline-graph') do + within(all('[data-testid="stage-column"]')[0]) do expect(page).to have_content('test') expect(page).to have_css('.ci-status-icon-success') end - within '.stage-column:nth-child(2)' do + within(all('[data-testid="stage-column"]')[1]) do expect(page).to have_content('deploy') expect(page).to have_css('.ci-status-icon-pending') end @@ -831,14 +871,37 @@ RSpec.describe 'Pipeline', :js do expect(page).to have_content('waiting') end - within('.pipeline-graph') do - within '.stage-column:nth-child(2)' do + within('.js-pipeline-graph') do + within(all('[data-testid="stage-column"]')[1]) do expect(page).to have_content('deploy') expect(page).to have_css('.ci-status-icon-waiting-for-resource') end end end + # remove when :graphql_pipeline_details flag is removed + # https://gitlab.com/gitlab-org/gitlab/-/issues/299112 + context 'when :graphql_pipeline_details flag is off' do + before do + stub_feature_flags(graphql_pipeline_details: false) + stub_feature_flags(graphql_pipeline_details_users: false) + end + it 'shows deploy job as waiting for resource' do + subject + + within('.pipeline-header-container') do + expect(page).to have_content('waiting') + end + + within('.pipeline-graph') do + within '.stage-column:nth-child(2)' do + expect(page).to have_content('deploy') + expect(page).to have_css('.ci-status-icon-waiting-for-resource') + end + end + end + end + context 'when resource is released from another job' do before do another_job.success! @@ -851,19 +914,86 @@ RSpec.describe 'Pipeline', :js do expect(page).to have_content('running') end - within('.pipeline-graph') do - within '.stage-column:nth-child(2)' do + within('.js-pipeline-graph') do + within(all('[data-testid="stage-column"]')[1]) do expect(page).to have_content('deploy') expect(page).to have_css('.ci-status-icon-pending') end end end + + # remove when :graphql_pipeline_details flag is removed + # https://gitlab.com/gitlab-org/gitlab/-/issues/299112 + context 'when :graphql_pipeline_details flag is off' do + before do + stub_feature_flags(graphql_pipeline_details: false) + stub_feature_flags(graphql_pipeline_details_users: false) + end + it 'shows deploy job as pending' do + subject + + within('.pipeline-header-container') do + expect(page).to have_content('running') + end + + within('.pipeline-graph') do + within '.stage-column:nth-child(2)' do + expect(page).to have_content('deploy') + expect(page).to have_css('.ci-status-icon-pending') + end + end + end + end + end + + 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) + end + + it 'shows deploy job as waiting for resource' do + subject + + within('.pipeline-header-container') do + expect(page).to have_content('waiting') + end + + within('.js-pipeline-graph') do + within(all('[data-testid="stage-column"]')[1]) do + expect(page).to have_content('deploy') + expect(page).to have_css('.ci-status-icon-waiting-for-resource') + end + end + end + end + + 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) + end + + it 'shows deploy job as waiting for resource' do + subject + + within('.pipeline-header-container') do + expect(page).to have_content('waiting') + end + + within('.js-pipeline-graph') do + within(all('[data-testid="stage-column"]')[1]) do + expect(page).to have_content('deploy') + expect(page).to have_css('.ci-status-icon-waiting-for-resource') + end + end + end end end end end - describe 'GET /:project/pipelines/:id/builds' do + describe 'GET /:project/-/pipelines/:id/builds' do include_context 'pipeline builds' let(:project) { create(:project, :repository) } @@ -965,7 +1095,7 @@ RSpec.describe 'Pipeline', :js do end end - describe 'GET /:project/pipelines/:id/failures' do + describe 'GET /:project/-/pipelines/:id/failures' do let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: '1234') } let(:pipeline_failures_page) { failures_project_pipeline_path(project, pipeline) } let!(:failed_build) { create(:ci_build, :failed, pipeline: pipeline) } @@ -1078,12 +1208,29 @@ RSpec.describe 'Pipeline', :js do expect(current_path).to eq(pipeline_path(pipeline)) expect(page).not_to have_content('Failed Jobs') - expect(page).to have_selector('.pipeline-visualization') + expect(page).to have_selector('.js-pipeline-graph') + end + + # remove when :graphql_pipeline_details flag is removed + # https://gitlab.com/gitlab-org/gitlab/-/issues/299112 + context 'when :graphql_pipeline_details flag is off' do + before do + stub_feature_flags(graphql_pipeline_details: false) + stub_feature_flags(graphql_pipeline_details_users: false) + end + + it 'displays the pipeline graph' do + subject + + expect(current_path).to eq(pipeline_path(pipeline)) + expect(page).not_to have_content('Failed Jobs') + expect(page).to have_selector('.pipeline-visualization') + end end end end - describe 'GET /:project/pipelines/:id/dag' do + describe 'GET /:project/-/pipelines/:id/dag' do include_context 'pipeline builds' let(:project) { create(:project, :repository) } |