Skip to content

Commit cd93d0b

Browse files
committed
MDL-67317 behat: Ensure that on every scenario we have a session.
Before Mink 1.8.0, any call to getSession() used to auto-start the session if it was not avaliable there. That always has been an unsupported detail. With minkphp/Mink#705 new sessions aren't auto-created anymore. And we were relying on that. So this is, simply about to explicitly create the new session in our before_scenario stuff, to guarantee that it's always there.
1 parent 666cc20 commit cd93d0b

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/tests/behat/behat_hooks.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ public function before_scenario(BeforeScenarioScope $scope) {
307307
$driverexceptionmsg = 'Selenium server is not running, you need to start it to run tests that involve Javascript. ' . $moreinfo;
308308
try {
309309
$session = $this->getSession();
310+
if (!$session->isStarted()) {
311+
$session->start();
312+
}
310313
} catch (CurlExec $e) {
311314
// Exception thrown by WebDriver, so only @javascript tests will be caugth; in
312315
// behat_util::check_server_status() we already checked that the server is running.

0 commit comments

Comments
 (0)