一键导入
browser-test
Generate Playwright test scripts for browser-based acceptance verification. Load when DAG tasks touch UI, routes, or user-facing API responses.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generate Playwright test scripts for browser-based acceptance verification. Load when DAG tasks touch UI, routes, or user-facing API responses.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Start, check, or continue any work. Analyzes intent, plans tasks, and orchestrates execution via subagents (L2) or Agent Teams (L3).
Classify intent, assess complexity, generate task DAGs. Activates on /go or when user describes work.
Guide for using Reddit MCP to gather community sentiment, pain points, and adoption trends. Load this skill when a DAG contains research tasks about market validation, developer experience, or community opinions.
解析PRD,决定水平拆分策略,生成带验收标准的mini-PRD。当主协调器收到初始PRD或需要重新拆分工作时使用。
使用git worktrees为并行子协调器生成和管理tmux会话。当各部分准备好执行时使用。
从验收标准创建检查清单,编排executor→validator循环并带重试逻辑。当子协调器开始实现或收到验证失败时使用。
| name | browser-test |
| description | Generate Playwright test scripts for browser-based acceptance verification. Load when DAG tasks touch UI, routes, or user-facing API responses. |
A task needs browser_acceptance when its scope touches:
Tasks that are pure backend (DB migrations, config, internal services) do NOT need browser testing.
Add to any DAG task alongside the CLI acceptance field:
{
"browser_acceptance": {
"dev_server": "npm run dev",
"base_url": "http://localhost:3000",
"tests": [
{
"name": "Google OAuth button visible and clickable",
"steps": [
"Navigate to /login",
"Verify a button containing 'Google' is visible",
"Click the button",
"Verify URL changes to contain '/oauth'"
],
"assertions": [
"No console errors on page load",
"No failed network requests to /api/* endpoints"
]
}
]
}
}
getByRole, getByText, accessibility tree. Never hardcode CSS selectors — this makes tests resilient to UI changes..godag/quality.md if it exists. Only specify per-task overrides.If .godag/quality.md exists in the project root, read it during DAG generation for project-wide defaults:
# Quality Bars
## Dev Server
- Command: `npm run dev`
- Port: 3000
- Ready signal: "ready in" or "Local:" in stdout
## Browser Defaults
- No console errors on any page
- All /api/* calls return 2xx
- No horizontal overflow at 375px viewport
## Code Quality
- `tsc --noEmit` clean
- `npm run lint` clean
When generating browser_acceptance, inherit these defaults. Only add task-specific assertions for behavior unique to that task.
The orchestrator generates .godag/tests/{task_id}.spec.ts before running. Template:
import { test, expect } from '@playwright/test';
test.describe('{task_id}: {task_title}', () => {
let consoleErrors: string[] = [];
test.beforeEach(async ({ page }) => {
consoleErrors = [];
page.on('console', msg => {
if (msg.type() === 'error') consoleErrors.push(msg.text());
});
});
test('{test_name}', async ({ page }) => {
await page.goto('{path}');
// Natural language steps → Playwright locators:
// "Verify button 'Sign in' visible" →
await expect(page.getByRole('button', { name: /sign in/i })).toBeVisible();
// "Click the button" →
await page.getByRole('button', { name: /sign in/i }).click();
// "Verify URL contains '/dashboard'" →
await expect(page).toHaveURL(/dashboard/);
// Console error assertion (always appended)
expect(consoleErrors).toEqual([]);
});
});
Generate .godag/tests/playwright.config.ts once per run if absent:
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: '.',
timeout: 30000,
retries: 0,
use: {
baseURL: '{base_url}',
screenshot: 'only-on-failure',
trace: 'retain-on-failure',
video: 'off',
},
reporter: [
['json', { outputFile: '../context/{task_id}-results.json' }]
],
});
Screenshots on failure land in test-results/ automatically. JSON reporter writes to .godag/context/. Traces retained for deep debugging.
cd .godag/tests && npx playwright test {task_id}.spec.ts \
--config=playwright.config.ts 2>&1 | tail -20
Exit code 0 = pass, non-zero = fail. Orchestrator checks exit code only, then spawns summarizer.
After Playwright runs, orchestrator spawns a disposable Task-tool subagent to distill results. This keeps verbose JSON + screenshots out of the orchestrator's context.
你是测试结果分析器。读取 Playwright 结果,生成简洁判定。
## 输入
- JSON: .godag/context/{task_id}-results.json
- 截图: .godag/tests/test-results/ (如有)
## 输出
写入 .godag/context/{task_id}-verdict.md:
# {task_id} Browser Verdict — PASS/FAIL
## Results
1. ✅/❌ [test name]: [one line]
## Failures (only if failed)
- Error: [message, max 2 lines]
- Location: [first line of stack]
- Screenshot: [path]
## Console Issues (if any)
- [message, truncated to 100 chars]
## Root Cause Guess
[one sentence]
---
上限 30 行。只报告关键信息。
返回:
\```godag-result
{"task_id":"{task_id}-verify","summary":"PASS/FAIL: one line","acceptance_passed":true/false}
\```
Only the godag-result: ~30 tokens. The verdict.md stays on disk for the retry agent.
When browser verification fails, the retry implementation subagent gets:
你之前完成了 {task_id},但浏览器验证失败。
## 上次工作摘要
{summary from original godag-result}
## 失败详情
读取 .godag/context/{task_id}-verdict.md 了解具体问题。
截图在 .godag/tests/test-results/ (如有)。
修复 verdict.md 中列出的所有失败项。
Retry agent reads verdict in its own fresh context. Never sees raw JSON or orchestrator reasoning.
Before first browser test:
if ! curl -sf {base_url} > /dev/null 2>&1; then
{dev_server_command} > .godag/.devserver.log 2>&1 &
echo $! > .godag/.devserver.pid
for i in $(seq 1 30); do
curl -sf {base_url} > /dev/null 2>&1 && break
sleep 1
done
fi
After all tasks complete:
[ -f .godag/.devserver.pid ] && kill $(cat .godag/.devserver.pid) 2>/dev/null && rm .godag/.devserver.pid
Before generating any test:
npx playwright --version 2>/dev/null
If absent: "Browser testing 需要 Playwright。安装: npm init playwright@latest"
Skip browser_acceptance gracefully if unavailable — fall back to CLI-only acceptance.