diff options
author | Paul Slaughter <pslaughter@gitlab.com> | 2018-09-24 00:02:33 +0300 |
---|---|---|
committer | Paul Slaughter <pslaughter@gitlab.com> | 2018-09-24 16:27:02 +0300 |
commit | ce27f74afa4ff16eccf353b5ce1bf430c6eb64b3 (patch) | |
tree | 50eb355ee9f3b7fa7e1fe072f6c6c9ace1892152 /spec/features | |
parent | 01426b03a57d0725e2792278a39ebdf642daac10 (diff) |
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
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb | 65 |
1 files changed, 35 insertions, 30 deletions
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 |