Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Is there a way to pause/debug tests on fail? #27635

Open
rhemfelt opened this issue Oct 16, 2023 · 2 comments
Open

[Feature] Is there a way to pause/debug tests on fail? #27635

rhemfelt opened this issue Oct 16, 2023 · 2 comments

Comments

@rhemfelt
Copy link

rhemfelt commented Oct 16, 2023

In TestCafe, there's a simple --debug-on-fail command line flag that automatically pauses the test if it fails, so you can troubleshoot and debug it. It is singularly one of the most used and useful command line flags for me in TestCafe, I run it with at least 95% of my test runs.

It doesn't seem that Playwright has this pause on fail option, making troubleshooting test failures a big pain. Trying to pinpoint exactly where in the test code it failed, then manually adding an await page.pause(); before that action or assertion, then rerunning each failed test, then manually performing the action that ostensibly triggered the initial failure, then going back and removing the await page.pause(); after you've finished debugging.

Is there any way (outside of VS Code) to automatically pause a test on failure? It's strange to me that this doesn't seem to be an option.

@aalexgabi
Copy link

aalexgabi commented Jan 4, 2024

This would save so much time. I really don't understand why is not the default behavior with --debug. See a related discussion that died here #10132

When a test fails currently you need to:

  • find the file that failed
  • open the file
  • understand the code and which of the steps was failing by matching the steps in the ui against the code which is super hard
  • add await page.pause()
  • rerunning test

This happens very often and every time a minute or so is wasted.

@guido-visser
Copy link

This feature would be very welcome! I tried to use the Break on (un)caught exceptions, but that triggers too much. I just want to break when an assertion fails, so I can debug whats going on and fix the test that way instead of using the trace viewer. It's very nice, but breaking in debug mode would be better :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants