Simplify the javascript_test? helper

Also don't try to run `page.evaluate_script` when we're not in a
JavaScript test.
This commit is contained in:
Robert Speicher 2017-04-04 16:12:05 -04:00
parent 40ba2f7d20
commit 5647d5deaf

View file

@ -6,10 +6,12 @@ module WaitForAjax
end end
def finished_all_ajax_requests? def finished_all_ajax_requests?
return true unless javascript_test?
page.evaluate_script('jQuery.active').zero? page.evaluate_script('jQuery.active').zero?
end end
def javascript_test? def javascript_test?
[:selenium, :webkit, :chrome, :poltergeist].include?(Capybara.current_driver) Capybara.current_driver == Capybara.javascript_driver
end end
end end