From 7a5072c5a8f03cd7342a5f8e74e1fde0250ce360 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Mon, 20 Oct 2014 21:53:17 -0500 Subject: Fix test assertions Make sure we're asserting the correct thing when testing visible and invisible DOM elements. --- features/steps/shared/diff_note.rb | 8 ++++---- features/steps/shared/markdown.rb | 10 +++++----- features/steps/shared/note.rb | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'features') diff --git a/features/steps/shared/diff_note.rb b/features/steps/shared/diff_note.rb index 7f1dde16c17..28964d54a8f 100644 --- a/features/steps/shared/diff_note.rb +++ b/features/steps/shared/diff_note.rb @@ -132,26 +132,26 @@ module SharedDiffNote step 'I should see the diff comment preview' do within("#{diff_file_selector} form") do - expect(page).to have_css('.js-md-preview') + expect(page).to have_css('.js-md-preview', visible: true) end end step 'I should see the diff comment write tab' do within(diff_file_selector) do - expect(page).to have_css('.js-md-write-button') + expect(page).to have_css('.js-md-write-button', visible: true) end end step 'The diff comment preview tab should display rendered Markdown' do within(diff_file_selector) do find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji') + expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end step 'I should see two separate previews' do within(diff_file_selector) do - expect(page).to have_css('.js-md-preview', count: 2) + expect(page).to have_css('.js-md-preview', visible: true, count: 2) expect(page).to have_content('Should fix it') expect(page).to have_content('DRY this up') end diff --git a/features/steps/shared/markdown.rb b/features/steps/shared/markdown.rb index 8dfb8ed72e9..e71700880cd 100644 --- a/features/steps/shared/markdown.rb +++ b/features/steps/shared/markdown.rb @@ -56,7 +56,7 @@ EOT end step 'I should not see the Markdown preview' do - expect(find('.gfm-form')).not_to have_css('.js-md-preview', visible: true) + expect(find('.gfm-form .js-md-preview')).not_to be_visible end step 'The Markdown preview tab should say there is nothing to do' do @@ -67,21 +67,21 @@ EOT end step 'I should not see the Markdown text field' do - expect(find('.gfm-form')).not_to have_css('textarea', visible: true) + expect(find('.gfm-form textarea')).not_to be_visible end step 'I should see the Markdown write tab' do - expect(find('.gfm-form')).to have_css('.js-md-write-button') + expect(find('.gfm-form')).to have_css('.js-md-write-button', visible: true) end step 'I should see the Markdown preview' do - expect(find('.gfm-form')).to have_css('.js-md-preview') + expect(find('.gfm-form')).to have_css('.js-md-preview', visible: true) end 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') + expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb index 52d8c7e50fa..17adec3eda1 100644 --- a/features/steps/shared/note.rb +++ b/features/steps/shared/note.rb @@ -51,7 +51,7 @@ 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', visible: true) + expect(find('.js-md-preview')).not_to be_visible end end @@ -82,20 +82,20 @@ module SharedNote step 'I should see the comment write tab' do within(".js-main-target-form") do - expect(page).to have_css('.js-md-write-button') + expect(page).to have_css('.js-md-write-button', visible: true) end end step 'The comment preview tab should be display rendered Markdown' do within(".js-main-target-form") do find('.js-md-preview-button').click - expect(find('.js-md-preview')).to have_css('img.emoji') + expect(find('.js-md-preview')).to have_css('img.emoji', visible: true) end end step 'I should see the comment preview' do within(".js-main-target-form") do - expect(page).to have_css('.js-md-preview') + expect(page).to have_css('.js-md-preview', visible: true) end end -- cgit v1.2.1