一键导入
test-healer
Runs Playwright tests and automatically fixes failures in both tests AND implementation code iteratively
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Runs Playwright tests and automatically fixes failures in both tests AND implementation code iteratively
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Manage OpenShift instance deployments: deploy, teardown, list, build images, backup/restore databases, and setup service accounts. Trigger phrases: deploy instance, teardown instance, list instances, build images, backup database, restore database, setup service account, oc deploy, instance management. Do NOT invoke for: local development setup, docker-compose, writing application code, database migrations.
Splits a feature branch into multiple sequential draft PRs targeting develop. Trigger phrases: split branch into PRs, break branch into PRs, create stacked PRs, split into multiple PRs. Do NOT invoke for: creating a single PR, cherry-picking individual commits, or rebasing.
Requirements Refiner: Iteratively questions the user to clarify vague requirements and outputs a single consolidated requirements document in feature-docs.
Implements user stories from a user_stories directory in dependency order using subagents. Reads README.md to find the next unchecked story, spawns Agent tool subagents to implement each one, tracks progress via scenario checkboxes in story files and story checkboxes in README. Trigger phrases: implement stories, implement user stories, story implementer, work on stories, implement next story. Do NOT invoke for: writing user stories (use write-user-stories), general code changes, checklist execution.
User Story Writer: Converts refined requirements into individual User Story files following a strict template, plus a README.md with phase breakdown. Trigger phrases: write user stories, generate user stories, create user stories from requirements.
Converts a user-provided list of issues, bugs, or tasks into a structured markdown checklist file in docs-md/. Trigger phrases: create checklist, make a checklist, turn these into a checklist, create todo file, checklist from these items. Do NOT invoke for: executing/working through checklist items, editing existing checklists, or general markdown file creation.
| name | test-healer |
| description | Runs Playwright tests and automatically fixes failures in both tests AND implementation code iteratively |
Run Playwright tests iteratively and fix failures automatically until all tests pass or max attempts reached.
Purpose: Fix BOTH test code and implementation code to make tests pass while adhering to requirements.
feature-docs/003-benchmarking-system/)CRITICAL: Reset and seed the database before running tests to ensure consistent starting state.
Before running any tests, execute these commands:
# From apps/backend-services directory
cd apps/backend-services
# Reset database (drops all data)
PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION="yes" npx prisma migrate reset --force
# Run migrations
npm run db:migrate
# Seed test data
npm run db:seed
OR use the combined reset command:
cd apps/backend-services && PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION="yes" npx prisma migrate reset --force && npm run db:seed
NOTE: switch back to project root after resetting database.
ALWAYS reset and seed database before running tests:
cd apps/backend-services && PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION="yes" npx prisma migrate reset --force && npm run db:seed
This ensures test failures aren't caused by stale data from previous runs.
NOTE: switch back to project root after resetting database.
npx playwright test --reporter=list
Parse test output for:
CRITICAL: Before applying any fix, consult these sources in order:
First Priority: Read {feature-dir}/REQUIREMENTS.md
Second Priority: Read relevant files in {feature-dir}/user-stories/
Third Priority: Explore the actual page behavior
Decision Tree: What to Fix?
Test fails → Check requirements
↓
Does implementation match requirements?
├─ NO → FIX IMPLEMENTATION CODE (app, backend, frontend)
│ Then re-run test
↓
└─ YES → Does test expect correct behavior per requirements?
├─ NO → FIX TEST CODE
└─ YES → FIX TEST SYNCHRONIZATION (waits, selectors)
Common Fix Patterns:
| Error Type | Investigation Steps | Fix Strategy |
|---|---|---|
| Locator not found | 1. Check REQUIREMENTS.md for expected element 2. Re-explore page with Playwright MCP 3. Find actual selector | If element should exist per requirements but doesn't: fix implementation If selector is outdated: update test & Page Object |
| Assertion failed | 1. Read REQUIREMENTS.md for expected value 2. Read user-stories for acceptance criteria 3. Verify which is correct: test or app | If requirements say X but app shows Y: fix the implementation to match requirements If test expectation is wrong: fix the test |
| Timeout exceeded | 1. Check requirements for async operations 2. Explore page for loading states | If app is slow: investigate and fix performance issue If test timing is wrong: add explicit waitFor or increase timeout |
| Navigation failed | 1. Check requirements for navigation flow 2. Verify URL patterns in user stories | If navigation is broken: fix implementation routing If test navigation is incorrect: add waitForLoadState('networkidle') |
| Element not visible | 1. Check requirements for UI state 2. Explore page for conditional rendering | If element should be visible per requirements: fix implementation If test timing is wrong: add waitFor({ state: 'visible' }) |
| Element detached | 1. Review requirements for dynamic content | If DOM manipulation is buggy: fix implementation If test needs better synchronization: use waitForSelector before interaction |
| Missing test data | 1. Read apps/shared/prisma/seed.ts2. Verify seed data exists for test scenario | If test expects data that doesn't exist: update seed.ts and re-seed If test IDs don't match seed IDs: update test to use correct seed data IDs |
| Authentication errors | 1. Verify TEST_API_KEY is set2. Check setupAuthenticatedTest is called3. Inspect network requests for x-api-key header | If auth setup missing: add setupAuthenticatedTest in beforeEachIf backend returns 403: verify API key is correct and environment variable is set If frontend not authenticated: check localStorage tokens are injected |
When fixing implementation (not just tests):
apps/frontend/src/apps/backend-services/src/apps/temporal/src/tests/e2e/pages/tests/e2e/Read the relevant implementation files and modify them to match requirements.
Follow this iterative process:
cd apps/backend-services && PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION="yes" npx prisma migrate reset --force && npm run db:seednpx playwright test path/to/test.spec.tsWhen tests fail, progressively add debugging:
page.on('request', request => {
console.log('>>', request.method(), request.url());
});
page.on('response', response => {
console.log('<<', response.status(), response.url());
});
page.on('response', response => {
if (response.status() >= 400) {
console.error('API Error:', response.status(), response.url());
}
});
These should be added temporarily during healing, then removed once issue is identified.