diff options
Diffstat (limited to 'spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb')
-rw-r--r-- | spec/features/merge_request/user_resolves_diff_notes_and_discussions_resolve_spec.rb | 55 |
1 files changed, 38 insertions, 17 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 b4ad4b64d8e..a0b9d6cb059 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 @@ -5,7 +5,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do let(:user) { project.creator } let(:guest) { create(:user) } let(:merge_request) { create(:merge_request_with_diffs, source_project: project, author: user, title: "Bug NS-04") } - let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request) } + let!(:note) { create(:diff_note_on_merge_request, project: project, noteable: merge_request, note: "| Markdown | Table |\n|-------|---------|\n| first | second |") } let(:path) { "files/ruby/popen.rb" } let(:position) do Gitlab::Diff::Position.new( @@ -102,7 +102,8 @@ describe 'Merge request > User resolves diff notes and discussions', :js do describe 'timeline view' do it 'hides when resolve discussion is clicked' do - expect(page).to have_selector('.discussion-body', visible: false) + expect(page).to have_selector('.discussion-header') + expect(page).not_to have_selector('.discussion-body') end it 'shows resolved discussion when toggled' do @@ -111,6 +112,15 @@ describe 'Merge request > User resolves diff notes and discussions', :js do expect(page.find(".line-holder-placeholder")).to be_visible expect(page.find(".timeline-content #note_#{note.id}")).to be_visible end + + it 'renders tables in lazy-loaded resolved diff dicussions' do + find(".timeline-content .discussion[data-discussion-id='#{note.discussion_id}'] .discussion-toggle-button").click + + wait_for_requests + + expect(page.find(".timeline-content #note_#{note.id}")).not_to have_css(".line_holder") + expect(page.find(".timeline-content #note_#{note.id}")).to have_css("tr", count: 2) + end end describe 'side-by-side view' do @@ -120,7 +130,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end it 'hides when resolve discussion is clicked' do - expect(page).to have_selector('.diffs .diff-file .notes_holder', visible: false) + expect(page).not_to have_selector('.diffs .diff-file .notes_holder') end it 'shows resolved discussion when toggled' do @@ -209,10 +219,13 @@ describe 'Merge request > User resolves diff notes and discussions', :js do it 'updates updated text after resolving note' do page.within '.diff-content .note' do - find('.line-resolve-btn').click - end + resolve_button = find('.line-resolve-btn') + + resolve_button.click + wait_for_requests - expect(page).to have_content("Resolved by #{user.name}") + expect(resolve_button['data-original-title']).to eq("Resolved by #{user.name}") + end end it 'hides jump to next discussion button' do @@ -245,11 +258,16 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end it 'resolves discussion' do - page.all('.note .line-resolve-btn').each do |button| + resolve_buttons = page.all('.note .line-resolve-btn', count: 2) + resolve_buttons.each do |button| button.click end - expect(page).to have_content('Resolved by') + wait_for_requests + + resolve_buttons.each do |button| + expect(button['data-original-title']).to eq("Resolved by #{user.name}") + end page.within '.line-resolve-all-container' do expect(page).to have_content('1/1 discussion resolved') @@ -278,7 +296,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end it 'allows user to mark all notes as resolved' do - page.all('.line-resolve-btn').each do |btn| + page.all('.note .line-resolve-btn', count: 2).each do |btn| btn.click end @@ -289,7 +307,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end it 'allows user user to mark all discussions as resolved' do - page.all('.discussion-reply-holder').each do |reply_holder| + page.all('.discussion-reply-holder', count: 2).each do |reply_holder| page.within reply_holder do click_button 'Resolve discussion' end @@ -302,7 +320,7 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end it 'allows user to quickly scroll to next unresolved discussion' do - page.within first('.discussion-reply-holder') do + page.within('.discussion-reply-holder', match: :first) do click_button 'Resolve discussion' end @@ -314,19 +332,22 @@ describe 'Merge request > User resolves diff notes and discussions', :js do end it 'updates updated text after resolving note' do - page.within first('.diff-content .note') do - find('.line-resolve-btn').click - end + page.within('.diff-content .note', match: :first) do + resolve_button = find('.line-resolve-btn') + + resolve_button.click + wait_for_requests - expect(page).to have_content("Resolved by #{user.name}") + expect(resolve_button['data-original-title']).to eq("Resolved by #{user.name}") + end end it 'shows jump to next discussion button' do - expect(page.all('.discussion-reply-holder')).to all(have_selector('.discussion-next-btn')) + expect(page.all('.discussion-reply-holder', count: 2)).to all(have_selector('.discussion-next-btn')) end it 'displays next discussion even if hidden' do - page.all('.note-discussion').each do |discussion| + page.all('.note-discussion', count: 2).each do |discussion| page.within discussion do click_button 'Toggle discussion' end |