npm install testreel playwrightTestreel uses Playwright to drive a real Chromium browser. After installing, make sure Chromium is available:
npx playwright install chromiumCreate a file called recording.json:
{
"url": "https://demo.playwright.dev/todomvc",
"viewport": { "width": 1280, "height": 720 },
"steps": [
{ "action": "wait", "ms": 1000 },
{ "action": "type", "selector": ".new-todo", "text": "Buy groceries" },
{ "action": "keyboard", "key": "Enter" },
{ "action": "type", "selector": ".new-todo", "text": "Walk the dog" },
{ "action": "keyboard", "key": "Enter" },
{ "action": "screenshot", "name": "todos-added" },
{ "action": "click", "selector": ".todo-list li:first-child .toggle" },
{ "action": "screenshot", "name": "first-completed" }
]
}Run it:
npx testreel recording.jsonTestreel will launch a headless browser, navigate to the URL, execute each step, and write the output to ./testreel-output/.
After a recording completes, the output directory contains:
| File | Description |
|---|---|
recording-<timestamp>.webm |
The screen recording video |
homepage.png, scrolled.png |
Screenshots from screenshot steps |
final-<timestamp>.png |
Automatic screenshot of the last frame |
output.json |
Manifest with paths to all output files |
To watch the recording happen in a visible browser window:
npx testreel recording.json --headedCheck that your definition is valid without launching a browser:
npx testreel recording.json --dry-run
# or
npx testreel validate recording.jsonIf you already have a Playwright test suite, you can add video recording with minimal changes — just compose testreel's fixtures and swap test for recorded:
import { test } from '@playwright/test'
import { testreelFixtures, type TestreelFixtures } from 'testreel/playwright'
const recorded = test.extend<TestreelFixtures>({
...testreelFixtures,
})
recorded('onboarding flow', async ({ page }) => {
await page.goto('https://myapp.com')
await page.click('.get-started')
await page.fill('#name', 'Jane Smith')
// Video is saved and attached to the test report automatically
})See the Playwright Integration guide for full details.
import { record, loadDefinition } from 'testreel'
const def = loadDefinition('recording.json')
const result = await record(def, { outputDir: './output' })
console.log(result.video) // path to .webm file
console.log(result.screenshots) // array of .png pathsFor manual control over an existing Playwright page, use recordPage():
import { recordPage } from 'testreel'
// page must belong to a context created with recordVideo
const recorder = await recordPage(page, { chrome: true })
await recorder.click('.button')
const result = await recorder.stop()
console.log(result.video)- Recording Definitions — full reference for the JSON format
- Actions — all 13 step actions with examples
- Authentication — recording authenticated apps
- CLI Reference — all commands and flags
- Playwright Integration — test fixture and
recordPage()API - Examples — common recording patterns