Skip to content

Instantly share code, notes, and snippets.

@skamithi
Last active December 18, 2015 12:59
Show Gist options
  • Save skamithi/5787184 to your computer and use it in GitHub Desktop.
Save skamithi/5787184 to your computer and use it in GitHub Desktop.
capybara 2.0 test for element not visible for either cucumber or rspec feature tests.
context 'my element' do
before do
a =<< EOF
jQuery ->
$('body').append('<div id=empty_or_hidden_element></div>')
EOF
page.execute_script CoffeeScript.compile(a)
end
it 'should not be displayed' do
lambda { find('#empty_or_hidden_element') }.should raise_error(Capybara::ElementNotFound)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment