Agent Skills
› NeverSight/learn-skills.dev
› e2e-testing
e2e-testing
GitHub提供基于Playwright的单页应用市场页面端到端测试模式,涵盖项目结构、运行命令及关键测试技巧,如API模拟、WebSocket处理和动态内容等待。
Trigger Scenarios
需要编写或执行SPA市场页面的E2E测试
配置Playwright测试环境及Mock策略
解决Windows平台下的Playwright兼容性问题
Install
npx skills add NeverSight/learn-skills.dev --skill e2e-testing -g -y
SKILL.md
Frontmatter
{
"name": "e2e-testing",
"description": "Playwright E2E test patterns for SPA market pages"
}
E2E Testing Patterns
Project Structure
pw_test/ # Playwright test scripts (standalone)
test_market_ui_smoke.py # Market page smoke tests
test_frontend_interaction_smoke.py # Full UI interaction tests
tests/e2e/ # pytest wrappers
test_market_ui_smoke.py # Pytest entry for market tests
test_frontend_interaction_smoke.py
Running E2E Tests
# Run all E2E
.venv\Scripts\python.exe -m pytest tests/e2e/ --no-cov -v
# Run standalone (no pytest)
.venv\Scripts\python.exe pw_test/test_market_ui_smoke.py
Test Pattern
- Static server serves
web/directory on port 8768/8769 - Mock API routes with
page.route("**/*", handler) - Seed context with
add_init_script()(user, WebSocket mock, localStorage) - Navigate, wait, assert, cleanup
Key Patterns
- Use
wait_for_function()for dynamic content - Use
wait_for_timeout(2000)as fallback (not as primary wait) - Mock WebSocket with stub class (real WS needs server)
- Use
page.evaluate()to call JS functions directly - Each test gets fresh browser context (no state leakage)
Windows Notes
- Playwright must be installed:
python -m playwright install chromium - Use
powershell -Commandfor running tests - CRLF warnings are normal
Version History
- e0220ca Current 2026-07-05 21:39


