Agent Skillssediman-agent/OpenSkynet › webapp-testing

webapp-testing

GitHub

提供基于Playwright的本地Web应用测试工具包,支持前端功能验证、UI调试、截图及日志查看。通过决策树指导静态/动态页面处理,利用with_server.py管理服务器生命周期,并推荐侦察后执行的最佳实践。

skills/anthropics_skills/webapp-testing/SKILL.md sediman-agent/OpenSkynet

Trigger Scenarios

需要测试本地运行的Web应用 验证前端界面功能和交互逻辑 调试UI行为或捕获浏览器状态 编写自动化脚本操作网页元素

Install

npx skills add sediman-agent/OpenSkynet --skill webapp-testing -g -y
More Options

Non-standard path

npx skills add https://github.com/sediman-agent/OpenSkynet/tree/main/skills/anthropics_skills/webapp-testing -g -y

Use without installing

npx skills use sediman-agent/OpenSkynet@webapp-testing

指定 Agent (Claude Code)

npx skills add sediman-agent/OpenSkynet --skill webapp-testing -a claude-code -g -y

安装 repo 全部 skill

npx skills add sediman-agent/OpenSkynet --all -g -y

预览 repo 内 skill

npx skills add sediman-agent/OpenSkynet --list

SKILL.md

Frontmatter
{
    "name": "webapp-testing",
    "license": "Complete terms in LICENSE.txt",
    "description": "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."
}

Web Application Testing

To test local web applications, write native Python Playwright scripts.

Helper Scripts Available:

  • scripts/with_server.py - Manages server lifecycle (supports multiple servers)

Always run scripts with --help first to see usage. DO NOT read the source until you try running the script first and find that a customized solution is abslutely necessary. These scripts can be very large and thus pollute your context window. They exist to be called directly as black-box scripts rather than ingested into your context window.

Decision Tree: Choosing Your Approach

User task → Is it static HTML?
    ├─ Yes → Read HTML file directly to identify selectors
    │         ├─ Success → Write Playwright script using selectors
    │         └─ Fails/Incomplete → Treat as dynamic (below)
    │
    └─ No (dynamic webapp) → Is the server already running?
        ├─ No → Run: python scripts/with_server.py --help
        │        Then use the helper + write simplified Playwright script
        │
        └─ Yes → Reconnaissance-then-action:
            1. Navigate and wait for networkidle
            2. Take screenshot or inspect DOM
            3. Identify selectors from rendered state
            4. Execute actions with discovered selectors

Example: Using with_server.py

To start a server, run --help first, then use the helper:

Single server:

python scripts/with_server.py --server "npm run dev" --port 5173 -- python your_automation.py

Multiple servers (e.g., backend + frontend):

python scripts/with_server.py \
  --server "cd backend && python server.py" --port 3000 \
  --server "cd frontend && npm run dev" --port 5173 \
  -- python your_automation.py

To create an automation script, include only Playwright logic (servers are managed automatically):

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True) # Always launch chromium in headless mode
    page = browser.new_page()
    page.goto('http://localhost:5173') # Server already running and ready
    page.wait_for_load_state('networkidle') # CRITICAL: Wait for JS to execute
    # ... your automation logic
    browser.close()

Reconnaissance-Then-Action Pattern

  1. Inspect rendered DOM:

    page.screenshot(path='/tmp/inspect.png', full_page=True)
    content = page.content()
    page.locator('button').all()
    
  2. Identify selectors from inspection results

  3. Execute actions using discovered selectors

Common Pitfall

Don't inspect the DOM before waiting for networkidle on dynamic apps ✅ Do wait for page.wait_for_load_state('networkidle') before inspection

Best Practices

  • Use bundled scripts as black boxes - To accomplish a task, consider whether one of the scripts available in scripts/ can help. These scripts handle common, complex workflows reliably without cluttering the context window. Use --help to see usage, then invoke directly.
  • Use sync_playwright() for synchronous scripts
  • Always close the browser when done
  • Use descriptive selectors: text=, role=, CSS selectors, or IDs
  • Add appropriate waits: page.wait_for_selector() or page.wait_for_timeout()

Reference Files

  • examples/ - Examples showing common patterns:
    • element_discovery.py - Discovering buttons, links, and inputs on a page
    • static_html_automation.py - Using file:// URLs for local HTML
    • console_logging.py - Capturing console logs during automation

Version History

  • c9d8953 Current 2026-07-05 19:50

Same Skill Collection

skills/anthropics_skills/algorithmic-art/SKILL.md
skills/anthropics_skills/brand-guidelines/SKILL.md
skills/anthropics_skills/canvas-design/SKILL.md
skills/anthropics_skills/doc-coauthoring/SKILL.md
skills/anthropics_skills/frontend-design/SKILL.md
skills/anthropics_skills/internal-comms/SKILL.md
skills/anthropics_skills/mcp-builder/SKILL.md
skills/anthropics_skills/pdf/SKILL.md
skills/anthropics_skills/skill-creator/SKILL.md
skills/anthropics_skills/slack-gif-creator/SKILL.md
skills/anthropics_skills/theme-factory/SKILL.md
skills/anthropics_skills/web-artifacts-builder/SKILL.md
skills/browser-use_browser-use/browser-use/SKILL.md
skills/browser-use_browser-use/remote-browser/SKILL.md
skills/browser-use_video-use/manim-video/SKILL.md
skills/browser-use_video-use/video-use/SKILL.md
skills/cloudflare_skills/agents-sdk/SKILL.md
skills/cloudflare_skills/cloudflare/SKILL.md
skills/cloudflare_skills/durable-objects/SKILL.md
skills/cloudflare_skills/sandbox-sdk/SKILL.md
skills/cloudflare_skills/web-perf/SKILL.md
skills/cloudflare_skills/workers-best-practices/SKILL.md
skills/cloudflare_skills/wrangler/SKILL.md
skills/cursor_plugins/cli-for-agent/skills/cli-for-agents/SKILL.md
skills/cursor_plugins/continual-learning/skills/continual-learning/SKILL.md
skills/cursor_plugins/create-plugin/skills/create-plugin-scaffold/SKILL.md
skills/cursor_plugins/create-plugin/skills/review-plugin-submission/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/check-compiler-errors/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/control-cli/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/control-ui/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/deslop/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/fix-ci/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/fix-merge-conflicts/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/get-pr-comments/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/loop-on-ci/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/make-pr-easy-to-review/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/new-branch-and-pr/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/pr-review-canvas/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/review-and-ship/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/run-smoke-tests/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/thermo-nuclear-code-quality-review/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/verify-this/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/weekly-review/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/what-did-i-get-done/SKILL.md
skills/cursor_plugins/cursor-team-kit/skills/workflow-from-chats/SKILL.md
skills/cursor_plugins/docs-canvas/skills/docs-canvas/SKILL.md
skills/cursor_plugins/orchestrate/skills/orchestrate/SKILL.md
skills/cursor_plugins/pr-review-canvas/skills/pr-review-canvas/SKILL.md
skills/cursor_plugins/pstack/skills/architect/SKILL.md

Metadata

Files
0
Version
c9d8953
Hash
51b7349e
Indexed
2026-07-05 19:50

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 06:02
浙ICP备14020137号-1 $Гость$