Rayrun
← Back to Discord Forum

Trying to add traces

Hi all, I'm adding tracing with the flag --tracing=retain-on-failure, But i don't get all the traces. anyone know something about this problem?

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?"

0 replies

Answer

Troubleshooting Tracing in @playwright/test

If you're not seeing all traces when using --tracing=retain-on-failure, there could be a few reasons why.

Check Your Test Configuration

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',
  },
};

Verify Your Playwright Version

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"
  }
}

Run Your Tests

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.

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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].