2 ms·
Ruby's Capybara encapsulates Selenium and waits until elements appear on the page (the default timeout is 2 seconds). So you can write simple sequential code li
by pmontra 11y ago
Ruby's Capybara encapsulates Selenium and waits until elements appear on the page (the default timeout is 2 seconds). So you can write simple sequential code like
click_link('bar')
expect(page).to have_content('baz')
and it will work even if the baz element is injected into the page by an Ajax request to the server triggered by clicking on bar. I've been using it for many years but I didn't check how they implement it. Maybe a callback from a MutationObserver? https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver https://developer.mozilla.org/en-US/docs/Web/API/MutationObs...
Documentation at https://github.com/jnicklas/capybara#asynchronous-javascript-ajax-and-friends https://github.com/jnicklas/capybara#asynchronous-javascript...
- drothlis 11y agoAccording to that documentation you linked, it just polls until `default_max_wait_time` (which defaults to 2 seconds).