Commit ce27f74a authored by Paul Slaughter's avatar Paul Slaughter

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
parent 01426b03
...@@ -139,44 +139,50 @@ describe 'Merge request > User resolves diff notes and discussions', :js do ...@@ -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 expect(find('.diffs .diff-file .notes_holder')).to be_visible
end end
end end
end
it 'allows user to resolve from reply form without a comment' do describe 'reply form' do
page.within '.diff-content' do before do
click_button 'Reply...' click_button 'Toggle discussion'
click_button 'Resolve discussion' page.within '.diff-content' do
end click_button 'Reply...'
end
end
page.within '.line-resolve-all-container' do it 'allows user to unresolve from reply form without a comment' do
expect(page).to have_content('1/1 discussion resolved') page.within '.diff-content' do
expect(page).to have_selector('.line-resolve-btn.is-active') click_button 'Unresolve discussion'
end
end
it 'allows user to unresolve from reply form without a comment' do wait_for_requests
page.within '.diff-content' do end
click_button 'Resolve discussion'
sleep 1
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' it 'allows user to comment & unresolve discussion' do
end page.within '.diff-content' do
find('.js-note-text').set 'testing'
page.within '.line-resolve-all-container' do click_button 'Comment & unresolve discussion'
expect(page).to have_content('0/1 discussion resolved')
expect(page).not_to have_selector('.line-resolve-btn.is-active') wait_for_requests
end
page.within '.line-resolve-all-container' do
expect(page).to have_content('0/1 discussion resolved')
end
end
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 page.within '.diff-content' do
click_button 'Reply...' click_button 'Reply...'
find('.js-note-text').set 'testing' click_button 'Resolve discussion'
click_button 'Comment & resolve discussion'
end end
page.within '.line-resolve-all-container' do page.within '.line-resolve-all-container' do
...@@ -185,19 +191,18 @@ describe 'Merge request > User resolves diff notes and discussions', :js do ...@@ -185,19 +191,18 @@ describe 'Merge request > User resolves diff notes and discussions', :js do
end end
end end
it 'allows user to comment & unresolve discussion' do it 'allows user to comment & resolve discussion' do
page.within '.diff-content' do page.within '.diff-content' do
click_button 'Resolve discussion'
click_button 'Reply...' click_button 'Reply...'
find('.js-note-text').set 'testing' find('.js-note-text').set 'testing'
click_button 'Comment & unresolve discussion' click_button 'Comment & resolve discussion'
end end
page.within '.line-resolve-all-container' do 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
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment