Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

fill_in not working #253

Closed
melvinram opened this issue Jan 24, 2012 · 2 comments
Closed

fill_in not working #253

melvinram opened this issue Jan 24, 2012 · 2 comments

Comments

@melvinram
Copy link

https://gist.github.com/f028102c7633780a8fe4

This fills out the form without the :js => true but when I add :js => true, it doesn't fill out the form anymore.

This isn't related to the fixture transactions issue as I've already changed that part.

@jferris
Copy link
Member

jferris commented Jan 27, 2012

Changes to forms won't be visible in save_and_open_page, because filling in text fields doesn't actually modify the DOM. You can save a screen shot by using the render method on the driver: http://rubydoc.info/gems/capybara-webkit/Capybara/Driver/Webkit#render-instance_method (it accepts a path, and width/height options).

The should change lambda that's commented out in your example won't usually work with asynchronous drivers, because the server thread will likely still be processing the request when you check to see if it created an appointment. Capybara has a helper called wait_until to deal with these async issues:

original_count = Appointment.count
click_button "Pay Now & Request Appointment"
wait_until { Appointment.count == original_count + 1 }

It's generally better to look for something on the page rather than looking for changes in the database. If you use matchers like have_content and have_css, Capybara will synchronize for you.

@jferris jferris closed this as completed Jan 27, 2012
@sithara
Copy link

sithara commented Feb 19, 2016

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants