This thread is trying to answer question "Why am I not getting all the traces when adding tracing with the flag --tracing=retain-on-failure?"
Related Ask AI answer for "What could be the reasons for not getting all the traces when using the --tracing=retain-on-failure flag in @playwright/test?".
If you're not seeing all traces when using --tracing=retain-on-failure
, there could be a few reasons why.
First, remember that --tracing=retain-on-failure
only retains traces for failed tests. If all your tests pass, you won't see any traces.
Also, your playwright.config.ts
might be misconfigured. For instance, if traces are set to run on the first retry of a failed test using trace: 'on-first-retry'
, but no retries are happening, no traces will be generated.
// playwright.config.ts
module.exports = {
retries: 1,
use: {
trace: 'on-first-retry',
},
};
Ensure you're using Playwright version 1.25 or higher. The --trace
flag was introduced in v1.25.
// package.json
{
"dependencies": {
"playwright": "^1.25.0"
}
}
Make sure your tests actually fail so that retries occur. Also, ensure your test command includes the --trace
flag followed by 'retain-on-failure'
.
npx playwright test --trace=retain-on-failure
If you're still not seeing all the traces, consult the official Playwright documentation or the Playwright community for further guidance. For more tips on handling flaky tests in Playwright, check out this blog post.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].