Module: AjaxHelpers
- Defined in:
- lib/test_support/ajax_helpers.rb
Instance Method Summary collapse
- #finished_all_ajax_requests? ⇒ Boolean
- #wait_for_ajax(timeout = Capybara.default_max_wait_time) ⇒ Object
Instance Method Details
#finished_all_ajax_requests? ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'lib/test_support/ajax_helpers.rb', line 10 def finished_all_ajax_requests? if page.driver.is_a? Capybara::RackTest::Driver true else page.evaluate_script("jQuery.active").zero? end end |
#wait_for_ajax(timeout = Capybara.default_max_wait_time) ⇒ Object
4 5 6 7 8 |
# File 'lib/test_support/ajax_helpers.rb', line 4 def wait_for_ajax(timeout = Capybara.default_max_wait_time) Timeout.timeout(timeout) do loop until finished_all_ajax_requests? end end |