microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
62.73k stars 3.38k forks source link

[Feature]: Add the Ability to Prevent Browser Teardown on Failure in --debug Mode #30878

Closed loop-automation closed 2 weeks ago

loop-automation commented 2 weeks ago

🚀 Feature Request

Feature Request

Introduce an option to prevent the browser from tearing down when a test fails while running in --debug mode. This would allow developers to investigate the state of the application directly in the browser post-failure, rather than relying solely on reports.

Example

Example:

When running tests with the --debug flag, the browser remains open and retains its state upon encountering a failure. This allows developers to inspect the application at the exact point of failure, providing a more intuitive and efficient debugging process.

Example command:

npx playwright test --debug --preserve-failure

Motivation

Motivation:

The current debugging process often requires adding manual pauses before the expected point of failure, which can be time-consuming and less effective. By keeping the browser open on failure, developers can immediately interact with the application, inspect elements, and better understand the root cause of issues. This feature would streamline the debugging process, making it faster and more efficient, ultimately improving the development workflow and the overall quality of tests.

yury-s commented 2 weeks ago

You can use VS Code extension and select 'Show browsers' option, this will keep the browser open after test run (whether it's failed or passed). We recommend using that instead of --debug.