Skip to content
The docs are now organized by product area. Old links still work. Report a broken link

Playwright reporter

Install @qualflare/playwright, add it to playwright.config.ts and upload its qualflare-results folder with the Qualflare CLI, sharded runs included.

Last updated

@qualflare/playwright is the Qualflare reporter for Playwright Test 1.40 or later: it writes each run's results, with nested test.step() trees, per-attempt retries, screenshots, videos and traces, to ./qualflare-results, and qf <identifier> collect uploads the folder as one launch.

FactDetail
Package@qualflare/playwright on npm
Works with@playwright/test 1.40 or later, Node.js 18 or later (Playwright 1.62 and later need Node.js 20)
qfqf ≥ 0.1.24 (requires qf 0.1.24 or later)
LicenseApache-2.0
SourceQualflare/qualflare-playwright on GitHub
Without the reporter--format playwright with Playwright's JSON reporter

Before you begin

  • The Qualflare CLI, qf: Install the CLI.
  • A saved login: qf login <identifier> with a project access token whose creator still holds the project role that uploads need Editor+ · project (requires the Editor role or higher in the project) (Authenticate with qf login).
  • The Identifier of the environment the results belong to (Environments).

Install

npm install --save-dev @qualflare/playwright

Configure

// playwright.config.ts
import { defineConfig } from '@playwright/test';
import { qualflareReporter } from '@qualflare/playwright';

export default defineConfig({
  reporter: [['list'], qualflareReporter({ environment: 'staging' })],
});

The tuple form works too: ['@qualflare/playwright/reporter', { environment: 'staging' }].

OptionTypeDefaultRequiredDescription
includeApiStepsbooleanfalseNo

Report Playwright's pw:api and fixture steps too. A failed one is always reported. Variable QUALFLARE_INCLUDE_API_STEPS.

attachScreenshotsbooleantrueNo

false skips every attachment, videos included. Variable QUALFLARE_ATTACH_SCREENSHOTS.

maxTraceBytesnumber52428800No

Skips a larger trace before copying it. Variable QUALFLARE_MAX_TRACE_BYTES.

maxVideoBytesnumber52428800No

The same for a video. Variable QUALFLARE_MAX_VIDEO_BYTES.

A relative outputDir resolves against the folder of your Playwright config, not the shell's working directory.

Every reporter shares the other settings: see Reporter configuration.

Set environment to the environment's Identifier: a name such as Staging fails the upload with HTTP 400 (Environment).

Run and upload

npx playwright test
qf <identifier> collect ./qualflare-results

Screenshots upload by default. Add --upload-artifacts video,trace to upload videos and traces; qf prints how many it skipped otherwise.

Run in CI

- name: Upload results to Qualflare
  if: ${{ !cancelled() }}
  env:
    QF_TOKEN: ${{ secrets.QF_TOKEN }}
    QF_BRANCH: ${{ github.head_ref || github.ref_name }}
    QF_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
  run: |
    npm install -g @qualflare/cli
    qf login ci --force
    qf ci collect ./qualflare-results

if: ${{ !cancelled() }} uploads the results when tests fail, and QF_BRANCH and QF_COMMIT record a pull request's own branch and commit (Pull request branches). For GitLab CI/CD, Jenkins and Azure Pipelines, see Run the upload when tests fail.

Sharding and retries

Point every shard at the same folder. Playwright passes its own --shard value to the reporter, which stamps each test with a 0-based shard index, so nothing needs configuring. Playwright's merge-reports mode and blob reporter aren't supported: use the folder. Merge sharded CI jobs into one launch has a GitHub Actions example with this reporter.

Each attempt's status, duration and error is uploaded; steps, labels, tags and attachments come from the final attempt. A test that ran once sends no attempts.

What gets uploaded

  • Status, with the history of each retried attempt.
  • Nested steps. qualflare.step() runs Playwright's own test.step(), so the steps also show in Playwright's HTML report and trace viewer.
  • Screenshots, videos and traces.
  • Labels, links, tags, priority and parameters.

A test sets its own metadata with the qualflare calls:

import { test } from '@playwright/test';
import { qualflare } from '@qualflare/playwright';

test('a user can check out @smoke', async ({ page }) => {
  qualflare.label('epic', 'Billing');
  qualflare.link('https://tracker.example/QF-42', { type: 'issue', name: 'QF-42' });
  qualflare.priority('high');

  await qualflare.step('add an item to the cart', async () => {
    qualflare.parameter('sku', 'BOOK-1');
    await page.getByRole('button', { name: 'Add' }).click();
  });
});

qf doesn't read the branch, commit, language or milestone from the report: set them on the upload (Branch, commit, language and milestone).

Troubleshooting

  • Traces are missing: pass --upload-artifacts trace to the upload, and use qf 0.1.20 or later.
  • Hundreds of steps per test: includeApiSteps is on; turn it off.
  • environment "Staging" does not exist in this project: use the environment's Identifier, or pass --environment on the upload (Environment).
  • Screenshots can't be downloaded: qf is older than 0.1.24. Upgrade qf.