diff --git a/lib/tests/behat/behat_hooks.php b/lib/tests/behat/behat_hooks.php index d53ec23ba4d..4881a30711b 100644 --- a/lib/tests/behat/behat_hooks.php +++ b/lib/tests/behat/behat_hooks.php @@ -205,15 +205,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. - } - } - } /** @@ -338,13 +329,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.'); } }