关于 playwright
用于配置、编写和运行 Playwright 浏览器端到端测试的技能,涵盖定位器、Fixture、多页面、CI,以及通过报告和 trace 调试。
主要功能
- 01Playwright 安装与配置
- 02定位器和 Fixture 指南
- 03浏览器与 API 测试模式
- 04测试运行与 UI 模式
- 05报告、trace 和截图
适用场景
- 01编写浏览器端到端测试
- 02配置测试以在 CI 中运行
- 03通过 trace 排查失败原因
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ full-stack-skills/ testing-skills --skill playwright安装后在 Claude Code 中输入/playwright确认已加载。
附带文件agents/openai.yamlLICENSE.txt
README 原文English
来自项目 READMEREADME 暂无中文译文,以下为英文原文;中文介绍见上方。
When to use this skill
Use this skill whenever the user wants to:
- 用 Playwright 编写或调试浏览器 E2E 测试(多浏览器、多标签、自动等待)
- 配置项目、定位器、Fixture 与 CI 运行
How to use this skill
- 安装:npm init playwright;选浏览器与语言;生成示例与配置。
- 编写:page.goto、getByRole、click、fill、expect;自动等待与断言;多页与 API 请求。
- 运行:npx playwright test;headed/UI 模式;报告与 trace。
Best Practices
- 优先用 getByRole/getByLabel;避免脆弱 xpath。
- 用例独立、可重复;用 fixture 或 beforeEach 准备状态。
- CI 中安装依赖与浏览器;失败时保留 trace 与截图。
Keywords
playwright, E2E, 端到端测试, 多浏览器
评论
支持 Markdown