2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
RSpec.shared_examples 'comment on merge request file' do
|
2018-03-17 18:26:18 +05:30
|
|
|
it 'adds a comment' do
|
|
|
|
click_diff_line(find("[id='#{sample_commit.line_code}']"))
|
|
|
|
|
|
|
|
page.within('.js-discussion-note-form') do
|
|
|
|
fill_in(:note_note, with: 'Line is wrong')
|
2020-06-23 00:09:42 +05:30
|
|
|
find('.js-comment-button').click
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
page.within('.notes_holder') do
|
|
|
|
expect(page).to have_content('Line is wrong')
|
2020-06-23 00:09:42 +05:30
|
|
|
expect(page).not_to have_content('Comment on lines')
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
visit(merge_request_path(merge_request))
|
|
|
|
|
|
|
|
page.within('.notes .discussion') do
|
2019-09-30 21:07:59 +05:30
|
|
|
expect(page).to have_content("#{user.name} #{user.to_reference} started a thread")
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_content(sample_commit.line_code_path)
|
|
|
|
expect(page).to have_content('Line is wrong')
|
|
|
|
end
|
|
|
|
|
|
|
|
page.within('.notes-tab .badge') do
|
|
|
|
expect(page).to have_content('1')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|