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.
- }
- }
-
}
/**
} 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.');
}
}