Skip to content

Instantly share code, notes, and snippets.

@kilaulena
Created July 7, 2011 22:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kilaulena/1070663 to your computer and use it in GitHub Desktop.
Save kilaulena/1070663 to your computer and use it in GitHub Desktop.
test capybara visibility
Then /^"([^\"]+)" should be visible$/ do |text|
assert page.has_xpath?("//*[not(descendant-or-self::script)][ancestor::*[contains(@style,'display: none;')]][contains(normalize-space(.),'#{text}')]")
end
Then /^"([^\"]+)" should not be visible$/ do |text|
assert page.has_xpath?("//*[not(descendant-or-self::script)][ancestor::*[contains(@style,'display: none;')]][contains(normalize-space(.),'#{text}')]")
end
When I follow "¥ JPY"
Then "¥ JPY" should be visible within ".header_nav"
And "€ EUR" should not be visible within ".header_nav"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment