@qarth-pw/reporter
v0.4.1
Published
Playwright reporter that streams runs and results to a Qarth instance
Maintainers
Readme
@qarth-pw/reporter
Playwright reporter that streams runs and results to a Qarth instance.
Capabilities:
- Live ingestion of runs, results, and steps as the suite executes.
- Attachment upload (trace, video, screenshots, logs) via S3 presigned URLs.
- Auto-detection of branch / commit / CI metadata from GitHub Actions, GitLab CI, CircleCI, Buildkite, or local
git. - Best-effort: a Qarth outage never fails your test suite.
Install
pnpm add -D @qarth-pw/reporter
# or: npm install -D @qarth-pw/reporterPublished on npmjs.com — no registry config or auth token required.
Configure
// playwright.config.ts
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
['list'],
['@qarth-pw/reporter', {
apiUrl: process.env.QARTH_API_URL,
apiToken: process.env.QARTH_TOKEN,
uploadAttachments: 'on-failure', // 'always' | 'on-failure' | 'never'
}],
],
});Minimal env in CI:
QARTH_API_URL=https://qarth.example.internal
QARTH_TOKEN=qrt_... # bearer token scoped to a Qarth ProjectAnnotations the reporter understands
test('checkout flow', async ({ page }) => {
test.info().annotations.push(
{ type: 'testcase', description: 'TC-123' }, // links to a Qarth TestCase (auto-discovers if unknown)
{ type: 'owner', description: '@benoit' }, // sets AutomatedTest.ownerHint
{ type: 'severity', description: 'critical' }, // sets AutomatedTest.severity
);
// …
});@xxx tokens in the test title are also picked up as tags.
testcase auto-discovery (since 0.2.0)
The reporter forwards every { type: 'testcase', description } annotation
verbatim to the Qarth API on PATCH /results/:id. The API then upserts a
TestCase row (project-scoped) and a TestCaseLink to the running test:
- Format: the description must match
^TC-\d+$(e.g.TC-103). Other descriptions are dropped server-side with awarnlog; the run is not failed. - First sight: the API creates the
TestCasewithunconfirmed: trueand a derived title (titlePath.join(' › ')). The dashboard shows a pill on it until a human edits the case. - Subsequent runs: the upsert is idempotent — if the case already
exists, no column is touched. Once a human has cleared
unconfirmed: trueby editing the case, the reporter cannot bring the flag back. - Multiple annotations: a test can carry several
testcaseannotations (e.g. coversTC-7andTC-9). Each upserts independently.
The @TC:<description> tag fanout is preserved on AutomatedTest.tags for
back-compat with existing dashboards / queries.
Options reference
| Option | Default | Description |
| --- | --- | --- |
| apiUrl | QARTH_API_URL env | Base URL of the Qarth API. Required. |
| apiToken | QARTH_TOKEN env | Bearer token scoped to a Project. Required. |
| branch | auto | Branch name. |
| commitSha | auto | Commit SHA. |
| ciProvider | auto | github-actions, gitlab-ci, circleci, buildkite. |
| ciRunUrl | auto | URL of the CI run. |
| triggeredBy | auto | Username / actor. |
| uploadAttachments | 'on-failure' | Upload mode: always, on-failure, never. |
| attachmentSizeLimit | 0 (no limit) | Skip attachments larger than this many bytes. |
| metadata | null | Free-form JSON persisted on the Run. |
| enabled | true | Master switch. Set to false to no-op without removing the reporter. |
| requestTimeoutMs | 15000 | Per-request timeout. |
| maxRetries | 3 | Retries for transient (5xx / network) failures. |
Failure semantics
The reporter never throws out of a Playwright lifecycle hook:
- If
apiUrl/apiTokenare missing →QarthReporterConfigErroris logged once, the reporter no-ops. - If the API is unreachable → exponential backoff, then logged warn, the run continues.
- If S3 upload fails → logged warn, the corresponding
Attachmentrow stays inpendingstate.
Look for [qarth] … lines in your test output for any issues.
