After I upgraded Capybara from 2.1.0 to 2.2.1 and Poltergeist from 1.4.1 to 1.5.0, the following rspec wait started in my rails application tests:
it{ expect(page).to have_field("foo_field_id", with: nil) }
The rspec error looks like this:
Failure/Error: it{ expect(page).to have_field("foo_field_id", with: nil) }
Capybara::ExpectationNotMet:
expected to find field "foo_field_id" but there were no matches. Also found "", which matched the selector but not all filters.
If I throw a breakpoint for verification, the value is really zero:
» page.find_field('foo_field_id').value
=> nil
If I change "from" to "text", the statement passes:
it{ expect(page).to have_field("foo_field_id", text: nil) }
The HTML form field is as follows:
<input class="string optional" id="foo_field_id" name="foo[field_id]" type="text">
Why is this happening?
source
share