2014-09-02 18:07:02 +05:30
|
|
|
module SharedNote
|
|
|
|
include Spinach::DSL
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I delete a comment' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within('.main-notes-list') do
|
2015-09-11 14:41:01 +05:30
|
|
|
find('.note').hover
|
|
|
|
find(".js-note-delete").click
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I haven\'t written any comment text' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2014-09-02 18:07:02 +05:30
|
|
|
fill_in "note[note]", with: ""
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I leave a comment like "XML attached"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2014-09-02 18:07:02 +05:30
|
|
|
fill_in "note[note]", with: "XML attached"
|
2016-06-02 11:05:42 +05:30
|
|
|
click_button "Comment"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I preview a comment text like "Bug fixed :smile:"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2014-09-02 18:07:02 +05:30
|
|
|
fill_in "note[note]", with: "Bug fixed :smile:"
|
2015-04-26 12:48:37 +05:30
|
|
|
find('.js-md-preview-button').click
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I submit the comment' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2016-06-02 11:05:42 +05:30
|
|
|
click_button "Comment"
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I write a comment like ":+1: Nice"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
fill_in 'note[note]', with: ':+1: Nice'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see a comment saying "XML attached"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_css(".note")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see the cancel comment button' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2014-09-02 18:07:02 +05:30
|
|
|
should_not have_link("Cancel")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see the comment preview' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(find('.js-md-preview')).not_to be_visible
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'The comment preview tab should say there is nothing to do' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
find('.js-md-preview-button').click
|
|
|
|
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should not see the comment text field' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(find('.js-note-text')).not_to be_visible
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see a comment saying "XML attached"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".note") do
|
|
|
|
expect(page).to have_content("XML attached")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see an empty comment text field' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
|
|
|
expect(page).to have_field("note[note]", with: "")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see the comment write tab' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(page).to have_css('.js-md-write-button', visible: true)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'The comment preview tab should be display rendered Markdown' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
find('.js-md-preview-button').click
|
|
|
|
expect(find('.js-md-preview')).to have_css('img.emoji', visible: true)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see the comment preview' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
expect(page).to have_css('.js-md-preview', visible: true)
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I should see comment "XML attached"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".note") do
|
|
|
|
expect(page).to have_content("XML attached")
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-01-19 16:12:03 +05:30
|
|
|
step 'I should see no notes at all' do
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).not_to have_css('.note')
|
2016-01-19 16:12:03 +05:30
|
|
|
end
|
|
|
|
|
2014-09-02 18:07:02 +05:30
|
|
|
# Markdown
|
|
|
|
|
|
|
|
step 'I leave a comment with a header containing "Comment with a header"' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".js-main-target-form") do
|
2014-09-02 18:07:02 +05:30
|
|
|
fill_in "note[note]", with: "# Comment with a header"
|
2016-06-02 11:05:42 +05:30
|
|
|
click_button "Comment"
|
2014-09-02 18:07:02 +05:30
|
|
|
sleep 0.05
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'The comment with the header should not have an ID' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".note-body > .note-text") do
|
|
|
|
expect(page).to have_content("Comment with a header")
|
|
|
|
expect(page).not_to have_css("#comment-with-a-header")
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I edit the last comment with a +1' do
|
2016-06-02 11:05:42 +05:30
|
|
|
page.within(".main-notes-list") do
|
2015-09-11 14:41:01 +05:30
|
|
|
find(".note").hover
|
|
|
|
find('.js-note-edit').click
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".current-note-edit-form") do
|
2015-04-26 12:48:37 +05:30
|
|
|
fill_in 'note[note]', with: '+1 Awesome!'
|
|
|
|
click_button 'Save Comment'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see +1 in the description' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within(".note") do
|
|
|
|
expect(page).to have_content("+1 Awesome!")
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|