debian-mirror-gitlab/spec/support/wait_for_vue_resource.rb
2017-08-17 22:00:37 +05:30

19 lines
449 B
Ruby

module WaitForVueResource
def wait_for_vue_resource(spinner: true)
Timeout.timeout(Capybara.default_max_wait_time) do
loop until finished_all_vue_resource_requests?
end
end
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
end