gitlab-org--gitlab-foss/features/steps/shared/note.rb

168 lines
4.2 KiB
Ruby
Raw Normal View History

2012-09-10 11:35:03 -04:00
module SharedNote
include Spinach::DSL
include WaitForRequests
2012-09-10 11:35:03 -04:00
after do
wait_for_requests if javascript_test?
end
step 'I delete a comment' do
2016-03-30 12:13:18 -04:00
page.within('.main-notes-list') do
note = find('.note')
note.hover
note.find('.more-actions').click
note.find('.more-actions .dropdown-menu li', match: :first)
2015-06-18 22:13:32 -04:00
find(".js-note-delete").click
end
end
step 'I haven\'t written any comment text' do
page.within(".js-main-target-form") do
fill_in "note[note]", with: ""
end
end
step 'I leave a comment like "XML attached"' do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "XML attached"
2016-03-04 08:52:29 -05:00
click_button "Comment"
end
2017-05-05 06:57:29 -04:00
wait_for_requests
2012-09-10 11:35:03 -04:00
end
step 'I preview a comment text like "Bug fixed :smile:"' do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "Bug fixed :smile:"
find('.js-md-preview-button').click
end
2012-09-10 11:35:03 -04:00
end
step 'I submit the comment' do
page.within(".js-main-target-form") do
2016-03-04 08:52:29 -05:00
click_button "Comment"
end
2017-05-05 06:57:29 -04:00
wait_for_requests
end
step 'I write a comment like ":+1: Nice"' do
page.within(".js-main-target-form") do
2014-10-18 19:24:12 -04:00
fill_in 'note[note]', with: ':+1: Nice'
end
end
step 'I should not see a comment saying "XML attached"' do
expect(page).not_to have_css(".note")
end
step 'I should not see the cancel comment button' do
page.within(".js-main-target-form") do
should_not have_link("Cancel")
end
end
step 'I should not see the comment preview' do
page.within(".js-main-target-form") do
expect(find('.js-md-preview')).not_to be_visible
end
end
step 'The comment preview tab should say there is nothing to do' do
page.within(".js-main-target-form") do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_content('Nothing to preview.')
end
end
step 'I should not see the comment text field' do
page.within(".js-main-target-form") do
expect(find('.js-note-text')).not_to be_visible
end
end
step 'I should see a comment saying "XML attached"' do
page.within(".note") do
expect(page).to have_content("XML attached")
end
end
step 'I should see an empty comment text field' do
page.within(".js-main-target-form") do
expect(page).to have_field("note[note]", with: "")
end
end
step 'I should see the comment write tab' do
page.within(".js-main-target-form") do
expect(page).to have_css('.js-md-write-button', visible: true)
end
end
step 'The comment preview tab should be display rendered Markdown' do
page.within(".js-main-target-form") do
find('.js-md-preview-button').click
expect(find('.js-md-preview')).to have_css('gl-emoji', visible: true)
end
end
step 'I should see the comment preview' do
page.within(".js-main-target-form") do
expect(page).to have_css('.js-md-preview', visible: true)
end
end
2013-03-19 11:53:21 -04:00
step 'I should see comment "XML attached"' do
page.within(".note") do
expect(page).to have_content("XML attached")
2013-03-19 11:53:21 -04:00
end
end
step 'I should see no notes at all' do
expect(page).not_to have_css('.note')
end
# Markdown
step 'I leave a comment with a header containing "Comment with a header"' do
page.within(".js-main-target-form") do
fill_in "note[note]", with: "# Comment with a header"
2016-03-04 08:52:29 -05:00
click_button "Comment"
end
wait_for_requests
end
step 'The comment with the header should not have an ID' do
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")
end
end
2014-10-06 02:59:03 -04: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
note = find('.note')
note.hover
note.find('.more-actions').click
note.find('.more-actions .dropdown-menu li', match: :first)
note.find('.js-note-edit').click
2015-06-18 22:13:32 -04:00
end
page.within(".current-note-edit-form") do
fill_in 'note[note]', with: '+1 Awesome!'
click_button 'Save comment'
end
end
step 'I should see +1 in the description' do
page.within(".note") do
expect(page).to have_content("+1 Awesome!")
end
end
2012-09-10 11:35:03 -04:00
end