webapp-testing

insoln 的头像作者 insoln

Playwright本地Web应用交互与测试工具。用于验证前端行为(Vite/React UI)、复现UI bug或构建最小化端到端/冒烟脚本。

📖 中文导读:Playwright本地Web应用交互与测试工具。用于验证前端行为(Vite/React UI)、复现UI bug或构建最小化端到端/冒烟脚本。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: webapp-testing description: Toolkit for interacting with and testing local web applications using Playwright. Use when verifying frontend behavior (Vite/React UI), reproducing UI bugs, or building minimal E2E/smoke scripts. license: Complete terms in LICENSE.txt

Web Application Testing (Playwright)

Use this skill to create small, purpose-built Playwright scripts for verifying the frontend.

When to use

  • Smoke testing the React/Vite UI after changes
  • Reproducing UI regressions (selectors, rendering, API polling)
  • Capturing screenshots and browser console logs
  1. Ensure the app is running (typically via dev compose):
    • docker compose -f infra/docker-compose.dev.yml up -d
    • Frontend: http://localhost:5173
  2. Use reconnaissance-then-action:
    • Navigate
    • Wait for a stable load state
    • Inspect DOM / take a screenshot
    • Then implement precise actions/assertions

Note:

  • This repo doesn’t vendor Playwright; install it in your chosen environment per Playwright’s official docs.

Minimal Playwright script (Python)

from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch(headless=True)
    page = browser.new_page()

    page.goto("http://localhost:5173")
    page.wait_for_load_state("networkidle")

    page.screenshot(path="/tmp/ui.png", full_page=True)

    # Example: print console logs (optional)
    # page.on("console", lambda msg: print(msg.type, msg.text))

    browser.close()

Common pitfalls

  • Don’t inspect the DOM before networkidle on dynamic apps.
  • Prefer stable selectors (role=, text=, test IDs) over brittle CSS chains.