playwright-test
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRead @playwright/README.md for best practices, gotchas, and how to run tests.
阅读@playwright/README.md以了解最佳实践、注意事项以及测试运行方法。
Rules
规则
- Follow the best practices in the README strictly
- After UI interactions, always assert on UI changes, do not assert on network requests resolving
- Keep looping until all tests pass. Do not give up or ask the user for help. You must resolve every failure yourself.
- 严格遵循README中的最佳实践
- 在UI交互后,始终针对UI变化进行断言,不要针对网络请求的完成进行断言
- 持续循环直到所有测试通过。不要放弃或向用户求助,你必须自行解决所有失败问题。
Instructions
说明
You are to plan an end to end playwright test for a feature.
你需要为某个功能规划一个端到端的Playwright测试。
Step 1: Plan the test(s) to be done.
步骤1:规划要执行的测试
Use the Playwright MCP tools (e.g., , , ) to interact with the browser and plan your tests.
mcp__playwright__browser_navigatemcp__playwright__browser_clickmcp__playwright__browser_screenshotAfter your exploration, present the plan to me for confirmation or any changes.
使用Playwright MCP工具(例如、、)与浏览器交互并规划你的测试。
mcp__playwright__browser_navigatemcp__playwright__browser_clickmcp__playwright__browser_screenshot完成探索后,将测试计划提交给我确认或进行修改。
Step 2: Implement the test plan
步骤2:执行测试计划
- Write the tests, making sure to use common patterns used in neighbouring files.
- Run the tests with
BASE_URL='http://localhost:8010' pnpm --filter=@posthog/playwright exec playwright test <file name> --retries 0 --workers 3 - Debug any failures. Look at screen shots, if needed launch the playwright mcp skills to interact with the browser. Go back to step 1 after attempting a fix.
- 编写测试代码,确保使用相邻文件中常用的模式。
- 使用命令运行测试
BASE_URL='http://localhost:8010' pnpm --filter=@posthog/playwright exec playwright test <file name> --retries 0 --workers 3 - 调试所有失败的测试。如有需要,查看截图,或者启动Playwright MCP技能与浏览器交互。尝试修复后回到步骤1。
Step 3: Ensure no flaky tests
步骤3:确保测试无不稳定问题
After all tests pass in the file, run with added to the command. This will surface any flaky tests.
--repeat-each 10If any test fails across the 10 runs, treat it as a real failure: go back to Step 2, debug, fix, and re-run Step 3. Do not proceed to Step 4 until every run of every test passes.
当文件中的所有测试通过后,在命令中添加参数重新运行。这会暴露任何不稳定的测试。
--repeat-each 10如果任何测试在10次运行中出现失败,将其视为真实失败:回到步骤2,调试、修复,然后重新执行步骤3。直到所有测试的每一次运行都通过后,再进入步骤4。
Step 4: Report
步骤4:报告
Once all tests pass, output a single line: Testing Complete
当所有测试通过后,输出单行内容:Testing Complete