MDL-82373 behat: Stop killing the entire Behat run on driver error
If there's a driver error, for example from a step taking too long, then this kills the entire Behat run and we have to start from scratch. This change instead throws away the original connection and starts a new one to try and continue the test.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
namespace Moodle\BehatExtension\Driver;
|
||||
|
||||
use Behat\Mink\Exception\DriverException;
|
||||
use OAndreyev\Mink\Driver\WebDriver as UpstreamDriver;
|
||||
|
||||
// phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod
|
||||
@@ -79,4 +80,14 @@ class WebDriver extends UpstreamDriver {
|
||||
public function post_key($key, $xpath) {
|
||||
throw new \Exception('No longer used - please use keyDown and keyUp');
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function stop(): void {
|
||||
try {
|
||||
parent::stop();
|
||||
} catch (DriverException $e) {
|
||||
error_log($e->getMessage());
|
||||
$this->webDriver = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user