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
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
......
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