diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index 81285c0717a..401ab5012ae 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -210,15 +210,6 @@ class behat_hooks extends behat_base { self::$initprocessesfinished = true; } - // Closing JS dialogs if present. Otherwise they would block this scenario execution. - if ($this->running_javascript()) { - try { - $session->getDriver()->getWebDriverSession()->accept_alert(); - } catch (NoAlertOpenError $e) { - // All ok, there should not be JS dialogs in theory. - } - } - } /** @@ -368,13 +359,6 @@ class behat_hooks extends behat_base { } catch (NoSuchWindow $e) { // If we were interacting with a popup window it will not exists after closing it. - } catch (UnexpectedAlertOpen $e) { - // We fail the scenario if we find an opened JS alert/confirm, in most of the cases it - // will be there because we are leaving an edited form without submitting/cancelling - // it, but moodle is using JS confirms and we can not just cancel the JS dialog - // as in some cases (delete activity with JS enabled for example) the test writer should - // use extra steps to deal with moodle's behaviour. - throw new Exception('Modal window present. Ensure there are no edited forms pending to submit/cancel.'); } }