From 41f4dabe2b2fb5755688720e0dae77167424c11c Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Tue, 26 Jan 2016 11:23:26 +0000 Subject: [PATCH] MDL-52899 behat: make PAGE_READY_JS more robust --- lib/behat/behat_base.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/behat/behat_base.php b/lib/behat/behat_base.php index c2dac9a9e72..efe954b3893 100644 --- a/lib/behat/behat_base.php +++ b/lib/behat/behat_base.php @@ -74,7 +74,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext { /** * The JS code to check that the page is ready. */ - const PAGE_READY_JS = '(M && M.util && M.util.pending_js && !Boolean(M.util.pending_js.length)) && (document.readyState === "complete")'; + const PAGE_READY_JS = '(typeof M !== "undefined" && M.util && M.util.pending_js && !Boolean(M.util.pending_js.length)) && (document.readyState === "complete")'; /** * Locates url, based on provided path.