62 lines
2.2 KiB
Markdown
62 lines
2.2 KiB
Markdown
# playwright-run
|
|
|
|
Run Playwright E2E tests for one shard and upload the blob report as an artifact.
|
|
|
|
## Inputs
|
|
|
|
| Input | Required | Default | Description |
|
|
|-------|----------|---------|-------------|
|
|
| `working-directory` | No | `.` | Directory containing `package.json` and `playwright.config.ts` |
|
|
| `node-version` | No | `24` | Node.js version |
|
|
| `pnpm-version` | No | `10.33` | pnpm version |
|
|
| `jfrog-token` | No | `""` | JFrog npm auth token |
|
|
| `shard-index` | No | `1` | Current shard index (1-based). Set to `1` when not sharding. |
|
|
| `shard-total` | No | `1` | Total number of shards. Set to `1` to disable sharding. |
|
|
| `no-deps` | No | `false` | Skip dependencies between Playwright projects (e.g. setup/teardown). Passes `--no-deps` to Playwright. |
|
|
| `projects` | No | `""` | Comma-separated list of Playwright projects to run (e.g. `chromium,firefox,Mobile Chrome`). Leave empty to use the Playwright default. |
|
|
| `artifact-retention-days` | No | `3` | Number of days to retain the blob report artifact |
|
|
|
|
## Usage
|
|
|
|
### Basic
|
|
|
|
```yaml
|
|
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/playwright-run@playwright-run-v1
|
|
with:
|
|
working-directory: e2e
|
|
node-version: 22
|
|
jfrog-token: ${{ secrets.JFROG_TOKEN }}
|
|
```
|
|
|
|
### Sharded
|
|
|
|
```yaml
|
|
jobs:
|
|
test:
|
|
name: "Test Shard ${{ matrix.shard-index }}/${{ matrix.total }}"
|
|
# Define the matrix strategy on the parent job:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
total: [5] # The same for all instances
|
|
shard-index: [1, 2, 3, 4, 5]
|
|
steps:
|
|
# ...other steps like checkout repo etc.
|
|
- name: Run tests
|
|
uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/playwright-run@playwright-run-v1
|
|
with:
|
|
working-directory: frontend
|
|
node-version: 22
|
|
jfrog-token: ${{ secrets.JFROG_TOKEN }}
|
|
# Matrix data is passed here:
|
|
shard-index: ${{ matrix.shard-index }}
|
|
shard-total: ${{ matrix.total }}
|
|
no-deps: "true"
|
|
projects: "chromium,firefox,webkit,Mobile Chrome,Mobile Safari"
|
|
```
|
|
|
|
## Notes
|
|
|
|
- Intended for matrix shard jobs.
|
|
- Uploads one artifact per shard named `blob-report-<shard-index>`.
|
|
- Use `playwright-merge` in a follow-up job to merge shard reports.
|