playwright-mcp-dev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMCP
MCP
Adding MCP Tools
添加MCP工具
- Create a new tool in
packages/playwright/src/mcp/browser/tools/your-tool.ts - Register the tool in
packages/playwright/src/mcp/browser/tools.ts - Add ToolCapability in
packages/playwright/src/mcp/config.d.ts - Place new tests in
tests/mcp/mcp-<category>.spec.ts
- 在中创建一个新工具
packages/playwright/src/mcp/browser/tools/your-tool.ts - 在中注册该工具
packages/playwright/src/mcp/browser/tools.ts - 在中添加ToolCapability
packages/playwright/src/mcp/config.d.ts - 将新测试用例放在中
tests/mcp/mcp-<category>.spec.ts
Building
构建
- Assume watch is running at all times, run lint to see type errors
- 假设watch始终处于运行状态,运行lint检查类型错误
Testing
测试
- Run tests as
npm run ctest-mcp <category> - Do not run test --debug
- 执行运行测试
npm run ctest-mcp <category> - 请勿使用test --debug运行测试
CLI
CLI
Adding commands
添加命令
- CLI commands are based on MCP tools. Implement the corresponding MCP tool as per section above, if needed.
Adding MCP Tools - Add new CLI category for tool if needed:
- Add Category in
packages/playwright/src/mcp/terminal/command.ts - Update doc generator
packages/playwright/src/mcp/terminal/helpGenerator.ts
- Add Category in
- Register command in
packages/playwright/src/mcp/terminal/commands.ts - Update skill file at and references if necessary in
packages/playwright/src/skill/SKILL.mdpackages/playwright/src/skill/references/ - Place new tests in
tests/mcp/cli-<category>.spec.ts
- CLI命令基于MCP工具。如有需要,请按照上述“添加MCP工具”部分实现对应的MCP工具。
- 如有需要,为工具添加新的CLI分类:
- 在中添加分类
packages/playwright/src/mcp/terminal/command.ts - 更新文档生成器
packages/playwright/src/mcp/terminal/helpGenerator.ts
- 在
- 在中注册命令
packages/playwright/src/mcp/terminal/commands.ts - 必要时更新中的技能文件及其在
packages/playwright/src/skill/SKILL.md中的引用packages/playwright/src/skill/references/ - 将新测试用例放在中
tests/mcp/cli-<category>.spec.ts
Building
构建
- Assume watch is running at all times, run lint to see type errors
- 假设watch始终处于运行状态,运行lint检查类型错误
Testing
测试
- Run tests as
npm run ctest-mcp cli-<category> - Do not run test --debug
- 执行运行测试
npm run ctest-mcp cli-<category> - 请勿使用test --debug运行测试
Lint
Lint
- run to lint everything before commit
npm run flint
- 提交前执行对所有内容进行lint检查
npm run flint
SKILL File
SKILL文件
The skill file is located at . It contains documentation for all available CLI commands and MCP tools. Update it whenever you add new commands or tools.
At any point in time you can run "npm run playwright-cli -- --help" to see the latest available commands and use them to update the skill file.
packages/playwright/src/skill/SKILL.md技能文件位于,包含所有可用CLI命令和MCP工具的文档。添加新命令或工具时请更新该文件。
任何时候你都可以运行“npm run playwright-cli -- --help”查看最新可用命令,并使用它们来更新技能文件。
packages/playwright/src/skill/SKILL.md