This demo repository showcases how to integrate the TestMonitor Playwright Reporter into your Playwright test suite. It contains example tests that demonstrate automated test reporting to TestMonitor.
This repository provides a working example of:
- Setting up Playwright with the TestMonitor reporter
- Configuring the reporter in
playwright.config.js - Sample test cases that report results to TestMonitor
- Automatic screenshot capture on test failures
Before you start, make sure you have Node.js installed (version 18 or higher recommended).
You'll also need Playwright installed. If you don't have it yet, you can install it with:
npx playwright installClone this repository and install the dependencies:
git clone https://github.com/testmonitor/playwright-demo.git
cd playwright-demo
npm installThe reporter is already configured in playwright.config.js. Update the configuration with your TestMonitor credentials:
reporter: [
[
"@testmonitor/playwright-reporter",
{
domain: "example.testmonitor.com", // Replace with your TestMonitor domain
token: "your-token-here", // Replace with your Playwright integration token
// Optional parameters
// milestoneId: 12, // Use this if you want to link to an existing milestone
// milestoneName: 'Release 2025.4', // Or use this to create or match a milestone by name
// testEnvironmentId: 3 // ID of the target test environment in TestMonitor
}
]
],To get started, you’ll need a token from your Playwright integration. You can find it on the Playwright integration page of your TestMonitor project settings.
Configuration options:
| Option | Required | Description |
|---|---|---|
domain |
Yes | Your TestMonitor instance domain (without https://) |
token |
Yes | Your TestMonitor API token |
milestoneId |
No | ID of an existing milestone to link test results to |
milestoneName |
No | Name of a milestone (will be created if it doesn't exist or matched if it does) |
testEnvironmentId |
No | ID of the target test environment in TestMonitor |
Run the demo tests using the Playwright CLI:
npx playwright testThe reporter will automatically:
- Create a test run in TestMonitor
- Submit test results (pass/fail status)
- Include screenshots for failed tests
- Report test execution times
After running the tests, check your TestMonitor instance to see the reported results.
Copyright (c) TestMonitor | we are Cerios B.V. All rights reserved.