webapp-testing
它能做什么
这个工具可以帮你测试和调试你在电脑上开发的网站。它能像真实用户一样与网站交互,检查功能是否正常,并截取屏幕截图或查看错误信息。
适用场景
- ✓想确认网站上的某个按钮能否正常工作时。
- ✓需要检查页面上的文字是否正确时。
- ✓想查看网站在不同屏幕尺寸下的显示效果并截图时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/webapp-testing/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“测试一下“保存”按钮能否正常使用,并确认页面上是否出现了“保存成功”的提示。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具使用一个叫 Playwright 的程序,在真实的浏览器中打开你的网站。它可以点击按钮、填写表单,并检查一切是否符合预期。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Web Application Testing
This skill enables comprehensive testing and debugging of local web applications using Playwright automation.
You should use the Playwright MCP Server to undertake the work if possible. If the MCP Server is unavailable, you can run the code in a local Node.js environment with Playwright installed.
When to Use This Skill
Use this skill when you need to:
- Test frontend functionality in a real browser
- Verify UI behavior and interactions
- Debug web application issues
- Capture screenshots for documentation or debugging
- Inspect browser console logs
- Validate form submissions and user flows
- Check responsive design across viewports
Prerequisites
- Node.js installed on the system
- A locally running web application (or accessible URL)
- Playwright will be installed automatically if not present
Core Capabilities
1. Browser Automation
- Navigate to URLs
- Click buttons and links
- Fill form fields
- Select dropdowns
- Handle dialogs and alerts
2. Verification
- Assert element presence
- Verify text content
- Check element visibility
- Validate URLs
- Test responsive behavior
3. Debugging
- Capture screenshots
- View console logs
- Inspect network requests
- Debug failed tests
Usage Examples
Example 1: Basic Navigation Test
// Navigate to a page and verify title
await page.goto("http://localhost:3000");
const title = await page.title();
console.log("Page title:", title);
Example 2: Form Interaction
// Fill out and submit a form
await page.fill("#username", "testuser");
await page.fill("#password", "password123");
await page.click('button[type="submit"]');
await page.waitForURL("**/dashboard");
Example 3: Screenshot Capture
// Capture a screenshot for debugging
await page.screenshot({ path: "debug.png", fullPage: true });
Guidelines
- Always verify the app is running - Check that the local server is accessible before running tests
- Use explicit waits - Wait for elements or navigation to complete before interacting
- Capture screenshots on failure - Take screenshots to help debug issues
- Clean up resources - Always close the browser when done
- Handle timeouts gracefully - Set reasonable timeouts for slow operations
- Test incrementally - Start with simple interactions before complex flows
- Use selectors wisely - Prefer data-testid or role-based selectors over CSS classes
Common Patterns
Pattern: Wait for Element
await page.waitForSelector("#element-id", { state: "visible" });
Pattern: Check if Element Exists
const exists = (await page.locator("#element-id").count()) > 0;
Pattern: Get Console Logs
page.on("console", (msg) => console.log("Browser log:", msg.text()));
Pattern: Handle Errors
try {
await page.click("#button");
} catch (error) {
await page.screenshot({ path: "error.png" });
throw error;
}
Limitations
- Requires Node.js environment
- Cannot test native mobile apps (use React Native Testing Library instead)
- May have issues with complex authentication flows
- Some modern frameworks may require specific configuration
Helper Functions
Some helper functions are available in test-helper.js to simplify common tasks like waiting for elements, capturing screenshots, and handling errors. You can import and use these functions in your tests to improve readability and maintainability.
常见问题
我需要安装什么东西吗?
你需要先安装 Node.js。如果 Playwright 还没有安装,这个工具会自动帮你完成安装。
可以测试手机应用吗?
不可以。这个工具针对的是在电脑浏览器中运行的网站。如果要测试手机应用,你需要使用其他工具。
什么是“选择器”(selectors)?
选择器就像地址,工具通过它们找到网页上的按钮、输入框以及其他元素。
详情
作者的原始描述
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7475
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。