debian-mirror-gitlab/spec/support/wait_for_vue_resource.rb

20 lines
449 B
Ruby
Raw Normal View History

2016-09-29 09:46:39 +05:30
module WaitForVueResource
def wait_for_vue_resource(spinner: true)
Timeout.timeout(Capybara.default_max_wait_time) do
2017-08-17 22:00:37 +05:30
loop until finished_all_vue_resource_requests?
2016-09-29 09:46:39 +05:30
end
end
2017-08-17 22:00:37 +05:30
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-29 09:46:39 +05:30
end