跳到正文
Skillpedia
测试40k · #7475

webapp-testing

它能做什么

这个工具可以帮你测试和调试你在电脑上开发的网站。它能像真实用户一样与网站交互,检查功能是否正常,并截取屏幕截图或查看错误信息。

适用场景

  • ✓想确认网站上的某个按钮能否正常工作时。
  • ✓需要检查页面上的文字是否正确时。
  • ✓想查看网站在不同屏幕尺寸下的显示效果并截图时。

技能链接

https://github.com/github/awesome-copilot/blob/main/skills/webapp-testing/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/github/awesome-copilot/blob/main/skills/webapp-testing/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Always verify the app is running - Check that the local server is accessible before running tests
  2. Use explicit waits - Wait for elements or navigation to complete before interacting
  3. Capture screenshots on failure - Take screenshots to help debug issues
  4. Clean up resources - Always close the browser when done
  5. Handle timeouts gracefully - Set reasonable timeouts for slow operations
  6. Test incrementally - Start with simple interactions before complex flows
  7. 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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能