GitHub

Storage & History

Configure embedded SQLite, remote Zen Server streaming, and cross-run test history retention in Zen Reports.

Zen Reports for Playwright features a dual history architecture: embedded local SQLite for zero-setup workflows and remote PostgreSQL ingestion via @zen-reports/zen-server for distributed engineering teams.


Local SQLite Engine (Default)

By default, Zen Reports for Playwright records cross-run execution metrics and media references into an embedded SQLite database (history.db) inside your outputDir using Node’s built-in node:sqlite engine. It requires zero external database daemons or network calls.

Simple Switch (enableHistory)

The enableHistory property provides a straightforward switch:

export default defineConfig({
reporter: [
[
'@zen-reports/zen-reporter-playwright',
{
enableHistory: 'auto', // Records to <outputDir>/history.db
},
],
],
});
  • "auto" (Default): Records to local SQLite. Write failures are logged as warnings and never fail the test run.
  • true: Records to local SQLite and requires the optional @duckdb/node-api package (used by the zr history CLI query engine); throws an early error at startup if not installed.
  • false: Completely disables history tracking.

Advanced Local History (history)

When you need granular control over retention, database filename, or report window size, use the history object with mode: 'local':

export default defineConfig({
reporter: [
[
'@zen-reports/zen-reporter-playwright',
{
history: {
mode: 'local', // optional; local is default
dbFilename: 'history.db', // SQLite database filename inside outputDir
maxRuns: 1000, // max historical runs kept in database (0 = unlimited)
windowSize: 50, // max historical runs embedded into the static HTML bundle
},
},
],
],
});

Remote Team Hosting Mode (zen-server)

For distributed teams or enterprise multi-shard pipelines, Zen Reports for Playwright can stream run telemetry directly to a centralized @zen-reports/zen-server backed by PostgreSQL and Cloud Object Storage (S3, Cloudflare R2, Google Cloud Storage, or Azure Blob).

export default defineConfig({
reporter: [
[
'@zen-reports/zen-reporter-playwright',
{
history: {
mode: 'remote',
serverUrl: process.env.ZEN_SERVER_URL || 'https://zen-reporter.internal',
apiKey: process.env.ZEN_REPORTER_API_KEY, // optional; tenant auth
projectId: 'frontend-e2e', // explicit project/repo identifier
runId: process.env.GITHUB_RUN_ID, // idempotency key
fallbackToLocal: true, // fallback to local SQLite if server is unreachable
timeoutMs: 5000, // per-request ingestion timeout
},
},
],
],
});

Full architecture, deployment guides, and licensing notes live in the Zen Server Deployment Guide.

runId Resolution & Idempotency

The server de-duplicates test runs by runId to prevent duplicate history entries when retrying CI jobs. When omitted, the following resolution chain is evaluated:

  1. runId from the config
  2. process.env.ZEN_REPORTER_RUN_ID (portable across Jenkins, GitLab, Bitbucket, CircleCI)
  3. process.env.GITHUB_RUN_ID (set automatically in GitHub Actions)
  4. A deterministic fallback derived from run timestamp, suite name, and shard index

Disabling History

To disable history entirely:

export default defineConfig({
reporter: [
[
'@zen-reports/zen-reporter-playwright',
{
history: { mode: 'off' },
},
],
],
});
Dashboard banner shown when history recording is disabled
When history is turned off, the History tab displays an informative guidance banner.
Enable History in the Zen Reports config to track and see newer runs
Notice surfaced when viewing historical snapshots without an active store.

Precedence Rules

  • history takes precedence over enableHistory when both are defined.
  • minimalReport: true forces history tracking off regardless of other settings.