1
votes

Im currently using capybara/rspec to test if a div is not visible (display: none), yet it seems this always returns true if the styles are defined in a CSS file rather than directly within the page.

visit "http://#{host}/"
page.find('#sort-by').should_not be_visible

Is this an issue with the webkit driver? I noticed in the documentation of #visible? they noted that results may very for CSS support. http://rubydoc.info/gems/capybara/0.4.0/Capybara/Element#visible%3F-instance_method

Is there further support in later versions of Capybara/webkit? We have contemplated upgrading, but for us doing so isnt trivial.

Im using the following versions of capybara and webkit driver

Capybara 1.1.4
Capybara-webkit 0.13.0
1
Have you tried the have_css matcher?Rimian
I have. It seems like if you add styles directly to the html page it can detect them, however it doesnt load (or search through) the linked CSS style sheets.Alexis Canyon

1 Answers

0
votes

Try with:

expect(page).not_to have_selector("#sort-by")