diff options
Diffstat (limited to 'spec/features/merge_request')
10 files changed, 27 insertions, 31 deletions
diff --git a/spec/features/merge_request/batch_comments_spec.rb b/spec/features/merge_request/batch_comments_spec.rb index 5b11d9cb919..c646698219b 100644 --- a/spec/features/merge_request/batch_comments_spec.rb +++ b/spec/features/merge_request/batch_comments_spec.rb @@ -13,6 +13,8 @@ RSpec.describe 'Merge request > Batch comments', :js do end before do + stub_feature_flags(paginated_notes: false) + project.add_maintainer(user) sign_in(user) @@ -24,7 +26,7 @@ RSpec.describe 'Merge request > Batch comments', :js do end it 'has review bar' do - expect(page).to have_css('.review-bar-component', visible: false) + expect(page).to have_selector('[data-testid="review_bar_component"]', visible: false) end it 'adds draft note' do @@ -32,7 +34,7 @@ RSpec.describe 'Merge request > Batch comments', :js do expect(find('.draft-note-component')).to have_content('Line is wrong') - expect(page).to have_css('.review-bar-component') + expect(page).to have_selector('[data-testid="review_bar_component"]') expect(find('.review-bar-content .btn-confirm')).to have_content('1') end @@ -259,8 +261,8 @@ RSpec.describe 'Merge request > Batch comments', :js do end def write_parallel_comment(line, **params) - find("td[id='#{line}']").hover - find(".is-over button").click + find("div[id='#{line}']").hover + find(".js-add-diff-note-button").click write_comment(selector: "form[data-line-code='#{line}']", **params) end diff --git a/spec/features/merge_request/user_comments_on_diff_spec.rb b/spec/features/merge_request/user_comments_on_diff_spec.rb index 0fd140a00bd..54c3fe738d2 100644 --- a/spec/features/merge_request/user_comments_on_diff_spec.rb +++ b/spec/features/merge_request/user_comments_on_diff_spec.rb @@ -132,7 +132,7 @@ RSpec.describe 'User comments on a diff', :js do # In `files/ruby/popen.rb` it 'allows comments for changes involving both sides' do # click +15, select -13 add and verify comment - click_diff_line(find('div[data-path="files/ruby/popen.rb"] .new_line a[data-linenumber="15"]').find(:xpath, '../..'), 'right') + click_diff_line(find('div[data-path="files/ruby/popen.rb"] .right-side a[data-linenumber="15"]').find(:xpath, '../../..'), 'right') add_comment('-13', '+15') end @@ -141,7 +141,7 @@ RSpec.describe 'User comments on a diff', :js do page.within('[data-path="files/ruby/popen.rb"]') do all('.js-unfold-all')[0].click end - click_diff_line(find('div[data-path="files/ruby/popen.rb"] .old_line a[data-linenumber="9"]').find(:xpath, '../..'), 'left') + click_diff_line(find('div[data-path="files/ruby/popen.rb"] .left-side a[data-linenumber="9"]').find(:xpath, '../..'), 'left') add_comment('1', '-9') end @@ -150,7 +150,7 @@ RSpec.describe 'User comments on a diff', :js do page.within('[data-path="files/ruby/popen.rb"]') do all('.js-unfold-all')[1].click end - click_diff_line(find('div[data-path="files/ruby/popen.rb"] .old_line a[data-linenumber="21"]').find(:xpath, '../..'), 'left') + click_diff_line(find('div[data-path="files/ruby/popen.rb"] .left-side a[data-linenumber="21"]').find(:xpath, '../..'), 'left') add_comment('18', '21') end @@ -159,7 +159,7 @@ RSpec.describe 'User comments on a diff', :js do page.within('[data-path="files/ruby/popen.rb"]') do all('.js-unfold-down')[1].click end - click_diff_line(find('div[data-path="files/ruby/popen.rb"] .old_line a[data-linenumber="30"]').find(:xpath, '../..'), 'left') + click_diff_line(find('div[data-path="files/ruby/popen.rb"] .left-side a[data-linenumber="30"]').find(:xpath, '../..'), 'left') add_comment('+28', '37') end end diff --git a/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb b/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb index ac0c66524f0..3665ad91dd6 100644 --- a/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb +++ b/spec/features/merge_request/user_interacts_with_batched_mr_diffs_spec.rb @@ -16,14 +16,14 @@ RSpec.describe 'Batch diffs', :js do wait_for_requests # Add discussion to first line of first file - click_diff_line(find('.diff-file.file-holder:first-of-type tr.line_holder.new:first-of-type')) + click_diff_line(find('.diff-file.file-holder:first-of-type .line_holder .left-side:first-of-type')) page.within('.js-discussion-note-form') do fill_in('note_note', with: 'First Line Comment') click_button('Add comment now') end # Add discussion to first line of last file - click_diff_line(find('.diff-file.file-holder:last-of-type tr.line_holder.new:first-of-type')) + click_diff_line(find('.diff-file.file-holder:last-of-type .line_holder .left-side:first-of-type')) page.within('.js-discussion-note-form') do fill_in('note_note', with: 'Last Line Comment') click_button('Add comment now') diff --git a/spec/features/merge_request/user_posts_diff_notes_spec.rb b/spec/features/merge_request/user_posts_diff_notes_spec.rb index 163ce10132e..c339a7d9976 100644 --- a/spec/features/merge_request/user_posts_diff_notes_spec.rb +++ b/spec/features/merge_request/user_posts_diff_notes_spec.rb @@ -10,7 +10,7 @@ RSpec.describe 'Merge request > User posts diff notes', :js do let(:user) { project.creator } let(:comment_button_class) { '.add-diff-note' } let(:notes_holder_input_class) { 'js-temp-notes-holder' } - let(:notes_holder_input_xpath) { './following-sibling::*[contains(concat(" ", @class, " "), " notes_holder ")]' } + let(:notes_holder_input_xpath) { '..//following-sibling::*[contains(concat(" ", @class, " "), " notes_holder ")]' } let(:test_note_comment) { 'this is a test note!' } before do @@ -27,7 +27,7 @@ RSpec.describe 'Merge request > User posts diff notes', :js do context 'with an old line on the left and no line on the right' do it 'allows commenting on the left side' do - should_allow_commenting(find('[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_23_22"]').find(:xpath, '..'), 'left') + should_allow_commenting(find('[id="6eb14e00385d2fb284765eb1cd8d420d33d63fc9_23_22"]'), 'left') end it 'does not allow commenting on the right side' do @@ -67,7 +67,7 @@ RSpec.describe 'Merge request > User posts diff notes', :js do context 'with a match line' do it 'does not allow commenting' do - line_holder = find('.match', match: :first).find(:xpath, '..') + line_holder = find('.match', match: :first) match_should_not_allow_commenting(line_holder) end end @@ -81,17 +81,13 @@ RSpec.describe 'Merge request > User posts diff notes', :js do wait_for_requests end - # The first `.js-unfold` unfolds upwards, therefore the first - # `.line_holder` will be an unfolded line. - let(:line_holder) { first('#a5cc2925ca8258af241be7e5b0381edf30266302 .line_holder') } - it 'allows commenting on the left side' do - should_allow_commenting(line_holder, 'left') + should_allow_commenting(first('#a5cc2925ca8258af241be7e5b0381edf30266302 .line_holder [data-testid="left-side"]')) end it 'allows commenting on the right side' do # Automatically shifts comment box to left side. - should_allow_commenting(line_holder, 'right') + should_allow_commenting(first('#a5cc2925ca8258af241be7e5b0381edf30266302 .line_holder [data-testid="right-side"]')) end end end @@ -149,7 +145,7 @@ RSpec.describe 'Merge request > User posts diff notes', :js do # The first `.js-unfold` unfolds upwards, therefore the first # `.line_holder` will be an unfolded line. - let(:line_holder) { first('.line_holder[id="a5cc2925ca8258af241be7e5b0381edf30266302_1_1"]') } + let(:line_holder) { first('[id="a5cc2925ca8258af241be7e5b0381edf30266302_1_1"]') } it 'allows commenting' do should_allow_commenting line_holder diff --git a/spec/features/merge_request/user_resolves_conflicts_spec.rb b/spec/features/merge_request/user_resolves_conflicts_spec.rb index d9e3bfd6a9c..03ab42aaccd 100644 --- a/spec/features/merge_request/user_resolves_conflicts_spec.rb +++ b/spec/features/merge_request/user_resolves_conflicts_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' RSpec.describe 'Merge request > User resolves conflicts', :js do - include Spec::Support::Helpers::Features::EditorLiteSpecHelpers + include Spec::Support::Helpers::Features::SourceEditorSpecHelpers let(:project) { create(:project, :repository) } let(:user) { project.creator } diff --git a/spec/features/merge_request/user_sees_merge_widget_spec.rb b/spec/features/merge_request/user_sees_merge_widget_spec.rb index a85700fc721..2f7758143a1 100644 --- a/spec/features/merge_request/user_sees_merge_widget_spec.rb +++ b/spec/features/merge_request/user_sees_merge_widget_spec.rb @@ -373,7 +373,7 @@ RSpec.describe 'Merge request > User sees merge widget', :js do wait_for_requests page.within('.mr-widget-body') do - expect(page).to have_content('Fast-forward merge is not possible') + expect(page).to have_content('Merge Merge blocked: fast-forward merge is not possible. To merge this request, first rebase locally.') end end end diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index 2d8fe10b987..a6c8b10f5ca 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -137,7 +137,7 @@ RSpec.describe 'Merge request > User sees pipelines', :js do check_head_pipeline(expected_project: parent_project) end - it 'does not create a pipeline in the parent project when user cancels the action' do + it 'does not create a pipeline in the parent project when user cancels the action', :clean_gitlab_redis_cache, :clean_gitlab_redis_shared_state do visit project_merge_request_path(parent_project, merge_request) create_merge_request_pipeline diff --git a/spec/features/merge_request/user_sees_versions_spec.rb b/spec/features/merge_request/user_sees_versions_spec.rb index 34ae082750b..5abf4e2f5ad 100644 --- a/spec/features/merge_request/user_sees_versions_spec.rb +++ b/spec/features/merge_request/user_sees_versions_spec.rb @@ -17,8 +17,6 @@ RSpec.describe 'Merge request > User sees versions', :js do let!(:params) { {} } before do - stub_feature_flags(diffs_gradual_load: false) - project.add_maintainer(user) sign_in(user) visit diffs_project_merge_request_path(project, merge_request, params) @@ -30,8 +28,8 @@ RSpec.describe 'Merge request > User sees versions', :js do line_code = "#{file_id}_#{line_code}" page.within(diff_file_selector) do - find(".line_holder[id='#{line_code}'] td:nth-of-type(1)").hover - find(".line_holder[id='#{line_code}'] button").click + first("[id='#{line_code}']").hover + first("[id='#{line_code}'] [role='button']").click page.within("form[data-line-code='#{line_code}']") do fill_in "note[note]", with: comment diff --git a/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb b/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb index b72ac071ecb..19774accaaf 100644 --- a/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb +++ b/spec/features/merge_request/user_toggles_whitespace_changes_spec.rb @@ -20,7 +20,7 @@ RSpec.describe 'Merge request > User toggles whitespace changes', :js do end describe 'clicking "Hide whitespace changes" button' do - it 'toggles the "Hide whitespace changes" button' do + it 'toggles the "Hide whitespace changes" button', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/333793' do find('[data-testid="show-whitespace"]').click visit diffs_project_merge_request_path(project, merge_request) diff --git a/spec/features/merge_request/user_views_diffs_spec.rb b/spec/features/merge_request/user_views_diffs_spec.rb index d5061657c59..09dfe41a718 100644 --- a/spec/features/merge_request/user_views_diffs_spec.rb +++ b/spec/features/merge_request/user_views_diffs_spec.rb @@ -24,7 +24,7 @@ RSpec.describe 'User views diffs', :js do page.within('.file-holder[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd"]') do expect(find('.text-file')).to have_content('fileutils') - expect(page).to have_selector('.new_line [data-linenumber="1"]', count: 1) + expect(page).to have_selector('[data-interop-type="new"] [data-linenumber="1"]') end end @@ -32,8 +32,8 @@ RSpec.describe 'User views diffs', :js do page.within('.file-holder[id="2f6fcd96b88b36ce98c38da085c795a27d92a3dd"]') do all('.js-unfold-all')[1].click - expect(page).to have_selector('.new_line [data-linenumber="24"]', count: 1) - expect(page).not_to have_selector('.new_line [data-linenumber="1"]') + expect(page).to have_selector('[data-interop-type="new"] [data-linenumber="24"]', count: 1) + expect(page).not_to have_selector('[data-interop-type="new"] [data-linenumber="1"]') end end |