Playwright reporter for PlayTest test management
npm install playwright-playtest-reporterPlaywright reporter for PlayTest test management system.
``bash`
npm install --save-dev playwright-playtest-reporteror
pnpm add -D playwright-playtest-reporter
Add the reporter to your playwright.config.ts:
`typescript
import { defineConfig } from "@playwright/test";
export default defineConfig({
reporter: [
[
"playwright-playtest-reporter",
{
projectId: "your-project-uuid",
apiToken: "your-api-token",
baseUrl: "https://playtest-app.fly.dev/api", // optional
finishRunOnEnd: true,
},
],
],
});
`
| Option | Type | Required | Description |
| ---------------- | --------- | -------- | ------------------------------------------------------------------- |
| projectId | string | ✅ | UUID of your PlayTest project |apiToken
| | string | ✅ | API token for authentication (Bearer token) |baseUrl
| | string | ❌ | PlayTest API base URL (default: https://playtest-app.fly.dev/api) |finishRunOnEnd
| | boolean | ❌ | Complete test run after all tests finish |
Link Playwright tests to PlayTest test cases using the playtest() helper function with numeric external IDs:
`typescript
import { test } from "@playwright/test";
import { playtest } from "playwright-playtest-reporter";
// Single ID (number):
test(playtest(1, "User can login"), async ({ page }) => {
await page.goto("https://example.com/login");
await page.fill("#username", "testuser");
await page.fill("#password", "password123");
await page.click('button[type="submit"]');
await expect(page).toHaveURL("/dashboard");
});
// Single ID (string):
test(playtest("2", "User can logout"), async ({ page }) => {
await page.goto("/logout");
});
// Multiple IDs (first one will be used):
test(playtest([3, 4, 5], "Multi-scenario test"), async ({ page }) => {
// Test that covers multiple test cases
});
// No ID - auto-create test case:
test("User can add to cart", async ({ page }) => {
await page.goto("/cart");
// PlayTest will auto-create test case with next available ID
});
`
The playtest() function accepts:
- Single ID: playtest(1, "title") or playtest("1", "title")playtest([1, 2, 3], "title")
- Multiple IDs: or playtest(["1", "2", "3"], "title")
- No ID: Test will run and PlayTest will auto-create test case from test title
Note: When using multiple IDs, only the first one is reported to PlayTest.
Configure the reporter using environment variables:
`bash`
export PLAYTEST_API_TOKEN=your-api-token
export PLAYTEST_PROJECT_ID=your-project-uuid
export PLAYTEST_RUN_NAME="Regression Tests - Production"
export PLAYTEST_TEST_RUN_UUID=existing-run-uuid # Optional: use existing run
| Playwright | PlayTest |
| ------------- | --------- |
| passed | PASSED |failed
| | FAILED |timedOut
| | FAILED |skipped
| | SKIPPED |interrupted
| | BLOCKED |
`bashRun all tests
npx playwright test
CI/CD Integration
$3
`yaml
name: Playwright Testson: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Install Playwright
run: npx playwright install --with-deps
- name: Run tests
env:
PLAYTEST_API_TOKEN: ${{ secrets.PLAYTEST_API_TOKEN }}
PLAYTEST_PROJECT_ID: ${{ secrets.PLAYTEST_PROJECT_ID }}
PLAYTEST_RUN_NAME: "CI Run - ${{ github.ref }}"
run: npx playwright test
``✅ Create test runs automatically
✅ Send test results in real-time
✅ Support for test retries
✅ Environment variable configuration
✅ Simple numeric IDs (1, 2, 3...)
✅ Multiple IDs per test support
✅ Auto-create test cases (no manual setup needed!)
❌ Attachment upload (not supported by PlayTest API yet)
- Numeric IDs: Easy to remember and reference (Test #1, Test #23)
- Auto-create: No manual test case setup - just run tests!
- Simple setup: Zero configuration needed
- Modern stack: Built for scale
MIT