diff options
Diffstat (limited to 'spec/features/projects/pipelines/pipelines_spec.rb')
-rw-r--r-- | spec/features/projects/pipelines/pipelines_spec.rb | 130 |
1 files changed, 8 insertions, 122 deletions
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 37ac5a9d5a2..0e1728858ec 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -7,6 +7,7 @@ RSpec.describe 'Pipelines', :js do include Spec::Support::Helpers::ModalHelpers let(:project) { create(:project) } + let(:expected_detached_mr_tag) {'merge request'} context 'when user is logged in' do let(:user) { create(:user) } @@ -160,51 +161,7 @@ RSpec.describe 'Pipelines', :js do end end - 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, - 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: false) - - 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') - end - - within '.branch-commit' do - expect(page).to have_link(merge_request.iid, - href: project_merge_request_path(project, merge_request)) - end - - within '.branch-commit' do - 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 detached merge request pipeline, with rearrange_pipelines_table feature flag turned on' do + context 'when pipeline is detached merge request pipeline' do let(:merge_request) do create(:merge_request, :with_detached_merge_request_pipeline, @@ -217,15 +174,13 @@ RSpec.describe 'Pipelines', :js do 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_content(expected_detached_mr_tag) expect(page).to have_link(merge_request.iid, href: project_merge_request_path(project, merge_request)) @@ -244,52 +199,7 @@ RSpec.describe 'Pipelines', :js do 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, - 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: false) - - 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') - end - - within '.branch-commit' do - expect(page).to have_link(merge_request.iid, - href: project_merge_request_path(project, merge_request)) - end - - within '.branch-commit' do - 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 is merge request pipeline, with rearrange_pipelines_table feature flag turned on' do + context 'when pipeline is merge request pipeline' do let(:merge_request) do create(:merge_request, :with_merge_request_pipeline, @@ -303,15 +213,13 @@ RSpec.describe 'Pipelines', :js do 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).not_to have_content(expected_detached_mr_tag) expect(page).to have_link(merge_request.iid, href: project_merge_request_path(project, merge_request)) @@ -414,7 +322,7 @@ RSpec.describe 'Pipelines', :js do it "has link to the delayed job's action" do find('[data-testid="pipelines-manual-actions-dropdown"]').click - time_diff = [0, delayed_job.scheduled_at - Time.now].max + time_diff = [0, delayed_job.scheduled_at - Time.zone.now].max expect(page).to have_button('delayed job 1') expect(page).to have_content(Time.at(time_diff).utc.strftime("%H:%M:%S")) end @@ -675,28 +583,6 @@ 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 - - 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 IID' - 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 @@ -912,7 +798,7 @@ RSpec.describe 'Pipelines', :js do end it 'renders empty state' do - expect(page).to have_content 'Use a sample CI/CD template' + expect(page).to have_content 'Try test template' end end end @@ -936,7 +822,7 @@ RSpec.describe 'Pipelines', :js do it 'redirects the user to sign_in and displays the flash alert' do expect(page).to have_content 'You need to sign in' - expect(page.current_path).to eq("/users/sign_in") + expect(page).to have_current_path("/users/sign_in") end end end |