playwright
playwright copied to clipboard
[Feature] Allow to abort tests in headless mode
When running the tests in headed mode, the tests can be easily aborted by just closing PW's browser window(s).
However, when running in headless mode, there is no way to abort the tests. The user can only terminate the process with Ctrl+C but of course then there will be no test results.
Being able to abort tests can be useful when you've already seen a fail that you want to investigate while running the tests and you don't want to wait the extra minutes until all tests have finished.
So it would be nice to have such an option, for example via the command-line or just with some keyboard shortcut.
If you run it in headed mode you always know whats going on, this is not the case for headless mode. So based on what you want to make the decision to cancel the test when?
Actually closing the browser is not really aborting the test, its more like that everything fails after you do it.
Happy to hear your use-case of it to understand more if this makes sense to add.
Yes of course, closing the browser doesn't actual abort the test, it just happens to fulfill that purpose for me. But of course a dedicated abort functionality would be better.
this is not the case for headless mode. So based on what you want to make the decision to cancel the test when?
Based on the console output, I can see the fails there. So if I'm running 25 tests and I see a fail in the 3rd test, I would like to abort it and take a look at the traces & video.
I believe --max-failures can help you to abort the execution.
Source: https://github.com/microsoft/playwright/issues/4759#issuecomment-748422812
Interesting idea! In theory it would work, but practically it wouldn't really. :D
Using --max-failures requires that you already expect something to fail beforehand.
The scenario I'm talking about is more ad-hoc, e.g. I'm running pre- oder post-release tests and find an issue that I wanna investigate immediately.
So in order for that to work, I would basically have to add --max-failures 1 for every test run I ever do, but of course I don't usually want a test run to stop because of a failure.
What I was thinking of is more like a key combination that aborts the tests but creates the attachments.
Why was this issue closed?
Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors.
If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated.