Skip to content

Instantly share code, notes, and snippets.

@msankhala
Forked from mortenson/DebugTest.php
Created June 27, 2018 14:48
Show Gist options
  • Save msankhala/31d64fe570626cb77c03c165f5565a8b to your computer and use it in GitHub Desktop.
Save msankhala/31d64fe570626cb77c03c165f5565a8b to your computer and use it in GitHub Desktop.
Debugging Drupal 8 Javascript tests
<?php
class DebugTest extends YourBrokenTest {
/**
* Overrides a broken test method and saves HTML at the point of failure.
*/
public function testName() {
try {
parent::testName();
}
catch (\Exception $e) {
file_put_contents('/Users/me/debug.html', $this->getSession()->getDriver()->getHtml('/html/body'));
throw $e;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment