diff options
Diffstat (limited to 'features/steps')
-rw-r--r-- | features/steps/shared/diff_note.rb | 12 | ||||
-rw-r--r-- | features/steps/shared/markdown.rb | 24 | ||||
-rw-r--r-- | features/steps/shared/note.rb | 22 |
3 files changed, 34 insertions, 24 deletions
diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 8871b93edb6..aa31a09e326 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 df4514b5646..10da67a6ba8 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 a83f74228af..9802614ec72 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 |