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

16 lines
358 B
Ruby
Raw Normal View History

2015-12-23 02:04:40 +05:30
module WaitForAjax
def wait_for_ajax
2016-06-02 11:05:42 +05:30
Timeout.timeout(Capybara.default_max_wait_time) do
2015-12-23 02:04:40 +05:30
loop until finished_all_ajax_requests?
end
end
def finished_all_ajax_requests?
page.evaluate_script('jQuery.active').zero?
end
2016-11-03 12:29:30 +05:30
def javascript_test?
[:selenium, :webkit, :chrome, :poltergeist].include?(Capybara.current_driver)
end
2015-12-23 02:04:40 +05:30
end