mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-56898 behat: Go to a non html page to avoid any unwanted ajax calls
After scenario is finished, go to README.txt, so there is no JS/AJAX calls pending and site is ready for reset before next scenario
This commit is contained in:
parent
d9a9a87835
commit
26fef01b6b
@ -411,6 +411,29 @@ class behat_hooks extends behat_base {
|
||||
$this->resize_window('medium');
|
||||
}
|
||||
|
||||
/**
|
||||
* Executed after scenario to go to a page where no JS is executed.
|
||||
* This will ensure there are no unwanted ajax calls from browser and
|
||||
* site can be reset safely.
|
||||
*
|
||||
* @param AfterScenarioScope $scope scope passed by event fired after scenario.
|
||||
* @AfterScenario
|
||||
*/
|
||||
public function after_scenario(AfterScenarioScope $scope) {
|
||||
try {
|
||||
$this->wait_for_pending_js();
|
||||
$this->getSession()->visit($this->locate_path('/README.txt'));
|
||||
$this->getSession()->reset();
|
||||
} catch (DriverException $e) {
|
||||
// Try restart session, if DriverException caught.
|
||||
try {
|
||||
$this->getSession()->restart();
|
||||
} catch (DriverException $e) {
|
||||
// Do nothing, as this will be caught while starting session in before_scenario.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for JS to complete before beginning interacting with the DOM.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user