playwright-rocketium-reporter
v2.1.2
Published
Playwright reporter that streams test results to a Rocketium backend (Currents-compatible data model)
Maintainers
Readme
playwright-rocketium-reporter
Playwright reporter that streams E2E results to your backend — a self-hosted alternative to @currents/playwright.
Features (v1.0.0)
- Run / shard / spec / test hierarchy matching Currents UI
- Git + GitHub Actions metadata
- Failure artifact upload (screenshots, videos, error-context.md)
- Multi-shard grouping via
ciBuildId+shardNumber - Per-attempt
retryIndexon each test result (retries reported separately; shard summary uses the final attempt only) - Same reporter tuple pattern as Currents
Install
pnpm add playwright-rocketium-reporter
# or link locally while developing:
pnpm add file:../playwright-rocketium-reporterPlaywright config
import { defineConfig } from "@playwright/test";
import { rocketiumReporter } from "playwright-rocketium-reporter";
export default defineConfig({
reporter:
process.env.CI && !process.env.DISABLE_REPORTER
? [rocketiumReporter(), ["html", { open: "never" }], ["list"]]
: [["html", { open: "never" }], ["list"]],
});Environment variables
Set either REPORTER_API_URL (stream to backend) or REPORTER_OUTPUT_DIR (write JSON payloads to disk). REPORTER_PROJECT_ID is always required.
| Variable | Required | Description |
|----------|----------|-------------|
| REPORTER_API_URL | one of API URL / output dir | Backend base URL. Alias: ROCKETIUM_REPORTER_API_URL |
| REPORTER_OUTPUT_DIR | one of API URL / output dir | Local directory for file-sink mode (no HTTP). Writes run data under {outputDir}/{ciBuildId}/. Alias: ROCKETIUM_REPORTER_OUTPUT_DIR |
| REPORTER_PROJECT_ID | yes | Project identifier. Alias: ROCKETIUM_REPORTER_PROJECT_ID |
| REPORTER_API_KEY | no | Bearer token. Alias: ROCKETIUM_REPORTER_API_KEY |
| REPORTER_CI_BUILD_ID | no | Build/run id. Defaults to GITHUB_RUN_ID, then local-{uuid} |
| REPORTER_SHARD_NUMBER | no | Matrix shard (default 1). Fallback: SHARD_NUMBER |
| REPORTER_EXPECTED_SHARD_COUNT | no | e.g. 29. Fallback: EXPECTED_SHARD_COUNT |
| REPORTER_MACHINE_ID | no | Machine identifier. Fallback: HOSTNAME, then random UUID |
| REPORTER_TAGS | no | Comma-separated tags (e.g. staging,smoke) |
| REPORTER_UPLOAD_ARTIFACTS | no | Set false to skip |
| REPORTER_DEBUG | no | Set true for verbose API client console logs |
| REPORTER_SPEC_VIDEO_MANIFEST_DIR | no | Directory with per-spec video manifest JSON files (default test-results/spec-video-manifest) |
File-sink mode (REPORTER_OUTPUT_DIR)
When outputDir is set (via env or reporter options), the reporter uses FileSinkClient instead of the HTTP API. Each run is written to:
{REPORTER_OUTPUT_DIR}/{ciBuildId}/
run-start.json
shard-finish.json
tests/
001-{testId}-r0.json
001-{testId}-r1.json # one file per retry attempt
artifacts/
{testId}-r0-{filename}Useful for local debugging or offline ingestion without a running backend.
Spec-level video mapping (shared browser context)
Some suites use one shared browser.newContext({ recordVideo }) per spec file (serial describe blocks). Playwright writes the video when context.close() runs in afterAll, which happens after onTestEnd — so videos are not in result.attachments during the test hook.
Flow:
- Spec
afterAll— close context and write a manifest JSON:test-results/spec-video-manifest/LayerPanel.spec.ts.json{ "specPath": "e2e/editor-tests-V2/LayersPanel/LayerPanel.spec.ts", "videoPath": "test-results/videos/[email protected]", "contentType": "video/webm", "registeredAt": "2026-06-09T19:36:17.805Z" } onTestEnd— reporter records failed tests (testId,specPath,retryIndex) in memory.onEnd— reporter readsspec-video-manifest/, matches manifestspecPathto each failed test, and uploads the video artifact.
Videos are mapped per spec file (one video covers the whole serial suite), not per individual test.
In your test repo, use the helper from e2e/common/specVideoManifest.ts:
import { closeContextAndRegisterSpecVideo } from "../../common/specVideoManifest";
const SPEC_FILE = "e2e/editor-tests-V2/LayersPanel/LayerPanel.spec.ts";
test.afterAll(async () => {
if (context && sharedPage) {
await closeContextAndRegisterSpecVideo(context, sharedPage, SPEC_FILE);
}
});Override the manifest directory with REPORTER_SPEC_VIDEO_MANIFEST_DIR if your specs write elsewhere.
Retries (retryIndex)
Each Playwright retry emits a separate onTestEnd event. The reporter sends retryIndex (0-based, from result.retry) on every /api/v1/runs/tests payload so the backend/UI can mark flaky tests. Intermediate failed attempts are still reported (with artifacts when enabled), but the shard summary counts only the final attempt per test.
// via env
process.env.REPORTER_OUTPUT_DIR = "./reporter-output";
process.env.REPORTER_PROJECT_ID = "rocketium-staging";
// or via reporter options
reporter: [rocketiumReporter({ outputDir: "./reporter-output", projectId: "rocketium-staging" })],GitHub Actions (staging shard)
Add to your test job:
env:
REPORTER_API_URL: ${{ secrets.REPORTER_API_URL }}
REPORTER_PROJECT_ID: rocketium-staging
REPORTER_API_KEY: ${{ secrets.REPORTER_API_KEY }}
REPORTER_CI_BUILD_ID: ${{ github.run_id }}
REPORTER_SHARD_NUMBER: ${{ matrix.shard }}
REPORTER_EXPECTED_SHARD_COUNT: 29Backend API
See docs/api-contract.md for endpoint payloads.
Development
pnpm install
pnpm build
pnpm type-checkLicense
ISC
