2016-09-07 12:14:41 -04:00
|
|
|
module WaitForVueResource
|
|
|
|
def wait_for_vue_resource(spinner: true)
|
|
|
|
Timeout.timeout(Capybara.default_max_wait_time) do
|
2017-05-09 00:15:34 -04:00
|
|
|
loop until finished_all_vue_resource_requests?
|
2016-09-07 12:14:41 -04:00
|
|
|
end
|
|
|
|
end
|
2017-05-09 00:15:34 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def finished_all_vue_resource_requests?
|
|
|
|
return true unless javascript_test?
|
|
|
|
|
|
|
|
page.evaluate_script('window.activeVueResources || 0').zero?
|
|
|
|
end
|
|
|
|
|
|
|
|
def javascript_test?
|
|
|
|
Capybara.current_driver == Capybara.javascript_driver
|
|
|
|
end
|
2016-09-07 12:14:41 -04:00
|
|
|
end
|