.opencode/skills/qa-run-tests/SKILL.md
Run Playwright tests with intelligent port detection. Reuses existing dev servers to avoid port conflicts. Returns JSON with test results and server status.
npx skillsauth add astro44/Autonom8-Agents qa-run-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Run tests for a ticket with intelligent port detection and server reuse.
{
"ticket_id": "TICKET-XXX",
"project_dir": "/path/to/project",
"spec_path": "tests/my-component.spec.js",
"scope": "ticket|changed|all",
"bail": true,
"fix": false
}
CRITICAL: Test Isolation
spec_path is provided, run ONLY that specific test filescope: "ticket", derive spec_path from ticket metadata scope.test_requirements.spec_pathnpm test or npx playwright test without a file filter (runs ALL tests)Before starting any server, check if a dev server is already running:
# Check if port 8080 is in use
lsof -i :8080 | grep LISTEN
# Check if port 8081 is in use (fallback)
lsof -i :8081 | grep LISTEN
# Check for running dev server processes
pgrep -f "python.*http.server|python.*SimpleHTTP|npx serve|live-server"
Port Decision Logic:
project_dir contains running server?
YES → Get PID and verify it's our server
└── Use existing server URL (http://localhost:8080)
NO → Start new server
└── Record PID for cleanup
Run Playwright tests with the detected/started server:
# If using existing server
PLAYWRIGHT_BASE_URL=http://localhost:8080 npx playwright test tests/
# If started new server, use that URL
{
"skill": "qa-run-tests",
"status": "success|failure|partial",
"server": {
"reused": true,
"port": 8080,
"pid": 12345,
"url": "http://localhost:8080"
},
"tests": {
"passed": 5,
"failed": 0,
"skipped": 1
},
"errors": [],
"warnings": [],
"next_action": "proceed|fix|review"
}
Check for existing server first
lsof -i :8080 to detect running serversStart server only if needed
# Only if no server found
cd $project_dir
python3 -m http.server 8080 &
SERVER_PID=$!
Run tests with proper URL and SPECIFIC FILE (CRITICAL)
# ALWAYS specify the test file - NEVER run all tests
PLAYWRIGHT_BASE_URL=http://localhost:$PORT npx playwright test $SPEC_PATH --reporter=json
# Example with spec_path from input:
PLAYWRIGHT_BASE_URL=http://localhost:8080 npx playwright test tests/my-component.spec.js --reporter=json
# WRONG - DO NOT DO THIS (runs ALL tests, causes cross-ticket pollution):
# npx playwright test --reporter=json
Parse test results and return JSON
Do NOT kill server if it was reused (preserve for next test run)
Exit codes determine retry behavior - use carefully:
| Pass Rate | Status | Exit Code | Behavior |
|-----------|--------|-----------|----------|
| 100% | success | 0 | Proceed to next step |
| ≥ 66% | partial | 0 | Allow self-healing/review |
| < 66% | failure | 1 | Trigger retry |
| 0% | failure | 1 | Trigger retry |
| Server/setup error | failure | 1 | Trigger retry |
Why this matters:
partial with exit 0 allows the workflow to continue with self-healingpartialCalculate pass rate:
pass_rate = passed / (passed + failed) * 100
# Skipped tests do NOT count against pass rate
| Scenario | Action | |----------|--------| | Port 8080 in use by unknown process | Try 8081, 8082... up to 8099 | | No available ports | Return error with "next_action": "fix" | | Pass rate < 66% | Return "status": "failure", exit 1 | | Pass rate ≥ 66% but < 100% | Return "status": "partial", exit 0, "next_action": "review" | | All tests pass | Return "status": "success", exit 0 | | Server startup fails | Return "status": "failure" with server error |
Run all tests for a ticket:
{
"ticket_id": "TICKET-OXY-001",
"project_dir": "/projects/oxygen_site",
"scope": "ticket"
}
Run only changed file tests (CI mode):
{
"ticket_id": "TICKET-OXY-001",
"project_dir": "/projects/oxygen_site",
"scope": "changed",
"bail": true
}
Run full test suite:
{
"ticket_id": "TICKET-OXY-001",
"project_dir": "/projects/oxygen_site",
"scope": "all",
"bail": false
}
Auto-fix mode (update snapshots):
{
"ticket_id": "TICKET-OXY-001",
"project_dir": "/projects/oxygen_site",
"scope": "ticket",
"fix": true
}
development
Scores proposal complexity against codebase surface. Uses proposal text analysis and readiness stats to determine decomposition tier and agent count.
testing
Fast filesystem readiness scan — counts docs, source files, manifests, platform signals. Produces initial ReadinessReport for agent spawning decisions.
testing
Merges bookend agent reports into revised readiness, complexity, and decomposition plan. Produces the final evidence-backed assessment consumed by sprint-architect-agent.
development
Rigorously reasons about definitions, proofs, and computations in algebra, analysis, discrete math, probability, linear algebra, and applied math. Verifies derivations, spots invalid steps, and states assumptions clearly. Use when solving or proving math problems, reviewing mathematical arguments, modeling with equations, interpreting statistics, or when the user mentions proofs, lemmas, theorems, integrals, series, matrices, optimization, or numerical methods.