@probara/playwright-reporter
v0.4.0
Published
Playwright reporter that sends every test result to Probara.
Maintainers
Readme
A Playwright reporter that sends every test result of a run to
Probara: each attempt with its status, steps, errors and attachments, linked
to its Probara test case. Cases that are missing get created, and the run is closed once everything
is in. Built on @probara/core.
Features
- One result per attempt, retries included, with Playwright's own verdict:
test.fail(), skips with their reasons, timeouts (statuses, retries). - Linking by a
probara_caseannotation, a case id in the title (SHOP-12 logs in) orprobara.id(), with the same automation keys asprobara import junit(linking). - Steps from
test.stepand hooks, nested, with the files attached inside them; declared case steps withprobara.step(action, expected, data)(steps). - Attachments: screenshots, videos, traces, error context,
testInfo.attach()andprobara.attach()(attachments). - Visual testing with
probaraSnap(page, name): screenshots compared between commits in Probara Snap (Probara Snap). - Metadata for the cases a report creates: title, suite, tags, system and custom fields, parameters, comments (metadata).
- Runs by name: environment, milestone, test plan, configurations, tags and the CI source
(run options); sharded CI and
merge-reportsinto one run (sharding); several Probara projects (multi-project). - Never breaks your test run: a reporting problem is logged, never thrown, and Playwright's
exit code stays the tests' own. What could not be sent can be kept in a file and sent later with
probara import results 'probara-results*.json', never overwriting an earlier file (results file).
More framework reporters are on the way. Until then, any tool that writes JUnit XML reports through the CLI.
Requirements
- Node.js 22.12 or later.
@playwright/test1.42 or later.- A Probara app token, created from the Playwright card in Integrations
(get a token), and the code of the project to report into
(such as
SHOP). Reporting from CI needs a paid plan.
Install
npm i -D @probara/playwright-reporterQuick start
In Probara, open Workspace › Integrations, pick the Playwright card and create a token (get a token). Store it as a CI secret named
PROBARA_API_TOKEN: the reporter reads it from the environment, never from the config.Add the reporter next to the one you read in the terminal, with your project code (or set
PROBARA_PROJECTinstead):// playwright.config.ts import { defineConfig } from '@playwright/test'; export default defineConfig({ reporter: [['list'], ['@probara/playwright-reporter', { projectId: 'SHOP' }]], });Run your tests with the token in the environment. In GitHub Actions:
- name: Run Playwright tests run: npx playwright test env: PROBARA_API_TOKEN: ${{ secrets.PROBARA_API_TOKEN }}
Without a token and a project the reporter stays off and quiet, so local runs send nothing. In CI
it logs on stderr, in [probara] lines, and ends with the link to the run:
$ npx playwright test
[probara] Sending 2 results of 2 tests (2 passed, 0 failed, 0 skipped, 0 blocked)
[probara] Recorded 2 results (1 new case, 0 unmatched) in R-1 (closed): https://app.probara.net/projects/SHOP/runs/R-1Pick your CI in the CI guides for a complete workflow.
What gets reported
| Playwright | In Probara |
| ---------------------------------------- | ------------------------------------------------------------------------- |
| A test, in every Playwright project | A test case, matched by its automation key or linked by a case id |
| Each attempt (retries included) | A result in the run, with its status, duration, start time and errors |
| test.step and the hooks that run steps | The steps of the result, nested, with their status, duration and error |
| Screenshots, videos, traces, attachments | Files of the result, or of the step they were attached in |
| probara.* calls in the test | The title, suite, tags, fields and steps of a new case; result parameters |
| The playwright test command | One automated run, named after the CI build, closed at the end |
The project of each result is sent as its project parameter, not as part of the key: the same test
in two projects is one case, with one result per project run. Playwright does not give the reporter the
values of a data-driven test, so declare them with probara.parameters(), for example
probara.parameters({ site: 'de' }), and keep the title the same for each set. Each set becomes a
result of the case, matched to the parameter set the case declares. The project is a context value: shown
on the result, it never creates a parameter of a new case.
Documentation
| Page | What it covers |
| -------------------------------------------------- | ----------------------------------------------------------------------------- |
| Configuration | Every option, its variable, type and default; precedence; getting a token |
| Linking tests to cases | Annotations, case ids in titles, probara.id(), automation keys |
| Metadata | Title, suite, comment, tags, fields, parameters, ignoring an attempt |
| Steps | test.step, hooks, nesting, probara.step() and the steps of a new case |
| Attachments | Screenshots, videos, traces, probara.attach(), test output, limits |
| Probara Snap | probaraSnap(): screenshots compared between commits, masking, shards |
| Statuses | How attempts become statuses; test.fail(), skips; status mapping and filter |
| Retries and flaky tests | Every attempt is a result |
| Run options | Name, description, environment, milestone, plan, configurations, tags, source |
| Sharding and CI | One run for every shard; merge-reports |
| Several projects | Results that go to other Probara projects, each into its own run |
| Results file | Keep what could not be sent, send it later |
| Migrating from Qase | Option by option and API by API, and what is different |
| Troubleshooting | Problems and their solutions |
| Debugging | PROBARA_DEBUG, the logs, checking what would be sent |
| Network | Timeouts, retries, rate limits, proxies and certificates |
| Upgrading | Versioning policy and the automation key contract |
| Changelog | What changed in each version |
CI guides: GitHub Actions, GitLab CI, CircleCI, Azure Pipelines, Jenkins, Bitbucket Pipelines and Buildkite.
On the Probara side, the Playwright integration guide covers the card, its app tokens and what Probara shows.
Reporting never breaks your test run
The reporter never throws into Playwright and never changes its exit code: a failed test fails the command, a reporting problem does not. Every problem (a wrong setting, Probara unreachable, a refused token) is logged on stderr, and the tests keep their outcome. There is no option to fail the command on a reporting error; to keep what could not be sent, set a results file.
The same holds for Probara Snap: when the screenshots cannot be sent, for instance once the plan's
monthly screenshots are used up, one line starting with Could not send the Snap screenshots: says
why (when the upload fails).
