Created
February 17, 2012 20:06
-
-
Save littlebee/1855161 to your computer and use it in GitHub Desktop.
Test selector visible or not with cucumber
This file contains hidden or 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 /^I should( not)? see selector "([^\"]*)"/ do |negate, selector| | |
| wait_until do | |
| its_hidden = page.evaluate_script("$('#{selector}').is(':hidden');") | |
| its_not_in_dom = page.evaluate_script("$('#{selector}').length == 0;") | |
| (its_hidden || its_not_in_dom).should (negate ? be_true : be_false) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment