diff options
Diffstat (limited to 'spec/features/projects/pipelines/pipelines_spec.rb')
-rw-r--r-- | spec/features/projects/pipelines/pipelines_spec.rb | 120 |
1 files changed, 115 insertions, 5 deletions
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index fb45db213d0..d5b470194a2 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'Pipelines', :js do include ProjectForksHelper + include Spec::Support::Helpers::ModalHelpers let(:project) { create(:project) } @@ -159,7 +160,7 @@ RSpec.describe 'Pipelines', :js do end end - context 'when pipeline is detached merge request pipeline' do + context 'when pipeline is detached merge request pipeline, with rearrange_pipelines_table feature flag turned off' do let(:merge_request) do create(:merge_request, :with_detached_merge_request_pipeline, @@ -172,6 +173,8 @@ RSpec.describe 'Pipelines', :js do let(:target_project) { project } before do + stub_feature_flags(rearrange_pipelines_table: false) + visit project_pipelines_path(source_project) end @@ -201,7 +204,47 @@ RSpec.describe 'Pipelines', :js do end end - context 'when pipeline is merge request pipeline' do + context 'when pipeline is detached merge request pipeline, with rearrange_pipelines_table feature flag turned on' do + let(:merge_request) do + create(:merge_request, + :with_detached_merge_request_pipeline, + source_project: source_project, + target_project: target_project) + end + + let!(:pipeline) { merge_request.all_pipelines.first } + let(:source_project) { project } + let(:target_project) { project } + + before do + stub_feature_flags(rearrange_pipelines_table: true) + + visit project_pipelines_path(source_project) + end + + shared_examples_for 'detached merge request pipeline' do + it 'shows pipeline information without pipeline ref', :sidekiq_might_not_need_inline do + within '.pipeline-tags' do + expect(page).to have_content('detached') + + expect(page).to have_link(merge_request.iid, + href: project_merge_request_path(project, merge_request)) + + expect(page).not_to have_link(pipeline.ref) + end + end + end + + it_behaves_like 'detached merge request pipeline' + + context 'when source project is a forked project' do + let(:source_project) { fork_project(project, user, repository: true) } + + it_behaves_like 'detached merge request pipeline' + end + end + + context 'when pipeline is merge request pipeline, with rearrange_pipelines_table feature flag turned off' do let(:merge_request) do create(:merge_request, :with_merge_request_pipeline, @@ -215,6 +258,8 @@ RSpec.describe 'Pipelines', :js do let(:target_project) { project } before do + stub_feature_flags(rearrange_pipelines_table: false) + visit project_pipelines_path(source_project) end @@ -244,6 +289,47 @@ RSpec.describe 'Pipelines', :js do end end + context 'when pipeline is merge request pipeline, with rearrange_pipelines_table feature flag turned on' do + let(:merge_request) do + create(:merge_request, + :with_merge_request_pipeline, + source_project: source_project, + target_project: target_project, + merge_sha: target_project.commit.sha) + end + + let!(:pipeline) { merge_request.all_pipelines.first } + let(:source_project) { project } + let(:target_project) { project } + + before do + stub_feature_flags(rearrange_pipelines_table: true) + + visit project_pipelines_path(source_project) + end + + shared_examples_for 'Correct merge request pipeline information' do + it 'does not show detached tag for the pipeline, and shows the link of the merge request, and does not show the ref of the pipeline', :sidekiq_might_not_need_inline do + within '.pipeline-tags' do + expect(page).not_to have_content('detached') + + expect(page).to have_link(merge_request.iid, + href: project_merge_request_path(project, merge_request)) + + expect(page).not_to have_link(pipeline.ref) + end + end + end + + it_behaves_like 'Correct merge request pipeline information' + + context 'when source project is a forked project' do + let(:source_project) { fork_project(project, user, repository: true) } + + it_behaves_like 'Correct merge request pipeline information' + end + end + context 'when pipeline has configuration errors' do let(:pipeline) do create(:ci_pipeline, :invalid, project: project) @@ -351,7 +437,9 @@ RSpec.describe 'Pipelines', :js do context 'when user played a delayed job immediately' do before do find('[data-testid="pipelines-manual-actions-dropdown"]').click - page.accept_confirm { click_button('delayed job 1') } + accept_gl_confirm do + click_button 'delayed job 1' + end wait_for_requests end @@ -587,6 +675,7 @@ RSpec.describe 'Pipelines', :js do context 'with pipeline key selection' do before do + stub_feature_flags(rearrange_pipelines_table: false) visit project_pipelines_path(project) wait_for_requests end @@ -604,6 +693,27 @@ RSpec.describe 'Pipelines', :js do expect(page.find('[data-testid="pipeline-url-link"]')).to have_content "##{pipeline.iid}" end end + + context 'with pipeline key selection and rearrange_pipelines_table ff on' do + before do + stub_feature_flags(rearrange_pipelines_table: true) + visit project_pipelines_path(project) + wait_for_requests + end + + it 'changes the Pipeline ID column for Pipeline IID' do + page.find('[data-testid="pipeline-key-dropdown"]').click + + within '.gl-new-dropdown-contents' do + dropdown_options = page.find_all '.gl-new-dropdown-item' + + dropdown_options[1].click + end + + expect(page.find('[data-testid="pipeline-th"]')).to have_content 'Pipeline' + expect(page.find('[data-testid="pipeline-identifier"]')).to have_content "##{pipeline.iid}" + end + end end describe 'GET /:project/-/pipelines/show' do @@ -750,7 +860,7 @@ RSpec.describe 'Pipelines', :js do it 'increments jobs_cache_index' do click_button 'Clear runner caches' wait_for_requests - expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.' + expect(page.find('[data-testid="alert-info"]')).to have_content 'Project cache successfully reset.' end end @@ -758,7 +868,7 @@ RSpec.describe 'Pipelines', :js do it 'sets jobs_cache_index to 1' do click_button 'Clear runner caches' wait_for_requests - expect(page.find('.flash-notice')).to have_content 'Project cache successfully reset.' + expect(page.find('[data-testid="alert-info"]')).to have_content 'Project cache successfully reset.' end end end |