Playwright Setup
DeploySentinel's Playwright Reporter enables viewing/debugging Playwright runs from remote environments (ex. CI) with debug information you're used to having locally.
With the reporter installed, test results and debug traces gets sent directly to your DeploySentinel account, so there's no need to download and stitch together artifacts manually when working with test failures.
Installation
Install the Playwright reporter into your Playwright project.
npm install -D @deploysentinel/playwright
Usage
Add Reporter
In your playwright config file (ex. playwright.config.ts
) add:
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
reporter: '@deploysentinel/playwright',
use: {
/* Make sure this is not 'off' so debugger can upload trace info */
trace: 'on',
},
};
export default config;
Advanced Reporter Config Example
If you're looking to use multiple reporters, or only want to run the DeploySentinel reporter in CI, you can configure that via:
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
reporter: [
['html'],
...(process.env.CI ? [['@deploysentinel/playwright']] : []),
// For Typescript users, you'll need to define the type explicitly
// ...(process.env.CI ? ([["@deploysentinel/playwright"]] as [[string]]) : []),
],
//...
};
export default config;
Add API Key
Lastly, export your API key to the OS environment variable
DEPLOYSENTINEL_API_KEY
. You can grab your API key by
logging into (opens in a new tab)/signing up for (opens in a new tab)
DeploySentinel and visiting your team page:
https://deploysentinel.com/team (opens in a new tab).
Running Playwright with an API Key
DEPLOYSENTINEL_API_KEY=xxx npx playwright test