Getting started
Playwright Dashboard consists of two parts, the reporter and the dashboard itself. Playwright has a modular reporter setup, which means that we can plug it right into your existing test set up, without any major changes to how you operate. In this guide, we will go through how to install the reporter and view your first test in the dashboard.
info
This guide does not cover the set up of Playwright tests themselves. Please refer to the official playwright documentation for that.
Install
- npm
- yarn
- pnpm
npm i playwright-dashboard
yarn add playwright-dashboard
pnpm i playwright-dashboard
As Playwright Dashboard needs to authenticate all the tests results, and know where to send the results to, we will need some identification. We use a Project secret for that. Your project secret can be found in the project settings in your Playwright Dashboard.
The secret needs to be provided as an environment variable. The two most common ways to do that is to either call it directly with an env variable, or inject it in runtime as an environment variable.
You can simply run it as a command in your terminal but prefixing the command with an environment variable.
PLAYWRIGHT_DASHBOARD_KEY=<YOUR_PROJECT_SECRET> npx playwright test --reporter playwright-dashboard
This method is good to use when you want to get up and running quickly. Keep in mind that the secret will most likely be stored in your bash history and will be visible to anyone who has access to your bash history.