mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-39051 behat: Fix issue after closing popup windows
When a step closes a popup window the page DOM is not available until we switch again to the main window; we should avoid exceptions at framework level when hooking the after step process, this includes the new exceptions catcher modification.
This commit is contained in:
parent
b576bdc75d
commit
217e8e59e5
1 changed files with 41 additions and 34 deletions
|
@ -208,6 +208,9 @@ class behat_hooks extends behat_base {
|
||||||
*/
|
*/
|
||||||
public function i_look_for_exceptions() {
|
public function i_look_for_exceptions() {
|
||||||
|
|
||||||
|
// Wrap in try in case we were interacting with a closed window.
|
||||||
|
try {
|
||||||
|
|
||||||
// Exceptions.
|
// Exceptions.
|
||||||
if ($errormsg = $this->getSession()->getPage()->find('css', '.errorbox p.errormessage')) {
|
if ($errormsg = $this->getSession()->getPage()->find('css', '.errorbox p.errormessage')) {
|
||||||
|
|
||||||
|
@ -251,6 +254,10 @@ class behat_hooks extends behat_base {
|
||||||
$msg = "Other backtraces found:\n" . implode("\n", $msgs);
|
$msg = "Other backtraces found:\n" . implode("\n", $msgs);
|
||||||
throw new \Exception(htmlentities($msg));
|
throw new \Exception(htmlentities($msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (NoSuchWindow $e) {
|
||||||
|
// If we were interacting with a popup window it will not exists after closing it.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue