Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计异常

playwright-e2e-testingPlaywright E2E 测试

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

194

周安装

8

GitHub Stars

1

下载量

63
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:playwright-e2e-testing(Playwright E2E 测试)
来源仓库:https://github.com/dawiddutoit/custom-claude
仓库路径:skills/playwright-e2e-testing
安装命令:
npx skills add https://github.com/dawiddutoit/custom-claude --skill playwright-e2e-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/dawiddutoit/custom-claude --skill playwright-e2e-testing

简介

playwright-e2e-testing 支持端到端测试设计与自动化验证执行。

  • 包含初始状态快照、表单交互、控制台监控与网络请求追踪全流程。
  • 适用于登录流、支付流程等高价值路径的回归测试用例编写。
  • 运行前需确认本地服务端口与夹具数据可用性,区分模拟环境与真实依赖。
  • 测试通过不应成为修改业务逻辑的理由,需警惕误判导致的副作用。

SKILL.md

Playwright E2E Testing

Quick Start

Test a login flow with evidence collection:

You: "Test the login flow at http://localhost:3000"

Claude: [Runs E2E test with]:
1. Initial state capture (snapshot + screenshot)
2. Form interaction (username/password)
3. Console error monitoring
4. Network request verification
5. Final state capture
6. Comprehensive test report

Result: Complete test report with screenshots, console logs, network activity, and pass/fail status.

Table of Contents

  1. When to Use This Skill
  2. What This Skill Does
  3. E2E Testing Workflow 3.1. Initial State Capture 3.2. Test Execution 3.3. Evidence Collection 3.4. Final Verification 3.5. Report Generation
  4. Common Test Scenarios
  5. Supporting Files
  6. Expected Outcomes
  7. Requirements
  8. Red Flags to Avoid

When to Use This Skill

Explicit Triggers

  • "Test the user flow for [feature]"
  • "Run E2E test on [URL]"
  • "Validate the [workflow/form/checkout] process"
  • "Check if [feature] works end-to-end"
  • "Automated testing for [scenario]"
  • "Verify [user journey]"

Implicit Triggers

  • Need to validate multi-step workflows (login, checkout, signup)
  • Regression testing after changes
  • Collecting evidence for bug reports
  • Verifying form submissions work correctly
  • Testing SPA navigation and state changes
  • Validating API interactions from browser

Debugging Triggers

  • "Why is [feature] not working?"
  • "Check console for errors during [action]"
  • "Monitor network requests during [workflow]"
  • "Capture evidence of [bug]"

What This Skill Does

This skill standardizes end-to-end testing with comprehensive evidence collection:

  1. State Capture - Takes snapshots and screenshots before and after tests
  2. Interaction Execution - Fills forms, clicks buttons, navigates pages
  3. Error Monitoring - Watches console for errors and warnings
  4. Network Verification - Tracks API calls and responses
  5. Evidence Collection - Generates reports with all artifacts
  6. Pass/Fail Determination - Validates expected outcomes

E2E Testing Workflow

3.1. Initial State Capture

Purpose: Establish baseline before test execution

Step 1: Navigate to application
  browser_navigate(url="http://localhost:3000")

Step 2: Wait for page load
  browser_wait_for(time=2)

Step 3: Capture accessibility snapshot
  browser_snapshot()
  → Save as "initial-state.md"

Step 4: Take screenshot
  browser_take_screenshot(filename="initial-state.png")

Why this matters: Initial state provides context for test failures and debugging.

3.2. Test Execution

Purpose: Execute user interactions systematically

Step 1: Identify form elements
  browser_snapshot()
  → Find refs for input fields

Step 2: Fill form fields
  browser_fill_form(fields=[
    {name: "Email", ref: "ref_5", type: "textbox", value: "user@test.com"},
    {name: "Password", ref: "ref_6", type: "textbox", value: "password123"}
  ])

Step 3: Submit form
  browser_click(element="Login button", ref="ref_7")

Step 4: Wait for response
  browser_wait_for(text="Welcome")

Pattern: Snapshot → Identify refs → Interact → Verify

3.3. Evidence Collection

Purpose: Gather diagnostic information during test

Step 1: Check console messages
  browser_console_messages(level="error")
  → Capture any errors/warnings

Step 2: Monitor network requests
  browser_network_requests()
  → Verify API calls succeeded

Step 3: Capture intermediate states
  browser_take_screenshot(filename="step-2-after-login.png")

Evidence types:

  • Console logs (errors, warnings, info)
  • Network requests (status codes, URLs, timing)
  • Screenshots (visual confirmation)
  • Accessibility snapshots (DOM state)

3.4. Final Verification

Purpose: Validate test success criteria

Step 1: Verify expected elements
  browser_snapshot()
  → Check for success indicators

Step 2: Capture final state
  browser_take_screenshot(filename="final-state.png")

Step 3: Check for errors
  browser_console_messages(level="error")
  → Ensure no errors during workflow

Success criteria:

  • Expected text/elements present
  • No console errors
  • Network requests succeeded (2xx status codes)
  • Final state matches expectations

