Capybara: why doesn't option :visible?

Help to understand why Capybara finds the email address field regardless of value visible.
There is a page with a field on the form:

<label>
 <input type="email" name="email" class="hide" placeholder="Email">
</label>


This is the class .hide
.hide {
 display: none !important;
}


When I test the page using Capybara with the Poltergeist driver, then do a very simple check:
page.must_have_field('email', :type => 'email', :visible => false)
check('Send by email')
page.must_have_field('email', :type => 'email', :visible => true)


Now the test passes, despite the fact that the code to toggle the visibility field is missing, i.e. it is always hidden.
July 12th 19 at 16:42
1 answer
July 12th 19 at 16:44
Solution
The error was that I incorrectly set up the driver for Capybara.

Instead
Capybara.default_driver = :poltergeist
I had
Capybara.javascript_driver = :poltergeist
To learn that I was working with the default driver that is incorrectly looking for hidden items.

Find more questions by tags RubyRuby on Rails