GitHub

Config Generator

Generate, preview, and export ready-to-use reporter configuration for playwright.config and zen.config.json directly from your dashboard.

Zen Reports for Playwright includes an interactive Playwright Configuration Generator embedded directly within the dashboard. It allows engineering teams to customize reporter settings visually and immediately generate production-ready configurations for either playwright.config.ts (or .js) or a standalone zen.config.json file.

You can launch the generator from any view in the dashboard using either of the following methods:

  • Press the C key shortcut anywhere outside of an active text input field.
  • Click the Config Generator action located at the bottom of the dashboard sidebar.

Tip: Press the ? key at any time to open the complete keyboard shortcuts reference modal.


How It Works

The generator provides an intuitive visual workflow designed to eliminate manual syntax lookup and prevent configuration errors:

  • Live Option Preview: Every reporter setting—including visual themes, dark mode preferences, console progress indicators, history storage models, standalone executive summaries (singleSummaryFile), and environmental notices (systemNotices)—is represented by an interactive control. Each field maps directly to the official reporter option names.
  • Format and Language Switching: You can instantly toggle between TypeScript, JavaScript, and JSON (zen.config.json) formats. The preview updates in real time to reflect the appropriate syntax structure for your selected target.
  • Copy-Ready Snippets: Generated code blocks provide complete, valid configurations with clean formatting. You can copy the code with a single click and paste it directly into your project without manual editing.

Configuration Targets

The generator supports two primary methods for applying configuration settings to your test suite.

1. Inline Configuration (playwright.config.ts)

For standard projects, you can embed your reporter configuration directly in playwright.config.ts using Playwright’s reporter tuple syntax:

import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
[
'@zen-reports/zen-reporter-playwright',
{
theme: 'Bamboo',
darkMode: 'dark',
singleSummaryFile: true,
consoleProgress: 'dot',
},
],
],
});

This format is ideal when your configuration is compact or when you need to evaluate dynamic runtime values such as process.env.

2. Standalone Configuration File (zen.config.json)

When managing larger option sets or enterprise configurations, maintaining settings in a separate file keeps your root playwright.config.ts concise and maintainable. You can switch the generator to JSON format to generate a dedicated zen.config.json file:

{
"outputDir": "zen-report",
"projectName": "Web App E2E",
"testRunName": "CI Build #{N}",
"theme": "Bamboo",
"darkMode": "dark",
"singleSummaryFile": true,
"consoleProgress": "dot",
"history": {
"mode": "remote",
"serverUrl": "https://zen-reporter.internal",
"projectId": "frontend-e2e"
}
}

Place zen.config.json in the same directory alongside your playwright.config.ts. The reporter automatically detects the file upon initialization and merges its properties into the active configuration.


Precedence and Resolution Rules

When combining inline reporter options with an external configuration file, Zen Reports for Playwright evaluates properties according to a strict hierarchy:

  1. Inline options take highest precedence: Any option specified directly inside the playwright.config.ts reporter tuple overrides the corresponding value defined in zen.config.json.
  2. File options populate omitted fields: Any property defined in zen.config.json that is not explicitly set in the inline reporter tuple is applied as the active configuration.
  3. Built-in defaults apply last: Any setting omitted from both inline configuration and zen.config.json falls back to its built-in default value.
  4. Strict validation: The reporter verifies all property names during initialization. If a key is invalid or misspelled, the reporter flags the issue and suggests the closest matching setting.

Important: Because zen.config.json contains static JSON, it cannot evaluate expressions such as process.env. For dynamic environment variable resolution, keep those specific keys inline within playwright.config.ts or import a zen.config.ts module as described in the Recipes & Presets guide.