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