The Stably Reporter streams your Playwright test results, traces, and screenshots to Stably for debugging and AI-powered maintenance with stably fix.
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.
Installation
npm install -D @stablyai/playwright-test@latest
Requires Playwright 1.52.0+
Configuration
Using stably test? The reporter is automatically configured—no setup needed. Skip to Verify Setup.
1. Set environment variables in your .env file:
STABLY_API_KEY=your_api_key_here # Get from https://app.stably.ai/settings?tab=api-key
STABLY_PROJECT_ID=your_project_id_here # Find in your project URL on app.stably.ai
2. Add the reporter to playwright.config.ts:
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.
Verify Setup
Run a test to confirm the reporter is working:
You should see a dashboard URL printed after tests complete. View results at app.stably.ai.
Using with stably fix
The reporter enables AI-powered test maintenance. When tests fail, the reporter automatically prints a stably fix command with the run ID:
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 Auto-fixing Tests — Run ID Detection for details.
Sensitive Data Scrubbing
Stably can redact sensitive strings (passwords, API keys, tokens) from Playwright traces before they are uploaded. There are two ways to enable scrubbing:
Automatic scrubbing with --env
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.
stably test --env Staging
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.
Manual scrubbing with sensitiveValues
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:
// 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 module
import { 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
Troubleshooting
| Issue | Solution |
|---|
| Missing traces | Set trace: "on" in config, or use stably test |
| Auth errors | Verify STABLY_API_KEY and STABLY_PROJECT_ID |
See full troubleshooting guide for more details.
Next Steps