Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View wait_until.rb
1 2 3 4 5 6 7
def wait_until
require "timeout"
Timeout.timeout(Capybara.default_wait_time) do
sleep(0.1) until value = yield
value
end
end

Give an example usage as well.

wait_until { page.should have_content("something") } @vishnun

After some research, found that wait_until has been removed from capybara 2.0.

In my case, I was able to wait for the page to have label text using the below:
page.has_css?('classname')

Cheers!

@zacksiri That's exactly when you should not use wait_until :)

See http://www.elabs.se/blog/53-why-wait_until-was-removed-from-capybara

I liked the @CoinAge approach.

This snippet of code has worked really well for us. Ideally we would use the waiting_rspec_matchers gem: https://github.com/abotalov/waiting_rspec_matchers. But we're on an older version of rspec so it isn't an option.

Here is the code we use to wait until the 'Content-Disposition' response header is present and then check that it is expected value.

wait_until { page.response_headers.include?('Content-Disposition') }
page.response_headers['Content-Disposition'].should include("expected value")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.