From ce27f74afa4ff16eccf353b5ce1bf430c6eb64b3 Mon Sep 17 00:00:00 2001 From: Paul Slaughter Date: Sun, 23 Sep 2018 16:02:33 -0500 Subject: Refactor 'resolved discussion reply form' specs **Why?** - These specs had duplicated code for a common context - New specs for this context needs to be added **Notes:** - Also added some `wait_for_requests` to buttons that triggered AJAX --- ...lves_diff_notes_and_discussions_resolve_spec.rb | 65 ++++++++++++---------- 1 file changed, 35 insertions(+), 30 deletions(-) (limited to 'spec/features') diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index 2d268ecab58..8f595a2b095 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -139,44 +139,50 @@ describe 'Merge request > User resolves diff notes and discussions', :js do expect(find('.diffs .diff-file .notes_holder')).to be_visible end end - end - it 'allows user to resolve from reply form without a comment' do - page.within '.diff-content' do - click_button 'Reply...' + describe 'reply form' do + before do + click_button 'Toggle discussion' - click_button 'Resolve discussion' - end + page.within '.diff-content' do + click_button 'Reply...' + end + end - page.within '.line-resolve-all-container' do - expect(page).to have_content('1/1 discussion resolved') - expect(page).to have_selector('.line-resolve-btn.is-active') - end - end + it 'allows user to unresolve from reply form without a comment' do + page.within '.diff-content' do + click_button 'Unresolve discussion' - it 'allows user to unresolve from reply form without a comment' do - page.within '.diff-content' do - click_button 'Resolve discussion' - sleep 1 + wait_for_requests + end - click_button 'Reply...' + page.within '.line-resolve-all-container' do + expect(page).to have_content('0/1 discussion resolved') + expect(page).not_to have_selector('.line-resolve-btn.is-active') + end + end - click_button 'Unresolve discussion' - end + it 'allows user to comment & unresolve discussion' do + page.within '.diff-content' do + find('.js-note-text').set 'testing' - page.within '.line-resolve-all-container' do - expect(page).to have_content('0/1 discussion resolved') - expect(page).not_to have_selector('.line-resolve-btn.is-active') + click_button 'Comment & unresolve discussion' + + wait_for_requests + end + + page.within '.line-resolve-all-container' do + expect(page).to have_content('0/1 discussion resolved') + end + end end end - it 'allows user to comment & resolve discussion' do + it 'allows user to resolve from reply form without a comment' do page.within '.diff-content' do click_button 'Reply...' - find('.js-note-text').set 'testing' - - click_button 'Comment & resolve discussion' + click_button 'Resolve discussion' end page.within '.line-resolve-all-container' do @@ -185,19 +191,18 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end end - it 'allows user to comment & unresolve discussion' do + it 'allows user to comment & resolve discussion' do page.within '.diff-content' do - click_button 'Resolve discussion' - click_button 'Reply...' find('.js-note-text').set 'testing' - click_button 'Comment & unresolve discussion' + click_button 'Comment & resolve discussion' end page.within '.line-resolve-all-container' do - expect(page).to have_content('0/1 discussion resolved') + expect(page).to have_content('1/1 discussion resolved') + expect(page).to have_selector('.line-resolve-btn.is-active') end end -- cgit v1.2.1 From 370f07361c6d0fb1565003ae9427f69ad6004009 Mon Sep 17 00:00:00 2001 From: Paul Slaughter Date: Sun, 23 Sep 2018 16:15:29 -0500 Subject: Auto resolve new notes of resolved discussions **Why?** The previous behavior had resolved discussions being unresolved when commented on. This was strange UX, especially since there is a separate button for "Comment & unresolve discussion". https://gitlab.com/gitlab-org/gitlab-ce/issues/24128 **Note:** - Also adds changelog --- ...ser_resolves_diff_notes_and_discussions_resolve_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'spec/features') diff --git a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb index 8f595a2b095..8a16c011067 100644 --- a/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb +++ b/spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb @@ -149,6 +149,20 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end end + it 'allows user to comment' do + page.within '.diff-content' do + find('.js-note-text').set 'testing' + + click_button 'Comment' + + wait_for_requests + end + + page.within '.line-resolve-all-container' do + expect(page).to have_content('1/1 discussion resolved') + end + end + it 'allows user to unresolve from reply form without a comment' do page.within '.diff-content' do click_button 'Unresolve discussion' -- cgit v1.2.1