Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When I write FunctionalJavascript tests using the JavascriptTestBase, I often find myself writing the same code over and over again to save the headless browser's HTML at an arbitrary point and debug it after a test fails. It would be helpful is this was an actual method in JavascriptTestBase so that users could easily debug their tests.
Proposed resolution
Add a debug method to JavascriptTestBase which saves the browser's current (as opposed to the original HTML response from drupalGet) HTML to a file.
Remaining tasks
Review.
User interface changes
None.
API changes
A new protected method is added to JavascriptTestBase.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
drupal-js-testing-save-html.patch | 1.99 KB | samuel.mortenson | |
Comments
Comment #2
samuel.mortensonComment #3
dawehnerActually ... this is useful even in BrowserTestBase itself, but then I guess we could have different tests for this test helper :) One for the classical browser test, and one for the javascript one, as you have already.
Comment #15
nod_Personally I run the tests without the --headless option to debug those tests.