Skip to content

Commit

Permalink
MDL-69232 behat: Add debugging information to Selenium fails
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 9, 2020
1 parent 84d08b1 commit f74f0c5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/tests/behat/behat_hooks.php
Expand Up @@ -304,12 +304,23 @@ public function before_scenario(BeforeScenarioScope $scope) {
} 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.
throw new behat_stop_exception($driverexceptionmsg);
throw new behat_stop_exception(
$driverexceptionmsg . '. ' .
$e->getMessage() . "\n\n" .
format_backtrace($e->getTrace(), true)
);
} catch (DriverException $e) {
throw new behat_stop_exception($driverexceptionmsg);
throw new behat_stop_exception(
$driverexceptionmsg . '. ' .
$e->getMessage() . "\n\n" .
format_backtrace($e->getTrace(), true)
);
} catch (UnknownError $e) {
// Generic 'I have no idea' Selenium error. Custom exception to provide more feedback about possible solutions.
throw new behat_stop_exception($e->getMessage());
throw new behat_stop_exception(
$e->getMessage() . "\n\n" .
format_backtrace($e->getTrace(), true)
);
}

$suitename = $scope->getSuite()->getName();
Expand Down

0 comments on commit f74f0c5

Please sign in to comment.