Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/merge_request/batch_comments_spec.rb')
-rw-r--r--spec/features/merge_request/batch_comments_spec.rb271
1 files changed, 134 insertions, 137 deletions
diff --git a/spec/features/merge_request/batch_comments_spec.rb b/spec/features/merge_request/batch_comments_spec.rb
index 9b54d95be6b..f03c812ebb5 100644
--- a/spec/features/merge_request/batch_comments_spec.rb
+++ b/spec/features/merge_request/batch_comments_spec.rb
@@ -13,224 +13,221 @@ RSpec.describe 'Merge request > Batch comments', :js do
end
before do
- stub_feature_flags(paginated_notes: false)
-
project.add_maintainer(user)
sign_in(user)
+
+ visit_diffs
end
- context 'Feature is enabled' do
- before do
- visit_diffs
- end
+ it 'adds draft note' do
+ write_diff_comment
- it 'adds draft note' do
- write_diff_comment
+ expect(find('.draft-note-component')).to have_content('Line is wrong')
- expect(find('.draft-note-component')).to have_content('Line is wrong')
+ expect(page).to have_selector('[data-testid="review_bar_component"]')
- expect(page).to have_selector('[data-testid="review_bar_component"]')
+ expect(find('[data-testid="review_bar_component"] .gl-badge')).to have_content('1')
+ end
+
+ it 'publishes review' do
+ write_diff_comment
- expect(find('[data-testid="review_bar_component"] .btn-confirm')).to have_content('1')
+ page.within('.review-bar-content') do
+ click_button 'Finish review'
+ click_button 'Submit review'
end
- it 'publishes review' do
- write_diff_comment
+ wait_for_requests
- page.within('.review-bar-content') do
- click_button 'Submit review'
- end
+ expect(page).not_to have_selector('.draft-note-component', text: 'Line is wrong')
- wait_for_requests
+ expect(page).to have_selector('.note:not(.draft-note)', text: 'Line is wrong')
+ end
- expect(page).not_to have_selector('.draft-note-component', text: 'Line is wrong')
+ it 'publishes single comment' do
+ write_diff_comment
- expect(page).to have_selector('.note:not(.draft-note)', text: 'Line is wrong')
- end
+ click_button 'Add comment now'
- it 'publishes single comment' do
- write_diff_comment
+ wait_for_requests
- click_button 'Add comment now'
+ expect(page).not_to have_selector('.draft-note-component', text: 'Line is wrong')
- wait_for_requests
+ expect(page).to have_selector('.note:not(.draft-note)', text: 'Line is wrong')
+ end
+
+ it 'deletes draft note' do
+ write_diff_comment
- expect(page).not_to have_selector('.draft-note-component', text: 'Line is wrong')
+ find('.js-note-delete').click
- expect(page).to have_selector('.note:not(.draft-note)', text: 'Line is wrong')
+ page.within('.modal') do
+ click_button('Delete Comment', match: :first)
end
- it 'deletes draft note' do
- write_diff_comment
+ wait_for_requests
- find('.js-note-delete').click
+ expect(page).not_to have_selector('.draft-note-component', text: 'Line is wrong')
+ end
- page.within('.modal') do
- click_button('Delete Comment', match: :first)
- end
+ it 'edits draft note' do
+ write_diff_comment
- wait_for_requests
+ find('.js-note-edit').click
- expect(page).not_to have_selector('.draft-note-component', text: 'Line is wrong')
- end
+ # make sure comment form is in view
+ execute_script("window.scrollBy(0, 200)")
- it 'edits draft note' do
- write_diff_comment
+ write_comment(text: 'Testing update', button_text: 'Save comment')
- find('.js-note-edit').click
+ expect(page).to have_selector('.draft-note-component', text: 'Testing update')
+ end
- # make sure comment form is in view
- execute_script("window.scrollBy(0, 200)")
+ context 'with image and file draft note' do
+ let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project) }
+ let!(:draft_on_text) { create(:draft_note_on_text_diff, merge_request: merge_request, author: user, path: 'README.md', note: 'Lorem ipsum on text...') }
+ let!(:draft_on_image) { create(:draft_note_on_image_diff, merge_request: merge_request, author: user, path: 'files/images/ee_repo_logo.png', note: 'Lorem ipsum on an image...') }
- write_comment(text: 'Testing update', button_text: 'Save comment')
+ it 'does not show in overview' do
+ visit_overview
- expect(page).to have_selector('.draft-note-component', text: 'Testing update')
+ expect(page).to have_no_text(draft_on_text.note)
+ expect(page).to have_no_text(draft_on_image.note)
end
+ end
- context 'with image and file draft note' do
- let(:merge_request) { create(:merge_request_with_diffs, :with_image_diffs, source_project: project) }
- let!(:draft_on_text) { create(:draft_note_on_text_diff, merge_request: merge_request, author: user, path: 'README.md', note: 'Lorem ipsum on text...') }
- let!(:draft_on_image) { create(:draft_note_on_image_diff, merge_request: merge_request, author: user, path: 'files/images/ee_repo_logo.png', note: 'Lorem ipsum on an image...') }
-
- it 'does not show in overview' do
- visit_overview
+ context 'adding single comment to review' do
+ before do
+ visit_overview
+ end
- expect(page).to have_no_text(draft_on_text.note)
- expect(page).to have_no_text(draft_on_image.note)
- end
+ it 'at first does not show `Add to review` and `Add comment now` buttons' do
+ expect(page).to have_no_button('Add to review')
+ expect(page).to have_no_button('Add comment now')
end
- context 'adding single comment to review' do
+ context 'when review has started' do
before do
- visit_overview
- end
-
- it 'at first does not show `Add to review` and `Add comment now` buttons' do
- expect(page).to have_no_button('Add to review')
- expect(page).to have_no_button('Add comment now')
- end
-
- context 'when review has started' do
- before do
- visit_diffs
+ visit_diffs
- write_diff_comment
+ write_diff_comment
- visit_overview
- end
+ visit_overview
+ end
- it 'can add comment to review' do
- write_comment(selector: '.js-main-target-form', field: 'note-body', text: 'Its a draft comment', button_text: 'Add to review')
+ it 'can add comment to review' do
+ write_comment(selector: '.js-main-target-form', field: 'note-body', text: 'Its a draft comment', button_text: 'Add to review')
- expect(page).to have_selector('.draft-note-component', text: 'Its a draft comment')
+ expect(page).to have_selector('.draft-note-component', text: 'Its a draft comment')
- click_button('Pending comments')
+ click_button('Pending comments')
- expect(page).to have_text('2 pending comments')
- end
+ expect(page).to have_text('2 pending comments')
+ end
- it 'can add comment right away' do
- write_comment(selector: '.js-main-target-form', field: 'note-body', text: 'Its a regular comment', button_text: 'Add comment now')
+ it 'can add comment right away' do
+ write_comment(selector: '.js-main-target-form', field: 'note-body', text: 'Its a regular comment', button_text: 'Add comment now')
- expect(page).to have_selector('.note:not(.draft-note)', text: 'Its a regular comment')
+ expect(page).to have_selector('.note:not(.draft-note)', text: 'Its a regular comment')
- click_button('Pending comments')
+ click_button('Pending comments')
- expect(page).to have_text('1 pending comment')
- end
+ expect(page).to have_text('1 pending comment')
end
end
+ end
- context 'in parallel diff' do
- before do
- find('.js-show-diff-settings').click
- click_button 'Side-by-side'
- find('.js-show-diff-settings').click
- end
+ context 'in parallel diff' do
+ before do
+ find('.js-show-diff-settings').click
+ click_button 'Side-by-side'
+ find('.js-show-diff-settings').click
+ end
- it 'adds draft comments to both sides' do
- write_parallel_comment('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9')
- write_parallel_comment('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9', button_text: 'Add to review', text: 'Another wrong line')
+ it 'adds draft comments to both sides' do
+ write_parallel_comment('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_10_9')
+ write_parallel_comment('2f6fcd96b88b36ce98c38da085c795a27d92a3dd_9_9', button_text: 'Add to review', text: 'Another wrong line')
- expect(find('.new .draft-note-component')).to have_content('Line is wrong')
- expect(find('.old .draft-note-component')).to have_content('Another wrong line')
+ expect(find('.new .draft-note-component')).to have_content('Line is wrong')
+ expect(find('.old .draft-note-component')).to have_content('Another wrong line')
- expect(find('.review-bar-content .btn-confirm')).to have_content('2')
- end
+ expect(find('.review-bar-content .gl-badge')).to have_content('2')
end
+ end
- context 'thread is unresolved' do
- let!(:active_discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion }
+ context 'thread is unresolved' do
+ let!(:active_discussion) { create(:diff_note_on_merge_request, noteable: merge_request, project: project).to_discussion }
- before do
- visit_diffs
- end
+ before do
+ visit_diffs
+ end
- it 'publishes comment right away and resolves the thread' do
- expect(active_discussion.resolved?).to eq(false)
+ it 'publishes comment right away and resolves the thread' do
+ expect(active_discussion.resolved?).to eq(false)
- write_reply_to_discussion(button_text: 'Add comment now', resolve: true)
+ write_reply_to_discussion(button_text: 'Add comment now', resolve: true)
- page.within '.discussions-counter' do
- expect(page).to have_content('All threads resolved')
- end
+ page.within '.discussions-counter' do
+ expect(page).to have_content('All threads resolved')
end
+ end
- it 'publishes review and resolves the thread' do
- expect(active_discussion.resolved?).to eq(false)
+ it 'publishes review and resolves the thread' do
+ expect(active_discussion.resolved?).to eq(false)
- write_reply_to_discussion(resolve: true)
+ write_reply_to_discussion(resolve: true)
- page.within('.review-bar-content') do
- click_button 'Submit review'
- end
+ page.within('.review-bar-content') do
+ click_button 'Finish review'
+ click_button 'Submit review'
+ end
- wait_for_requests
+ wait_for_requests
- page.within '.discussions-counter' do
- expect(page).to have_content('All threads resolved')
- end
+ page.within '.discussions-counter' do
+ expect(page).to have_content('All threads resolved')
end
end
+ end
- context 'thread is resolved' do
- let!(:active_discussion) { create(:diff_note_on_merge_request, :resolved, noteable: merge_request, project: project).to_discussion }
+ context 'thread is resolved' do
+ let!(:active_discussion) { create(:diff_note_on_merge_request, :resolved, noteable: merge_request, project: project).to_discussion }
- before do
- active_discussion.resolve!(@current_user)
+ before do
+ active_discussion.resolve!(@current_user)
- visit_diffs
+ visit_diffs
- page.find('.js-diff-comment-avatar').click
- end
+ page.find('.js-diff-comment-avatar').click
+ end
- it 'publishes comment right away and unresolves the thread' do
- expect(active_discussion.resolved?).to eq(true)
+ it 'publishes comment right away and unresolves the thread' do
+ expect(active_discussion.resolved?).to eq(true)
- write_reply_to_discussion(button_text: 'Add comment now', unresolve: true)
+ write_reply_to_discussion(button_text: 'Add comment now', unresolve: true)
- page.within '.discussions-counter' do
- expect(page).to have_content('1 unresolved thread')
- end
+ page.within '.discussions-counter' do
+ expect(page).to have_content('1 unresolved thread')
end
+ end
- it 'publishes review and unresolves the thread' do
- expect(active_discussion.resolved?).to eq(true)
+ it 'publishes review and unresolves the thread' do
+ expect(active_discussion.resolved?).to eq(true)
- wait_for_requests
+ wait_for_requests
- write_reply_to_discussion(button_text: 'Start a review', unresolve: true)
+ write_reply_to_discussion(button_text: 'Start a review', unresolve: true)
- page.within('.review-bar-content') do
- click_button 'Submit review'
- end
+ page.within('.review-bar-content') do
+ click_button 'Finish review'
+ click_button 'Submit review'
+ end
- wait_for_requests
+ wait_for_requests
- page.within '.discussions-counter' do
- expect(page).to have_content('1 unresolved thread')
- end
+ page.within '.discussions-counter' do
+ expect(page).to have_content('1 unresolved thread')
end
end
end