MDL-58948 behat: return the result of the pending JS method

This increases compatibility with other Mink drivers,
in particular, the Chrome Mink Driver.
This commit is contained in:
Mark Nielsen
2017-06-28 11:20:49 -07:00
parent f4a2d69631
commit 5536bf4f22
+2 -2
View File
@@ -727,7 +727,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
$pending = '';
try {
$jscode = '
return function() {
return (function() {
if (typeof M === "undefined") {
if (document.readyState === "complete") {
return "";
@@ -741,7 +741,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
} else {
return "incomplete"
}
}();';
}());';
$pending = $this->getSession()->evaluateScript($jscode);
} catch (NoSuchWindow $nsw) {
// We catch an exception here, in case we just closed the window we were interacting with.