diff --git a/features/project/commits/comments.feature b/features/project/commits/comments.feature index e176752cfbfbd33620ac49fe9b4ba08c7dec571c..a45245917e3d1bd66ed88c48ddcb7c16207d973c 100644 --- a/features/project/commits/comments.feature +++ b/features/project/commits/comments.feature @@ -16,12 +16,12 @@ Feature: Project Commits Comments @javascript Scenario: I can't preview without text Given I haven't written any comment text - Then I should not see the comment preview button + Then The comment preview tab should say there is nothing to do @javascript Scenario: I can preview with text - Given I write a comment like "Nice" - Then I should see the comment preview button + Given I write a comment like ":+1: Nice" + Then The comment preview tab should be display rendered Markdown @javascript Scenario: I preview a comment @@ -32,7 +32,7 @@ Feature: Project Commits Comments @javascript Scenario: I can edit after preview Given I preview a comment text like "Bug fixed :smile:" - Then I should see the comment edit button + Then I should see the comment write tab @javascript Scenario: I have a reset form after posting from preview diff --git a/features/project/commits/diff_comments.feature b/features/project/commits/diff_comments.feature index a145ec84b78950b2996c20bf2f64fe4b3fd67e3b..9c4cc723d1bf294854fbe4f95b0a677497e0bb93 100644 --- a/features/project/commits/diff_comments.feature +++ b/features/project/commits/diff_comments.feature @@ -58,13 +58,13 @@ Feature: Project Commits Diff Comments Scenario: I can't preview without text Given I open a diff comment form And I haven't written any diff comment text - Then I should not see the diff comment preview button + Then The diff comment preview tab should say there is nothing to do @javascript Scenario: I can preview with text Given I open a diff comment form And I write a diff comment like ":-1: I don't like this" - Then I should see the diff comment preview button + Then The diff comment preview tab should display rendered Markdown @javascript Scenario: I preview a diff comment @@ -75,7 +75,7 @@ Feature: Project Commits Diff Comments @javascript Scenario: I can edit after preview Given I preview a diff comment text like "Should fix it :smile:" - Then I should see the diff comment edit button + Then I should see the diff comment write tab @javascript Scenario: The form gets removed after posting diff --git a/features/project/issues/issues.feature b/features/project/issues/issues.feature index e7fbe2bd6f1c835980fafbcff21531ec66e33ae4..9970be0c5967a061cf84b31a19a49ddf8e29ea25 100644 --- a/features/project/issues/issues.feature +++ b/features/project/issues/issues.feature @@ -166,13 +166,13 @@ Feature: Project Issues Scenario: I can't preview without text Given I click link "New Issue" And I haven't written any description text - Then I should not see the Markdown preview button + Then The Markdown preview tab should say there is nothing to do @javascript Scenario: I can preview with text Given I click link "New Issue" - And I write a description like "Nice" - Then I should see the Markdown preview button + And I write a description like ":+1: Nice" + Then The Markdown preview tab should display rendered Markdown @javascript Scenario: I preview an issue description @@ -185,4 +185,4 @@ Feature: Project Issues Scenario: I can edit after preview Given I click link "New Issue" And I preview a description text like "Bug fixed :smile:" - Then I should see the Markdown edit button + Then I should see the Markdown write tab diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 8871b93edb69754267fe6a3be2808b5e3731284c..aa31a09e3261606ac68e3e3da9bdd733661cbf39 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -71,9 +71,10 @@ module SharedDiffNote end end - step 'I should not see the diff comment preview button' do + step 'The diff comment preview tab should say there is nothing to do' do within(diff_file_selector) do - expect(page).not_to have_css('.js-md-preview-button') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_content('Nothing to preview.') end end @@ -135,15 +136,16 @@ module SharedDiffNote end end - step 'I should see the diff comment edit button' do + step 'I should see the diff comment write tab' do within(diff_file_selector) do expect(page).to have_css('.js-md-write-button') end end - step 'I should see the diff comment preview button' do + step 'The diff comment preview tab should display rendered Markdown' do within(diff_file_selector) do - expect(page).to have_css('.js-md-preview-button') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_css('img.emoji') end end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index df4514b5646e93a73b8975bae79cabd6eb53854e..10da67a6ba89dd82c6caabb88ade081ea31e1f1b 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -56,18 +56,21 @@ EOT end step 'I should not see the Markdown preview' do - expect(find('.gfm-form')).not_to have_css('.js-md-preview') + expect(find('.gfm-form')).not_to have_css('.js-md-preview', visible: true) end - step 'I should not see the Markdown preview button' do - expect(find('.gfm-form')).not_to have_css('.js-md-preview-button') + step 'The Markdown preview tab should say there is nothing to do' do + within(".gfm-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 Markdown text field' do - expect(find('.gfm-form')).not_to have_css('textarea') + expect(find('.gfm-form')).not_to have_css('textarea', visible: true) end - step 'I should see the Markdown edit button' do + step 'I should see the Markdown write tab' do expect(find('.gfm-form')).to have_css('.js-md-write-button') end @@ -75,12 +78,15 @@ EOT expect(find('.gfm-form')).to have_css('.js-md-preview') end - step 'I should see the Markdown preview button' do - expect(find('.gfm-form')).to have_css('.js-md-preview-button') + step 'The Markdown preview tab should display rendered Markdown' do + within(".gfm-form") do + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_css('img.emoji') + end end - step 'I write a description like "Nice"' do - find('.gfm-form').fill_in 'Description', with: 'Nice' + step 'I write a description like ":+1: Nice"' do + find('.gfm-form').fill_in 'Description', with: ':+1: Nice' end step 'I preview a description text like "Bug fixed :smile:"' do diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index a83f74228af37eed8de6a21a6bda401bc2f24015..9802614ec7299f7e55a4fa8c877c56d1bd9d728a 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -33,9 +33,9 @@ module SharedNote end end - step 'I write a comment like "Nice"' do + step 'I write a comment like ":+1: Nice"' do within(".js-main-target-form") do - fill_in "note[note]", with: "Nice" + fill_in "note[note]", with: ":+1: Nice" end end @@ -51,13 +51,14 @@ module SharedNote step 'I should not see the comment preview' do within(".js-main-target-form") do - expect(page).not_to have_css('.js-md-preview') + expect(page).not_to have_css('.js-md-preview', visible: true) end end - step 'I should not see the comment preview button' do + step 'The comment preview tab should say there is nothing to do' do within(".js-main-target-form") do - expect(page).not_to have_css('.js-md-preview-button') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_content('Nothing to preview.') end end @@ -79,21 +80,22 @@ module SharedNote end end - step 'I should see the comment edit button' do + step 'I should see the comment write tab' do within(".js-main-target-form") do expect(page).to have_css('.js-md-write-button') end end - step 'I should see the comment preview' do + step 'The comment preview tab should be display rendered Markdown' do within(".js-main-target-form") do - expect(page).to have_css('.js-md-preview') + find('.js-md-preview-button').click + expect(find('.js-md-preview')).to have_css('img.emoji') end end - step 'I should see the comment preview button' do + step 'I should see the comment preview' do within(".js-main-target-form") do - expect(page).to have_css('.js-md-preview-button') + expect(page).to have_css('.js-md-preview') end end diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb index 36394265abf182c61863bf4eb9567fb537c1add7..3a99a260498bbf7d1d2115a6bf5676240ef85576 100644 --- a/spec/features/notes_on_merge_requests_spec.rb +++ b/spec/features/notes_on_merge_requests_spec.rb @@ -21,7 +21,6 @@ describe 'Comments' do find(".js-main-target-form input[type=submit]").value.should == "Add Comment" within('.js-main-target-form') do expect(page).not_to have_link('Cancel') - expect(page).not_to have_css('.js-md-preview-button', visible: true) end end