MDL-69232 behat: Add debugging information to Selenium fails
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 8 Jul 2020 07:35:11 +0000 (15:35 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 9 Jul 2020 01:30:15 +0000 (09:30 +0800)
lib/tests/behat/behat_hooks.php

index 11f4e71..d9ee40a 100644 (file)
@@ -312,12 +312,23 @@ class behat_hooks extends behat_base {
         } 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();