lib/spreewald/web_steps.rb in spreewald-0.9.5 vs lib/spreewald/web_steps.rb in spreewald-0.9.6
- old
+ new
@@ -617,10 +617,13 @@
# Waits for the page to finish loading and AJAX requests to finish.
#
# More details [here](https://makandracards.com/makandra/12139-waiting-for-page-loads-and-ajax-requests-to-finish-with-capybara).
When /^I wait for the page to load$/ do
if [:selenium, :webkit, :poltergeist].include?(Capybara.current_driver)
- wait_until { page.evaluate_script("typeof jQuery === 'undefined' || $.active == 0") } # immediately return when no jQuery is loaded
+ patiently do
+ # when no jQuery is loaded, we assume there are no pending AJAX requests
+ page.evaluate_script("typeof jQuery === 'undefined' || $.active == 0").should be_true
+ end
end
page.has_content? ''
end
# Performs HTTP basic authentication with the given credentials and visits the given path.