Skip to main content

Configuration

Multiple reporters

Sometimes you just want to have a quick local feedback loop when writing tests, then the built-in HTML reporter could be useful. We recommend using the env process.env.CI to determine whether Playwright should report the results to us or not. process.env.CI is a common env variable injected by most CI providers.

playwright.config.js
const config = {
// ...
reporter: process.env.CI
? "playwright-dashboard"
: [["html"], ["playwright-dashboard"]]
//...
};

Inject secret in runtime

Another way to provide the Playwright Dashboard reporter with the Project secret is by injecting the environment variable during runtime, with a JavaScript library called dotenv. If you call it from the top of your application, it will inject the environment variables provided in your .env file. For more details, check out their documentation

.env
PLAYWRIGHT_DASHBOARD_KEY=<YOUR_PROJECT_SECRET>
playwright.config.js
require("dotenv").config();

const config = {
...
reporter: process.env "playwright-dashboard"
...
};

If you've supplied the correct secret, you should see the first test in the dashboard.

© 2022 Playwrightdashboard.com - All rights reserved.