跳到正文
Skillpedia
测试8.2k · #12544

webapp-testing

它能做什么

这项技能指导你的 AI 从头到尾测试一个网页应用。适合希望检查每个路由和关键用户流程的开发者。

适用场景

  • ✓当你想检查网页应用的页面和接口是否有问题的时候。
  • ✓当你需要为登录等关键用户流程做自动化浏览器测试的时候。
  • ✓当你想在上线前对网站做无障碍检查的时候。

技能链接

https://github.com/vudovn/ag-kit/blob/main/.agents/skills/webapp-testing/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请测试我的网页应用的主要页面和登录流程,截图,并检查无障碍问题。”

每周 5 个新技能,1 分钟读完。

工作原理

技能会映射应用的路由和 API 端点,检查它们是否有响应,然后对关键路径运行浏览器测试。它还可以截图或运行无障碍检查。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Web App Testing

Discover and test everything. Leave no route untested.

🔧 Runtime Scripts

Execute these for automated browser testing:

Script Purpose Usage
scripts/playwright_runner.py Basic browser test python scripts/playwright_runner.py https://example.com
With screenshot python scripts/playwright_runner.py <url> --screenshot
Accessibility check python scripts/playwright_runner.py <url> --a11y

Requires: pip install playwright && playwright install chromium


1. Deep Audit Approach

Discovery First

Target How to Find
Routes Scan app/, pages/, router files
API endpoints Grep for HTTP methods
Components Find component directories
Features Read documentation

Systematic Testing

  1. Map - List all routes/APIs
  2. Scan - Verify they respond
  3. Test - Cover critical paths

2. Testing Pyramid for Web

        /\          E2E (Few)
       /  \         Critical user flows
      /----\
     /      \       Integration (Some)
    /--------\      API, data flow
   /          \
  /------------\    Component (Many)
                    Individual UI pieces

3. E2E Test Principles

What to Test

Priority Tests
1 Happy path user flows
2 Authentication flows
3 Critical business actions
4 Error handling

E2E Best Practices

Practice Why
Use data-testid Stable selectors
Wait for elements Avoid flaky tests
Clean state Independent tests
Avoid implementation details Test user behavior

4. Playwright Principles

Core Concepts

Concept Use
Page Object Model Encapsulate page logic
Fixtures Reusable test setup
Assertions Built-in auto-wait
Trace Viewer Debug failures

Configuration

Setting Recommendation
Retries 2 on CI
Trace on-first-retry
Screenshots on-failure
Video retain-on-failure

5. Visual Testing

When to Use

Scenario Value
Design system High
Marketing pages High
Component library Medium
Dynamic content Lower

Strategy

  • Baseline screenshots
  • Compare on changes
  • Review visual diffs
  • Update intentional changes

6. API Testing Principles

Coverage Areas

Area Tests
Status codes 200, 400, 404, 500
Response shape Matches schema
Error messages User-friendly
Edge cases Empty, large, special chars

7. Test Organization

File Structure

tests/
├── e2e/           # Full user flows
├── integration/   # API, data
├── component/     # UI units
└── fixtures/      # Shared data

Naming Convention

Pattern Example
Feature-based login.spec.ts
Descriptive user-can-checkout.spec.ts

8. CI Integration

Pipeline Steps

  1. Install dependencies
  2. Install browsers
  3. Run tests
  4. Upload artifacts (traces, screenshots)

Parallelization

Strategy Use
Per file Playwright default
Sharding Large suites
Workers Multiple browsers

9. Anti-Patterns

❌ Don't ✅ Do
Test implementation Test behavior
Hardcode waits Use auto-wait
Skip cleanup Isolate tests
Ignore flaky tests Fix root cause

Remember: E2E tests are expensive. Use them for critical paths only.

常见问题

运行浏览器测试需要安装什么?

技能说明,你需要安装带有 Playwright 的 Python 以及它的 Chromium 浏览器。

它会测试每一个路由吗?

它力求发现并测试所有路由,并优先从关键用户路径开始。

它能检查无障碍吗?

可以。运行脚本包含一个无障碍检查选项。

详情

作者的原始描述

Web application testing principles. E2E, Playwright, deep audit strategies.

repo: vudovn/ag-kit

热度

GitHub 星标
8.2k
排名
#12544
许可证
MIT
更新时间
2026/10/18

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能