Stream test results and traces to Stably for analytics and AI-powered test maintenance
The Stably Reporter streams your Playwright test results, traces, and screenshots to Stably for debugging and AI-powered maintenance with stably fix.
The Stably Test Reporter is free to use — no paid plan required. It also includes built-in sensitive data scrubbing for traces — a feature not natively available in Playwright.
With the reporter enabled, you get a rich test results dashboard with detailed run history, failure analysis, and auto-heal reports that show exactly what changed and how Stably fixed your tests.
Using stably test? The reporter is automatically configured—no setup needed. Skip to Verify Setup.
1. Set environment variables in your .env file:
Copy
STABLY_API_KEY=your_api_key_here # Get from https://app.stably.ai/settings?tab=api-keySTABLY_PROJECT_ID=your_project_id_here # Find in your project URL on app.stably.ai
2. Add the reporter to playwright.config.ts:
Copy
import { defineConfig, stablyReporter } from "@stablyai/playwright-test";import dotenv from "dotenv";import path from "path";dotenv.config({ path: path.resolve(__dirname, ".env") });export default defineConfig({ reporter: [ ["list"], stablyReporter({ apiKey: process.env.STABLY_API_KEY, projectId: process.env.STABLY_PROJECT_ID, }), ], use: { trace: "on", // Required for debugging in Stably dashboard },});
Set trace: "on" instead of the default "on-first-retry" to capture traces for all runs.
The reporter enables AI-powered test maintenance. When tests fail, the reporter automatically prints a stably fix command with the run ID:
Copy
npx stably test # Run tests (results stream to Stably)# On failure, you'll see: 🔧 To auto-heal failed tests, run: stably fix <runId>stably fix # AI analyzes failures and generates fixes
stably fix auto-detects the run ID so you don’t need to copy-paste it. It checks in order: CI environment variables (GitHub Actions, Azure DevOps, Bitbucket, etc.), then the last local run saved by stably test. You can always pass an explicit run ID with stably fix <runId>. See Fix Tests (stably fix) — Run ID Detection for details.
Stably can redact sensitive strings (passwords, API keys, tokens) from Playwright traces before they are uploaded. There are two ways to enable scrubbing:
If you run tests with the --env flag, any variable marked Sensitive in your Stably Environment is automatically scrubbed from traces — no config changes needed.
Copy
stably --env Staging test
Variables marked as Sensitive on the Environments page are identified at runtime and redacted from trace data before upload. See Environments — Sensitive Variables for how to mark variables as sensitive.
If you are not using --env, or need to scrub additional values beyond what is stored in your environment, pass a sensitiveValues string array to the reporter. Each string will be redacted wherever it appears exactly in the trace.The sensitiveValues array accepts any strings — they do not have to come from process.env. Use whatever method matches your project’s configuration:
Copy
// Option 1: Reference environment variables (if available in process.env)stablyReporter({ apiKey: process.env.STABLY_API_KEY, projectId: process.env.STABLY_PROJECT_ID, sensitiveValues: [ process.env.TEST_USER_PASSWORD, process.env.API_SECRET, ],});// Option 2: Import from a config file or moduleimport { secrets } from "./test-config";stablyReporter({ apiKey: process.env.STABLY_API_KEY, projectId: process.env.STABLY_PROJECT_ID, sensitiveValues: [ secrets.testUserPassword, secrets.apiSecret, ],});// Option 3: Hardcoded strings (not recommended, but supported)stablyReporter({ apiKey: process.env.STABLY_API_KEY, projectId: process.env.STABLY_PROJECT_ID, sensitiveValues: [ "my-secret-password", ],});
Sensitive values are scrubbed from trace data, but screenshots and videos may still display secrets if they appear on screen during test execution. Avoid entering sensitive data in visible form fields when possible.Only exact string matches are scrubbed—partial matches within objects or arrays are not detected.To ensure the integrity of Playwright artifacts, the following patterns are never scrubbed—even when included in sensitiveValues:
The characters / and * (when alone)
Strings containing /artifact/, https://, http://, or *********
Pure numeric values (e.g., 123, 456789)
Values of internal keys: sha1, _sha1, pageref, downloadsPath, tracesDir, pageId, and any key ending in sha1