I would like to add the test name, test path and current URL to my error messages, so that they would show with the Browser: and Screenshots: info. Is this possible, and how?
Example of what I would like to have:
- Error message -
AssertionError: expected false to be truthy
Test name: This is my test name
Test path: C:\e2e-testing\tests\test.js
Test URL: <current_test_URL>
Browser: Chrome 112.0.0.0 / Windows 11
Screenshot: C:\e2e-testing\screenshots\2023-04-20_10-48-53\test-1\Chrome_112.0.0.0_Windows_11\errors\1.png
37 | stacktrace here
Could I do it with a custom reporter or with hooks?
You can use the
onBeforeWritehook to modify the reporter output. The defaultspecreporter does not offer information about the specific page where an error occurred. However, you can explore community reports that offer such information and also use a hook to customize their output.See the help topic describing Modify Reporter Output.