3.5. Report Generation

Purpose: Create comprehensive test documentation

Use scripts/generate_test_report.py:

python scripts/generate_test_report.py \
  --test-name "Login Flow" \
  --initial-snapshot initial-state.md \
  --final-snapshot final-state.md \
  --screenshots initial-state.png,final-state.png \
  --console-logs console.json \
  --network-requests network.json \
  --output test-report.md

Report includes:

  • Test metadata (name, URL, timestamp)
  • Pass/fail status with reasoning
  • Console error summary
  • Network request summary
  • Screenshot gallery
  • Accessibility snapshots
  • Recommendations for failures

See references/report-template.md for structure.

Common Test Scenarios

Login Flow: Navigate → Capture state → Fill credentials → Submit → Wait for success → Verify console/network → Capture final state → Report

Form Submission: Navigate → Capture state → Fill fields → Submit → Wait for confirmation → Verify POST request → Check validation → Capture state → Report

Multi-Step Checkout: Add to cart → Checkout → Fill shipping/payment (capture each) → Submit order → Verify confirmation → Check all APIs → Report

SPA Navigation: Navigate → Click nav links → Verify URL changes → Check content updates → Monitor console/network → Capture states → Report

See examples/examples.md for 10+ detailed scenarios with complete code.

Supporting Files

scripts/ - generate_test_report.py (creates markdown reports), setup_test_env.py (initializes directories)

references/ - report-template.md (report structure), troubleshooting.md (common issues/solutions)

examples/ - examples.md (10+ complete test scenarios with code)

Expected Outcomes

Successful Test

✅ Test Passed: Login Flow

Test Summary:
- URL: http://localhost:3000/login
- Duration: 5.2 seconds
- Steps: 4
- Console Errors: 0
- Network Failures: 0

Evidence:
- Initial state: initial-state.png
- Final state: final-state.png
- Accessibility snapshots: 2
- Network requests: 3 (all 200 OK)

Verification:
✅ "Welcome, User" text found
✅ No console errors
✅ POST /api/login returned 200
✅ Dashboard loaded successfully

Full report: test-reports/login-flow-2025-12-20.md

Failed Test

❌ Test Failed: Login Flow

Test Summary:
- URL: http://localhost:3000/login
- Duration: 3.1 seconds (stopped early)
- Steps: 2 of 4 completed
- Console Errors: 2
- Network Failures: 1

Failure Reason:
Network request POST /api/login returned 401 Unauthorized

Console Errors:
1. [Error] Authentication failed: Invalid credentials
2. [Error] Uncaught TypeError: Cannot read property 'token' of undefined

Evidence:
- Initial state: initial-state.png
- Error state: error-state.png
- Network log: network.json

Recommendations:
1. Check API endpoint credentials
2. Verify authentication token handling
3. Add error handling for failed login attempts

Full report: test-reports/login-flow-failed-2025-12-20.md

Requirements

Tools:

  • Playwright MCP tools (browser_navigate, browser_snapshot, etc.)
  • Python 3.8+ (for report generation scripts)
  • Write access to test output directory

Environment:

  • Application running and accessible (local or remote)
  • Network connectivity for API calls
  • Sufficient disk space for screenshots

Knowledge:

  • Basic understanding of web application flows
  • Familiarity with CSS selectors or accessibility roles
  • Understanding of HTTP status codes

Red Flags to Avoid

Testing Anti-Patterns:

  • Starting test without capturing initial state
  • Ignoring console errors during test execution
  • Not verifying network requests succeeded
  • Skipping final state capture
  • Proceeding with test after clear failure
  • Not waiting for async operations to complete
  • Using hardcoded waits instead of wait_for text/elements
  • Generating report without all evidence files

Evidence Collection:

  • Missing screenshots for critical steps
  • Not checking console messages after interactions
  • Ignoring network request failures
  • Not capturing intermediate states for multi-step flows

Report Quality:

  • Vague test names ("Test 1", "Flow 2")
  • Missing pass/fail criteria
  • No recommendations for failures
  • Incomplete evidence references

Security:

  • Including credentials in screenshots
  • Committing sensitive test data to git
  • Exposing API keys in network logs
  • Sharing test reports with PII

Notes

Best Practices:

  1. Always capture initial and final state (snapshot + screenshot)
  2. Check console after every significant interaction
  3. Verify network requests for expected status codes
  4. Use descriptive test names and step descriptions
  5. Generate reports immediately after test completion
  6. Store test artifacts in organized directory structure

Performance Tips:

  • Use browser_wait_for(text="...") instead of fixed time waits
  • Take screenshots only at key steps (not every interaction)
  • Filter console messages by level to reduce noise
  • Clear network requests between test runs

Integration:

  • Combine with CI/CD for automated regression testing
  • Use with bug tracking to attach evidence to issues
  • Share reports with team for test documentation
  • Archive test artifacts for historical analysis

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.92%
按下载量换算21

Claude

29.47%
按下载量换算19

Cursor

20.23%
按下载量换算13

Gemini CLI

9.9%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills