Is there an elegant way to do this? At the moment i just use a custom step "And wait 10 seconds" to be absolutely sure, there is enough time for the iframe to get ready. I don't want this feature to fail on my underpowered CI VM because of a small network issue or cpu spikes. But this means that the feature suite wastes a lot of time, and as you know, if the test suite takes a long time, one often doesn't bother to run it outside the CI server.
If you know what's going to be in your iframe you could do:
within_frame 'iframe_selector' do
wait_until(10) do
page.should have_content("Content you're waiting for")
end
end
The wait_until
method will keep waiting for 10 seconds or until the condition page.should
returns true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With