ワンクリックで
test-component
Runs, analyzes, and fixes Playwright and accessibility tests for a specific DB UX component.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Runs, analyzes, and fixes Playwright and accessibility tests for a specific DB UX component.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Creates a new DB UX Design System component with Mitosis source, SCSS, typed model, and Playwright tests.
Modifies an existing DB UX Design System Mitosis component (add variants, update props, change styles).
Implements production-ready UI using DB UX Design System v3 components, tokens, and icons with a discovery-first approach.
Migrates legacy DB UI v2 code (cmp-*, elm-*, rea-* classes, <db-*> Web Components, db-color-* tokens) to DB UX Design System v3.
| name | test-component |
| description | Runs, analyzes, and fixes Playwright and accessibility tests for a specific DB UX component. |
| triggers | ["test <component> component","run <component> playwright tests","fix failing <component> playwright tests","update <component> snapshots","fix <component> test failures"] |
| inputs | [{"name":"component_slug","type":"string","required":true,"description":"Component directory name in kebab-case (e.g. 'button', 'navigation-item')"},{"name":"component_name","type":"string","required":false,"description":"Optional PascalCase symbol name (e.g. 'Button'). If omitted, derive it from component_slug."},{"name":"update_snapshots","type":"boolean","required":false,"description":"Whether to update failing screenshots instead of fixing code (default: false)"},{"name":"figma_file_key","type":"string","required":false,"description":"Figma file key. Useful when validating visual diffs against the Figma spec."},{"name":"figma_node_id","type":"string","required":false,"description":"Figma node ID of the target component/frame. Used together with figma_file_key for visual validation."}] |
| requires | [{"context":"context/architecture.md","autoLoad":true}] |
| tools | ["db-ux/list_components","db-ux/get_component_props","figma/get_figma_data","figma/download_figma_images"] |
| outputs | ["packages/components/src/components/{component_slug}/{component_slug}.spec.tsx"] |
| on_error | {"max_retries":3,"actions":[{"log":"Analyze test failure output. Determine if it's a snapshot mismatch, code bug, or a11y violation."},{"fallback":"If errors persist after 3 retries, report full Playwright output to user."}]} |
Throughout this skill:
{component_slug} = kebab-case directory/file name (e.g. navigation-item){component_name} = PascalCase symbol name (e.g. NavigationItem)DB{component_name} = full component class name used in grep (e.g. DBNavigationItem)Name Derivation: Convert component_slug to PascalCase to get component_name:
button -> Button -> grep target: DBButtonnavigation-item -> NavigationItem -> grep target: DBNavigationItemcustom-select -> CustomSelect -> grep target: DBCustomSelectIf component_name is not explicitly provided, derive it deterministically from component_slug by capitalizing each segment after splitting on -.
context/architecture.md IS in context.component_slug IS provided and component EXISTS (verify via list_components). If missing: do NOT infer or guess. Ask the user.pnpm install --ignore-scripts has been run.pnpm run build before testing.list_components to confirm the component exists.packages/components/src/components/{component_slug}/{component_slug}.spec.tsx to understand existing tests.pnpm run build && pnpm run build-outputs to ensure the component and all generated framework files are up to date.Execute the component's tests from output/react (specs are generated there after pnpm run build-outputs):
cd output/react && pnpm exec playwright test --config playwright.config.ts -g "DB{component_name}"
Alternatively, run all component tests:
cd output/react && pnpm run test:components
Example: For component_slug = navigation-item, convert to component_name = NavigationItem, then grep for DBNavigationItem.
Capture the FULL output (pass/fail, error messages, diff output).
For EACH failing test, classify the failure:
| Failure Type | Indicator | Action |
|---|---|---|
| Screenshot mismatch | toHaveScreenshot() diff | Go to Step 3a |
| Aria snapshot mismatch | toMatchSnapshot() diff | Go to Step 3b |
| A11y violation | Axe-core violations array | Go to Step 3c |
| Component error | Runtime error, missing export | Go to Step 3d |
| Test code error | TypeScript error in spec | Go to Step 3e |
If update_snapshots is true:
Only update when the rendered delta is intentional and explicitly explained. Before running the update command, state WHY the visual change is expected (e.g. "variant X was added in the previous modification step"). If you cannot explain the delta, treat it as unintentional and go to the "false" path below.
Note: Do NOT run regenerate:screenshots node script locally. Snapshots are generated automatically in CI/CD.
If update_snapshots is false (default):
.lite.tsx and .scss to identify recent modifications..lite.tsx.id, impact, nodes, help..lite.tsx, e.g.:
aria-label: add label prop handling.role attribute..lite.tsx, model.ts, or index.ts).pnpm run build to recompile..lite, missing // @ts-ignore, prop API changed..spec.tsx file.pnpm run test (confirm no regressions).| Thought | Response |
|---|---|
| "Delete the failing test" | STOP. Fix code or update snapshot. NEVER delete tests. |
| "Disable this axe-core rule" | STOP. Fix the a11y issue. NEVER suppress. |
| "Screenshot diff is tiny, force-update" | STOP. Explain WHY it changed. Only update if intentional. |
| "Skip full test suite" | STOP. Run pnpm run test for regressions. |
| "Edit output/ to fix test" | STOP. .lite.tsx ONLY. Rebuild. Re-test. |
| "I don't know the component, I'll guess" | STOP. Ask user for component_slug. Do NOT infer. |