webapp-testinglisted
Install: claude install-skill Alexxiang2008/awesome-skills-map
# Web Application Testing
## Prerequisites Check (MUST DO FIRST)
**Before performing any testing task, you MUST check if Playwright is installed:**
```bash
python -c "from playwright.sync_api import sync_playwright; print('Playwright is installed')" 2>/dev/null || echo "NOT_INSTALLED"
```
**If the output is `NOT_INSTALLED`, guide the user through installation:**
1. Ask the user: "Playwright 尚未安装。是否需要我帮你安装?"
2. If user agrees, run:
```bash
pip install playwright && playwright install chromium
```
3. Verify installation succeeded before proceeding with the original task.
**Only proceed with testing tasks after confirming Playwright is available.**
---
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