Playwright test reporter for CircleCI
npm install playwright-circleci-reporterPlaywright test reporter for CircleCI that generates JUnit XML reports. Helps with test parallelization.
- Playwright 1.0.0 or newer
``shell`
$ npm install playwright-circleci-reporter @playwright/test --save-dev
`shell`
$ yarn add playwright-circleci-reporter @playwright/test --dev
After installing the reporter, you'll need to configure it in your playwright.config.ts:
`typescript
import { defineConfig } from '@playwright/test';
export default defineConfig({
reporter: [
['playwright-circleci-reporter', {
resultsDir: './test_results/playwright',
resultFileName: 'playwright-[hash]'
}]
],
// ... other config
});
`
`yaml
run_playwright_tests:
parallelism: 3 # or any other number that suits your needs
steps:
# some previous steps
- run:
name: Run playwright tests
command: yarn playwright test --shard=$(expr $CIRCLE_NODE_INDEX + 1)/$CIRCLE_NODE_TOTAL
- store_test_results:
path: test_results
- store_artifacts:
path: test_results
`
First test run with this config should create and store reports for each test file. These will be used during next runs to determine timings of each test. CircleCI will then split the test files between available containers to speed up the process.
Options can be passed to the reporter through the reporter configuration in playwright.config.ts.
Example:
`typescript`
reporter: [
['playwright-circleci-reporter', {
resultsDir: './results/playwright',
resultFileName: 'result-[hash]'
}]
]
| Parameter | Default | Effect |
| -------------- | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| project | undefined | If you use a custom project path, this should be set to the same value. |./test_results/playwright
| resultsDir | | Name of the directory that reports will be saved into. |playwright-[hash]
| resultFileName | | Name of the file that will be created for each test run. Must include [hash]` string as each spec file is processed completely separately during each test run. |