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 https://github.com/minkphp/Mink/pull/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.
This commit is contained in:
Eloy Lafuente (stronk7) 2020-04-09 14:02:40 +02:00
parent 788dfb9c7d
commit 98f56e6f4b

View File

@ -307,6 +307,9 @@ class behat_hooks extends behat_base {
$driverexceptionmsg = 'Selenium server is not running, you need to start it to run tests that involve Javascript. ' . $moreinfo;
try {
$session = $this->getSession();
if (!$session->isStarted()) {
$session->start();
}
} catch (CurlExec $e) {
// Exception thrown by WebDriver, so only @javascript tests will be caugth; in
// behat_util::check_server_status() we already checked that the server is running.