From ac
Browser QA workflow patterns and Playwright CLI integration. Loaded by /ac:browser-qa command.
npx claudepluginhub anilcancakir/claude-code-plugin --plugin acThis skill uses the workspace's default tool permissions.
Browser-based QA testing via Playwright CLI (`playwright-cli`). This skill provides workflow patterns, token efficiency strategies, and self-healing patterns used by the `/ac:browser-qa` command. Report format lives in `references/report-format.md`. Shared cross-backend patterns (knowledge system, test modes, parallel execution, evidence persistence) live in the plugin-level `../../references/q...
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Browser-based QA testing via Playwright CLI (playwright-cli). This skill provides workflow patterns, token efficiency strategies, and self-healing patterns used by the /ac:browser-qa command. Report format lives in references/report-format.md. Shared cross-backend patterns (knowledge system, test modes, parallel execution, evidence persistence) live in the plugin-level ../../references/qa-patterns.md — read it for conventions shared with maestro-qa and flutter-qa. This file distills orchestration knowledge and CLI-specific patterns.
npm install -g @playwright/cli@latest (docs)playwright-cli --versionSnapshots and screenshots write to disk (.playwright-cli/), never into context — ~4x token reduction vs tool-call-based approaches. Read only the relevant portion of snapshot YAML when targeting elements; never dump the entire tree into context.
playwright-cli open -s=<name> <url>PLAYWRIGHT_CLI_SESSION=<name>playwright-cli close -s=<name>-s=bqa-{index} (e.g., bqa-0, bqa-1). Sessions are fully isolated: independent cookies, storage, and cache — no cross-agent state bleedplaywright-cli close -s=bqa-{index} per agent when done; playwright-cli close-all as fallback if agents exit without closing--headed to playwright-cli open to show the browser UI: playwright-cli open --headed <url>PLAYWRIGHT_MCP_HEADLESS=false (applies to all sessions in the process)ref values from snapshot YAML (e.g., e15) — preferred, most stable#id, .class) — acceptable for stable, semantic selectorsrole=button[name=Submit]) — preferred for semantic recovery| Command | Purpose |
|---|---|
playwright-cli open <url> | Open browser and navigate to URL |
playwright-cli goto <url> | Navigate current session to URL |
playwright-cli snapshot | Capture accessibility tree as YAML to disk |
playwright-cli click <ref> | Click element by ref or selector |
playwright-cli fill <ref> <value> | Fill input field |
playwright-cli type <ref> <value> | Type into focused element |
playwright-cli screenshot --filename=<path> | Capture screenshot to disk |
playwright-cli console | Read current console messages |
playwright-cli network | Read current network request log |
playwright-cli eval <expression> | Evaluate JavaScript in page context |
playwright-cli close | Close browser session |
playwright-cli run-code "async page => { ... }" | Execute multi-step code batch |
lsof -i -P | grep LISTEN to find local ports. Suggest URL if foundplaywright-cli open <url> to start sessionplaywright-cli snapshot writes YAML to disk. Read only the relevant subtree — search for target element by ref or role, never read entire file into contextplaywright-cli console and playwright-cli network after error-likely interactions (form submits, navigations, API calls)playwright-cli close when doneWhen running in parallel mode, use the session name provided by the command (e.g., -s=bqa-0) on every playwright-cli open call.
playwright-cli open + playwright-cli close per bug to avoid state pollutionplaywright-cli screenshot --filename=<path> + playwright-cli console + playwright-cli network. Evidence is mandatory for FAIL verdictsKey: Isolation is paramount. Each bug gets a fresh playwright-cli open / playwright-cli close cycle. If bug doc lacks structure, extract bugs by paragraph/section breaks.
When running in parallel mode, use the session name provided by the command (e.g., -s=bqa-1) so each parallel agent's sessions remain isolated.
Done when: blocks from plan file. Fall back to bulleted checklist itemsplaywright-cli open, playwright-cli snapshot, interact by ref, playwright-cli eval for assertionsKey: Use playwright-cli eval for programmatic assertions (e.g., document.querySelector('.result').textContent). Clean state per test case via fresh open/close.
When running in parallel mode, use the session name provided by the command (e.g., -s=bqa-2) on every playwright-cli open call in this agent's scope.
.ac/browser-qa/{testName}.json (testName derived from original target) — stop if not foundKey: Output a diff table showing previous→current verdict changes.
When running in parallel mode, use the session name provided by the command (e.g., -s=bqa-3) to keep re-run sessions isolated from any concurrently running agents.
playwright-cli snapshot writes to .playwright-cli/. Files never enter context unless explicitly read. Search YAML for target element, read only relevant linesplaywright-cli screenshot writes to disk. Only file paths enter context, never image data. Screenshots are FAIL evidence onlyrun-code for multi-step batching — playwright-cli run-code "async page => { ... }" replaces N individual playwright-cli calls with 1 Bash callplaywright-cli close + playwright-cli open to prevent accumulated stdout bloating contextWhen an element interaction fails (ref not found, selector mismatch, stale element):
playwright-cli snapshot to get fresh YAML of current DOM statebutton, link, textbox), accessible name, or nearby landmark contextref value from the fresh snapshot YAMLBLOCKED with note: "Element not found after 3 retries: [description]"Never fall back to generic CSS class selectors — they are brittle and break on class rename or build hash change. Role selectors (role=button[name=Submit]) are the only acceptable fallback after ref-based targeting fails.
During a test run, capture non-obvious discoveries that would save the next agent time. Do not capture trivial facts (e.g., "page has a header" — the next agent can see that). Only capture what required effort to discover.
Before executing any test cases, load existing project knowledge:
.ac/qa/knowledge/project.jsonl via Read tool. If the file doesn't exist, proceed with empty knowledge.PRIOR_KNOWLEDGE from the parent command (if provided). On same-key conflict, file-based knowledge wins.EFFECTIVE_KNOWLEDGE — use throughout execution for selector hints, timing guidance, and flow awareness.Project knowledge is cumulative across all test runs. A fact learned during ad-hoc testing of /register benefits a later plan-verify run that touches the same pages.
{ "type": "selector|flow|timing|gotcha", "key": "<human-readable identifier>", "value": "<what to remember>", "confidence": "high|medium|low" }
Anti-pattern: Do not log obvious/trivial facts. If the next agent would discover it in one snapshot, skip it. Only capture discoveries that required multiple attempts or non-obvious reasoning to reach.
Write facts to disk immediately after each test case — do not wait until the end of the run.
Write pattern (via Bash — agent has no Write tool):
mkdir -p .ac/qa/knowledge/
echo '{"type":"selector","key":"cookie-dismiss-btn","value":"role=button[name=Accept All]","confidence":"high"}' >> .ac/qa/knowledge/.bqa-{SESSION_NAME}.jsonl
File naming: .bqa-{SESSION_NAME}.jsonl — each agent writes to its own temp file. Parent merges all temp files into project.jsonl after execution.
When to write:
high or medium confidenceWhy immediate writes matter:
${CLAUDE_PLUGIN_ROOT}/skills/browser-qa/references/report-format.mdLoad report-format.md for the structured JSON schema used in .ac/browser-qa/{testName}.json persistence.
| Anti-Pattern | Why Wrong | Do Instead |
|---|---|---|
| Reading full snapshot YAML into context | Wastes tokens — YAML files can be large | Search for target ref/role, read only relevant lines |
| Screenshots when snapshot suffices | PNG files large if read into context | Use playwright-cli snapshot; screenshots only as FAIL evidence (saved to disk) |
| 20+ interactions without re-opening | Accumulated stdout bloats context | playwright-cli close + playwright-cli open after ~20 |
| Hardcoding CSS selectors | Brittle — break on class rename | Use ref from snapshot YAML, or role selectors |
| Skipping evidence on FAIL | Unverifiable failures waste debugging time | playwright-cli screenshot --filename=<path> + playwright-cli console + playwright-cli network |
| One command per form field | N Bash calls wastes round trips | Batch with playwright-cli run-code "async page => { ... }" |
| Waiting until all tests finish to write knowledge | Facts lost on crash, parallel agents can't benefit mid-run | Write to .bqa-{SESSION_NAME}.jsonl after each test case via Bash echo |