Playwright test results in the Tripwire dashboard

Playwright's JSON reporter writes everything Tripwire's runs and tests screens need. This guide maps its fields to the kit's types so your backend can turn a report into a run.

Field mapping

How Playwright's data maps to the kit's Run and TestCase type. Your backend does this mapping and serves the result to the kit. The kit itself doesn't call Playwright. Check field names against Playwright's documentation for the version you use.

Playwright fieldKit fieldNote
stats.expected + stats.unexpected + stats.flaky + stats.skippedRun.totalTotal tests in the run
stats.expectedRun.passed
stats.unexpectedRun.failed
stats.flakyRun.flakyFailed, then passed on retry
stats.durationRun.durationMsMilliseconds
stats.startTimeRun.startedFormat as relative time for display
suites[].specs[].titleTestCase.nameNested suites form the full name
suites[].fileTestCase.file
specs[].tests[].statusTestCase.lastStatusexpected → passed, unexpected → failed, flaky → flaky
specs[].tests[].results[].durationTestCase.avgMsAverage across runs
specs[].tests[].results[].retryTestCase.historyA pass after retry > 0 is an 'r' in the history strip
specs[].tests[].projectNameRun.browserFor example chromium or firefox

How it fits together

  1. CI runs Playwright with the JSON reporter.
  2. A CI step uploads the report to your backend with the branch, commit, author and trigger from the CI environment.
  3. Your backend saves one Run and updates each TestCase's history and rates.
  4. Tripwire's runs, tests and flaky screens read them from your API.

Statuses

Playwright gives each test an outcome of expected, unexpected, flaky or skipped, and each attempt a result status such as passed, failed or timedOut. Map the test outcome to the kit's statuses and use the attempts to build the history strip, so a test that only passes on retry stands out.

Run-level status

Set Run.status to failed if unexpected is above zero, flaky if only flaky is, and passed otherwise. Use running while you're still receiving results.

Questions

How do I get the JSON report?

Run Playwright with the JSON reporter, for example npx playwright test --reporter=json, or set it in playwright.config with an output file, and upload the file from CI to your backend.

Where do branch and commit come from?

Not from the report. Read them from your CI's environment variables when you upload the report.

Can I show screenshots and traces?

Playwright attaches them to results. Store them and link to them from the run detail's evidence list.