replay-playwright
npx skills add https://github.com/replayio/skills --skill replay-playwright
Agent 安装分布
Skill 文档
replay-playwright
Description: Use when the user wants to set up Replay for Playwright tests, configure the Replay Playwright plugin, or run Playwright tests with the Replay Browser. Examples: “set up replay for my playwright tests”, “record my playwright tests”, “configure replay playwright plugin”, “run tests with replay browser”.
Instructions:
You are helping the user set up and run Playwright tests with the Replay Browser. Here is the complete reference:
Installation
1. Install the Replay Playwright plugin
npm install --save-dev @replayio/playwright
# or
yarn add --dev @replayio/playwright
# or
pnpm add --save-dev @replayio/playwright
# or
bun add --dev @replayio/playwright
2. Install the Replay Browser
npx replayio install
Authentication
Create a Test Suite Team at https://app.replay.io/team/new/tests to generate an API key.
Store the API key using one of these methods:
.envfile (recommended): AddREPLAY_API_KEY=<your_api_key>to your.envfile and use the dotenv package to load it.- macOS/Linux:
export REPLAY_API_KEY=<your_api_key> - Windows:
set REPLAY_API_KEY=<your_api_key>
Configuration
Update playwright.config.ts to use the Replay reporter and Replay Chromium browser:
import { replayReporter, devices as replayDevices } from "@replayio/playwright";
const config: PlaywrightTestConfig = {
reporter: [
replayReporter({
apiKey: process.env.REPLAY_API_KEY,
upload: true,
}),
["line"],
],
projects: [
{
name: "replay-chromium",
use: { ...replayDevices["Replay Chromium"] },
},
],
};
Key configuration details:
replayReporterhandles uploading recordings after test runsupload: trueautomatically uploads recordings when tests finish- The
replay-chromiumproject uses the Replay Browser to capture recordings - You can keep existing projects alongside
replay-chromiumfor regular test runs
Running Tests
Run Playwright tests with the Replay Browser:
npx playwright test --project replay-chromium
Recordings are automatically uploaded when upload: true is set in the reporter config.
Core Workflow
Set up Replay for an existing Playwright project:
- Install the plugin:
npm install --save-dev @replayio/playwright - Install the browser:
npx replayio install - Update
playwright.config.tswith the Replay reporter and project - Set the
REPLAY_API_KEYenvironment variable - Run tests:
npx playwright test --project replay-chromium
When modifying the user’s playwright.config.ts:
- Preserve existing projects and reporters â add the Replay project and reporter alongside them
- Import
replayReporteranddevices as replayDevicesfrom@replayio/playwright - If the config uses
defineConfig, add the Replay project to the existingprojectsarray - If the config already has reporters, append
replayReporterto the existing array
Debugging your recorded application
Run Replay MCP Server to debug your recored application to install the MCP server in Claude, run the following command:
claude --mcp-config "{
"mcpServers": {
"replay": {
"type": "http",
"url": "https://dispatch.replay.io/nut/mcp",
"headers": {
"Authorization": "${REPLAY_API_KEY}"
}
}
}
}"