-
-
Save Overbryd/1070678 to your computer and use it in GitHub Desktop.
Test capybara visibility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Then /^"([^"]+)" should not be visible(?: within "([^\"]*)")?$/ do |text, selector| | |
wait_until do | |
its_hidden = page.evaluate_script("$('#{selector}:contains(#{text})').is(':hidden');") | |
its_not_in_dom = page.evaluate_script("$('#{selector}:contains(#{text})').length == 0;") | |
(its_hidden || its_not_in_dom).should be_true | |
end | |
end | |
Then /^"([^"]+)" should be visible(?: within "([^\"]*)")?$/ do |text, selector| | |
wait_until do | |
its_hidden = page.evaluate_script("$('#{selector}:contains(#{text})').is(':hidden');") | |
its_not_in_dom = page.evaluate_script("$('#{selector}:contains(#{text})').length == 0;") | |
(its_hidden || its_not_in_dom).should be_false | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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