Files
ComfyUI_frontend/tools/test-recorder/src/checks/playwright.ts
bymyself 054e4cff39 feat: add Playwright test agents system — interactive recorder CLI, AI agents, and codegen transform
Three integrated systems for AI-assisted browser test creation:

1. comfy-test CLI (tools/test-recorder/)
   - Interactive 7-step recording flow for QA testers and non-developers
   - Environment checks with platform-specific install guidance
   - Codegen-to-convention transform engine
   - PR creation via gh CLI or manual GitHub web UI instructions
   - Commands: record, transform, check, list

2. Playwright AI agents (.claude/agents/)
   - Planner, generator, and healer agents patched with ComfyUI context
   - Regeneration scripts for Playwright updates (scripts/update-playwright-agents.sh)
   - MCP server config (.mcp.json) for agent browser interaction
   - Seed test and specs directory for agent-generated tests

3. Codegen transform skill (.claude/skills/codegen-transform/)
   - Transform rules: @playwright/test → comfyPageFixture, page → comfyPage,
     remove goto, canvas locators, waitForTimeout → nextFrame
   - Structural transforms: wrap in describe with tags, add afterEach cleanup
   - Fixture API reference and before/after examples
2026-03-28 17:44:17 -07:00

52 lines
1.5 KiB
TypeScript

import { execSync } from 'node:child_process'
import { pass, fail, warn, info } from '../ui/logger'
import type { CheckResult } from './types'
export async function checkPlaywright(): Promise<CheckResult> {
try {
// Check if chromium browser is installed
execSync('pnpm exec playwright install --dry-run chromium', {
encoding: 'utf-8',
stdio: 'pipe'
})
pass('Playwright browsers', 'chromium installed')
return { name: 'Playwright browsers', ok: true, version: 'chromium' }
} catch {
// Browser might not be installed, try to check another way
try {
const result = execSync('pnpm exec playwright --version', {
encoding: 'utf-8',
stdio: 'pipe'
}).trim()
warn('Playwright', `${result} (browsers may need installing)`)
const instructions = [
'Playwright browsers need to be installed:',
'',
' pnpm exec playwright install chromium --with-deps',
'',
'This downloads ~200MB. Please wait...'
]
info(instructions)
return {
name: 'Playwright browsers',
ok: false,
installInstructions: instructions
}
} catch {
fail('Playwright', 'not installed')
const instructions = [
'Playwright is a project dependency. Run:',
'',
' pnpm install',
' pnpm exec playwright install chromium --with-deps'
]
info(instructions)
return {
name: 'Playwright',
ok: false,
installInstructions: instructions
}
}
}
}