Playwright Reporter
The @spekra/playwright reporter integrates seamlessly with Playwright Test to capture test results, timing data, and metadata. It's designed to be lightweight and non-blocking.
Installation
npm install @spekra/playwrightBasic Configuration
Add the reporter to your playwright.config.ts:
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
['html'],
['@spekra/playwright', {
apiKey: process.env.SPEKRA_API_KEY,
}],
],
});
How It Works
The reporter hooks into Playwright's test lifecycle:
- On test begin - Records start time and test metadata
- On test end - Captures result, duration, and any errors
- On run end - Batches and sends results to Spekra
Non-Blocking Design
The reporter is designed to never slow down or break your tests:
- Results are batched and sent asynchronously
- Network failures are silently logged (won't fail your build)
- Timeouts are aggressive to prevent hanging
If the Spekra API is unavailable, your tests will still run normally. Results will be lost for that run, but the reporter won't block.
Data Captured
The reporter automatically captures:
| Field | Source | Example |
|---|---|---|
testFile | Test location | tests/auth.spec.ts |
fullTitle | Suite + test name | Login > should authenticate |
suitePath | Describe hierarchy | ['Login', 'With valid credentials'] |
testName | It/test title | should authenticate |
tags | Annotations + inline | ['@smoke', '@P0'] |
project | Playwright project | chromium |
status | Test outcome | passed, failed, skipped, flaky |
durationMs | Execution time | 1234 |
retry | Retry attempt | 0, 1, 2 |
error | Failure message | Expected 200, got 404 |
Git Information
When running in a git repository:
- Branch name
- Commit SHA
- Commit author
- Commit message
CI Information
When running in CI:
- CI provider (GitHub, GitLab, etc.)
- Job URL
- Workflow/pipeline name
- Build number
Tag Detection
Tags are extracted from multiple sources:
Inline Tags
test('should work @smoke @P0', async () => {
// Tags: ['@smoke', '@P0']
});
Annotations
test('should work', {
tag: ['@smoke', '@P0'],
}, async () => {
// Tags: ['@smoke', '@P0']
});
Test.describe Tags
test.describe('Feature @regression', () => {
test('works', async () => {
// Tags: ['@regression']
});
});