Anybody ever run into a Capybara test that just needed a sleep? I.e., the built in Capybara handling of asynch JS code just didn’t work.
When the button is clicked, the UI first appears for a microsecond without the disabled="disabled"property, and then the callback can change that runs. I had a bug in this code, and I wanted to demonstrate the fix with a failing test. However, the test would pass because I would be asserting that the input does not contain disabled, which it doesn’t at first.
I could work around this issue by either:
- Putting in a
- Starting the bit of UI being displayed to have some OK button with state disabled, and then enabling that button at the end of the 2nd callback (which I’m testing). Seems reasonable to have the button disabled until the code finishes.
I hate putting in a sleep, and I hate changing the code for a test. And neither of these terribly bad either.