A little ditty that makes it really easy to wait for something Javascripty to happen…like a Javascript dialog to appear that gets populated from an AJAX call.
The has_css? method call will wait until the element shows up and if it doesn’t show up before the Capybara timeout expires then it will return false.
You can also just use the built in web step: Then I should see “something loaded by JS”
That will wait for javascripty thing to happen
August 24, 2010 at 5:17 am
Thanks Brandon for the clarification!
The key for us in this step is the :visible => true option. The out of the box “Then I should see” web step passes even if the text isn’t visible but does appear in the DOM, I believe.
We were waiting for a dialog to be visible so we could do something with it.
Sorry I wasn’t more clear in the original post.
August 24, 2010 at 6:43 am