2012-09-10 11:35:03 -04:00
|
|
|
module SharedNote
|
|
|
|
include Spinach::DSL
|
2016-10-16 13:40:52 -04:00
|
|
|
include WaitForAjax
|
2012-09-10 11:35:03 -04:00
|
|
|
|
2016-11-14 09:55:31 -05:00
|
|
|
after do
|
|
|
|
wait_for_ajax if javascript_test?
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I delete a comment' do
|
2016-03-30 12:13:18 -04:00
|
|
|
page.within('.main-notes-list') do
|
2015-06-18 22:13:32 -04:00
|
|
|
find('.note').hover
|
|
|
|
find(".js-note-delete").click
|
|
|
|
end
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I haven\'t written any comment text' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2013-01-14 17:55:02 -05:00
|
|
|
fill_in "note[note]", with: ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I leave a comment like "XML attached"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2013-01-14 17:55:02 -05:00
|
|
|
fill_in "note[note]", with: "XML attached"
|
2016-03-04 08:52:29 -05:00
|
|
|
click_button "Comment"
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
2012-09-10 11:35:03 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I preview a comment text like "Bug fixed :smile:"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2013-01-14 17:55:02 -05:00
|
|
|
fill_in "note[note]", with: "Bug fixed :smile:"
|
2014-10-17 00:10:50 -04:00
|
|
|
find('.js-md-preview-button').click
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
2012-09-10 11:35:03 -04:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I submit the comment' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2016-03-04 08:52:29 -05:00
|
|
|
click_button "Comment"
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-17 00:36:52 -04:00
|
|
|
step 'I write a comment like ":+1: Nice"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-10-18 19:24:12 -04:00
|
|
|
fill_in 'note[note]', with: ':+1: Nice'
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see a comment saying "XML attached"' do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).not_to have_css(".note")
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the cancel comment button' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2013-01-14 17:55:02 -05:00
|
|
|
should_not have_link("Cancel")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the comment preview' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-10-20 22:53:17 -04:00
|
|
|
expect(find('.js-md-preview')).not_to be_visible
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-17 00:36:52 -04:00
|
|
|
step 'The comment preview tab should say there is nothing to do' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-10-17 00:36:52 -04:00
|
|
|
find('.js-md-preview-button').click
|
|
|
|
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should not see the comment text field' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-09-29 17:58:01 -04:00
|
|
|
expect(find('.js-note-text')).not_to be_visible
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see a comment saying "XML attached"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".note") do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content("XML attached")
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see an empty comment text field' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_field("note[note]", with: "")
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-17 00:36:52 -04:00
|
|
|
step 'I should see the comment write tab' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-10-20 22:53:17 -04:00
|
|
|
expect(page).to have_css('.js-md-write-button', visible: true)
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-17 00:36:52 -04:00
|
|
|
step 'The comment preview tab should be display rendered Markdown' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-10-17 00:36:52 -04:00
|
|
|
find('.js-md-preview-button').click
|
2017-03-24 20:10:57 -04:00
|
|
|
expect(find('.js-md-preview')).to have_css('gl-emoji', visible: true)
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-17 00:36:52 -04:00
|
|
|
step 'I should see the comment preview' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-10-20 22:53:17 -04:00
|
|
|
expect(page).to have_css('.js-md-preview', visible: true)
|
2013-01-14 17:55:02 -05:00
|
|
|
end
|
|
|
|
end
|
2013-03-19 11:53:21 -04:00
|
|
|
|
2014-09-21 17:40:22 -04:00
|
|
|
step 'I should see comment "XML attached"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".note") do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content("XML attached")
|
2013-03-19 11:53:21 -04:00
|
|
|
end
|
|
|
|
end
|
2014-02-04 02:48:33 -05:00
|
|
|
|
2016-01-12 12:10:06 -05:00
|
|
|
step 'I should see no notes at all' do
|
2016-05-23 19:37:59 -04:00
|
|
|
expect(page).not_to have_css('.note')
|
2016-01-12 12:10:06 -05:00
|
|
|
end
|
|
|
|
|
2014-02-04 02:48:33 -05:00
|
|
|
# Markdown
|
|
|
|
|
|
|
|
step 'I leave a comment with a header containing "Comment with a header"' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".js-main-target-form") do
|
2014-02-04 02:48:33 -05:00
|
|
|
fill_in "note[note]", with: "# Comment with a header"
|
2016-03-04 08:52:29 -05:00
|
|
|
click_button "Comment"
|
2014-02-04 02:48:33 -05:00
|
|
|
end
|
2016-10-16 13:40:52 -04:00
|
|
|
|
|
|
|
wait_for_ajax
|
2014-02-04 02:48:33 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
step 'The comment with the header should not have an ID' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".note-body > .note-text") do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content("Comment with a header")
|
|
|
|
expect(page).not_to have_css("#comment-with-a-header")
|
2014-02-04 02:48:33 -05:00
|
|
|
end
|
|
|
|
end
|
2014-10-06 02:59:03 -04:00
|
|
|
|
2015-03-02 18:05:23 -05:00
|
|
|
step 'I edit the last comment with a +1' do
|
2016-03-30 15:11:41 -04:00
|
|
|
page.within(".main-notes-list") do
|
2015-06-18 22:13:32 -04:00
|
|
|
find(".note").hover
|
|
|
|
find('.js-note-edit').click
|
|
|
|
end
|
2015-03-02 18:05:23 -05:00
|
|
|
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".current-note-edit-form") do
|
2015-03-02 18:05:23 -05:00
|
|
|
fill_in 'note[note]', with: '+1 Awesome!'
|
|
|
|
click_button 'Save Comment'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see +1 in the description' do
|
2015-06-12 01:36:00 -04:00
|
|
|
page.within(".note") do
|
2015-06-12 00:44:13 -04:00
|
|
|
expect(page).to have_content("+1 Awesome!")
|
2015-03-02 18:05:23 -05:00
|
|
|
end
|
|
|
|
end
|
2012-09-10 11:35:03 -04:00
|
|
|
end
|