mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-07 16:09:57 +08:00
11 lines
293 B
Ruby
11 lines
293 B
Ruby
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
|