From 5647d5deaf5a05da1cb0a75984859c61682a1c1b Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Tue, 4 Apr 2017 16:12:05 -0400 Subject: [PATCH] Simplify the `javascript_test?` helper Also don't try to run `page.evaluate_script` when we're not in a JavaScript test. --- spec/support/wait_for_ajax.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/support/wait_for_ajax.rb b/spec/support/wait_for_ajax.rb index 0f9dc2dee75..d10c265c336 100644 --- a/spec/support/wait_for_ajax.rb +++ b/spec/support/wait_for_ajax.rb @@ -6,10 +6,12 @@ module WaitForAjax end def finished_all_ajax_requests? + return true unless javascript_test? + page.evaluate_script('jQuery.active').zero? end def javascript_test? - [:selenium, :webkit, :chrome, :poltergeist].include?(Capybara.current_driver) + Capybara.current_driver == Capybara.javascript_driver end end