avoid use :visible option in capybara finders

This commit is contained in:
Fabian Rodriguez 2013-08-25 20:44:11 -03:00
parent e9af8d55af
commit 261ac786c1
5 changed files with 11 additions and 10 deletions

View file

@ -8,7 +8,7 @@ end
Then /^the first comment field should be closed$/ do Then /^the first comment field should be closed$/ do
page.should have_css(".stream_element") page.should have_css(".stream_element")
find("#main_stream .stream_element .new_comment", match: :first, visible: false).should_not be_visible page.should_not have_selector("#main_stream .stream_element .new_comment", match: :first)
end end
When /^I comment "([^"]*)" on "([^"]*)"$/ do |comment_text, post_text| When /^I comment "([^"]*)" on "([^"]*)"$/ do |comment_text, post_text|

View file

@ -95,8 +95,6 @@ end
When /^I append "([^"]*)" to the publisher$/ do |stuff| When /^I append "([^"]*)" to the publisher$/ do |stuff|
elem = find('#status_message_fake_text') elem = find('#status_message_fake_text')
elem.native.send_keys(' ' + stuff) elem.native.send_keys(' ' + stuff)
find('#status_message_text', visible: false).value.should include(stuff)
end end
When /^I append "([^"]*)" to the publisher mobile$/ do |stuff| When /^I append "([^"]*)" to the publisher mobile$/ do |stuff|
@ -119,7 +117,8 @@ end
When /^I prepare the deletion of the first post$/ do When /^I prepare the deletion of the first post$/ do
within('.stream_element', match: :first) do within('.stream_element', match: :first) do
find('.remove_post', visible: false).click find('.controls').hover
find('.remove_post').click
end end
end end
@ -130,7 +129,8 @@ end
When /^I click to delete the first comment$/ do When /^I click to delete the first comment$/ do
within("div.comment", match: :first) do within("div.comment", match: :first) do
find(".comment_delete", visible: false).click find(".controls").hover
find(".comment_delete").click
end end
end end

View file

@ -5,7 +5,7 @@ When /^I press the "([^\"]*)" key somewhere$/ do |key|
end end
When /^I press the "([^\"]*)" key in the publisher$/ do |key| When /^I press the "([^\"]*)" key in the publisher$/ do |key|
find("#status_message_fake_text", visible: false).native.send_keys(key) find("#status_message_fake_text").native.send_keys(key)
end end
Then /^post (\d+) should be highlighted$/ do |position| Then /^post (\d+) should be highlighted$/ do |position|

View file

@ -7,7 +7,7 @@ Then /^the post should be expanded$/ do
end end
Then /^I should see an uploaded image within the photo drop zone$/ do Then /^I should see an uploaded image within the photo drop zone$/ do
find("#photodropzone img", visible: false)["src"].should include("uploads/images") find("#photodropzone img")["src"].should include("uploads/images")
end end
Then /^I should not see an uploaded image within the photo drop zone$/ do Then /^I should not see an uploaded image within the photo drop zone$/ do
@ -35,7 +35,8 @@ And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email|
end end
When /^I click on the first block button/ do When /^I click on the first block button/ do
find(".block_user", visible: false).click find(".stream_element", match: :first).hover
find(".block_user").click
end end
When /^I expand the post$/ do When /^I expand the post$/ do

View file

@ -20,7 +20,7 @@ module PublishingCukeHelpers
def expand_first_post def expand_first_post
within(".stream_element", match: :first) do within(".stream_element", match: :first) do
find(".expander").click find(".expander").click
find(".expander", visible: false).should_not be_visible has_css?(".expander").should be_false
end end
end end
@ -30,7 +30,7 @@ module PublishingCukeHelpers
end end
def first_post_expanded? def first_post_expanded?
find(".stream_element .expander", match: :first, visible: false).should_not be_visible has_no_css?(".stream_element .expander", match: :first).should be_true
find(".stream_element .collapsible", match: :first).has_no_selector?(".collapsed") find(".stream_element .collapsible", match: :first).has_no_selector?(".collapsed")
find(".stream_element .collapsible", match: :first).has_selector?(".opened") find(".stream_element .collapsible", match: :first).has_selector?(".opened")
end end