2018-01-31 19:05:45 +08:00
|
|
|
# wait_for_ajax implementation for axios library
|
|
|
|
# def wait_for_ajax
|
|
|
|
# counter = 0
|
|
|
|
# while page.evaluate_script('window.IN_REQUEST')
|
|
|
|
# counter += 1
|
|
|
|
# sleep(0.1)
|
|
|
|
# if (0.1 * counter) >= Capybara.default_max_wait_time
|
|
|
|
# raise "AJAX request took longer than " \
|
|
|
|
# "#{Capybara.default_max_wait_time} seconds."
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
|
|
|
|
# Jquery implementation
|
2017-10-24 21:39:06 +08:00
|
|
|
def wait_for_ajax
|
2018-01-31 19:05:45 +08:00
|
|
|
Timeout.timeout(Capybara.default_max_wait_time) do
|
|
|
|
loop until page.evaluate_script('jQuery.active').zero?
|
2017-10-24 21:39:06 +08:00
|
|
|
end
|
2019-09-03 21:14:37 +08:00
|
|
|
end
|