def wait_for
Timeout.timeout(Capybara.default_wait_time) do
loop until
begin
yield
rescue MiniTest::Assertion
end
end
yield
end
Showing posts with label capybara. Show all posts
Showing posts with label capybara. Show all posts
Wait for Javascript and AJAX changes in Capybara
Recently I was having trouble with JS-enabled tests with Capybara on a Ruby on Rails app, when clicking stuff around and then asserting about content that was not on the page yet. I tried several solutions I found online, but either they were talking about wait_until, which is a method that's not available in Capybara anymore, or they just didn't work for me. Therefore, I decided to roll my own:
Labels:
capybara,
Ruby on Rails,
testing
Subscribe to:
Posts (Atom)