frontend-test-advisor
Frontend testing patterns — React Testing Library, Vitest/Jest, Cypress e2e
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Frontend testing patterns — React Testing Library, Vitest/Jest, Cypress e2e
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when creating an SDD implementation plan from exploration.md, with deep interview, task breakdown, and batch assignments.
Generate a Product Requirements Document via interactive interview. Writes a markdown PRD that captures intent, user stories, and out-of-scope. Use when the brief is vague, when no ticket is bound, or when SDD invokes it from its PRD gate.
Use when executing an SDD plan via batch-based task implementation, tracking progress with [ ]/[X] markers and quality gates.
Use when starting an SDD workflow to discover codebase context, curate relevant files, and prepare exploration.md for planning.
SDD Orchestrator coordinates SDD (Spec-Driven Development) workflow via sub-agents
Use when reviewing code changes before commit, comparing implementation against SDD plan, or doing standalone code review with advisor consultation.
| name | frontend-test-advisor |
| scope | ["frontend","testing"] |
| description | Frontend testing patterns — React Testing Library, Vitest/Jest, Cypress e2e |
| version | 1.0 |
| tags | ["testing","react","rtl","vitest","jest","cypress","frontend"] |
Guide frontend testing strategy using React Testing Library (RTL), Vitest/Jest, and Cypress. Focus on testing behavior from the user's perspective rather than implementation details.
The React Testing Library guiding principle: "The more your tests resemble the way your software is used, the more confidence they give you."
Always prefer userEvent — it simulates real user interactions including focus, keyboard events, and pointer events.
// Preferred — simulates real interaction
const user = userEvent.setup()
await user.click(button)
await user.type(input, 'hello')
await user.keyboard('{Enter}')
await user.selectOptions(select, 'option-value')
// Avoid — low-level synthetic event only
fireEvent.click(button)
userEvent.setup() creates an instance that maintains state across interactions (pointer position, clipboard, etc.). Create it once per test.
Detailed patterns and examples are available in the references/ directory. Load these on demand when the review touches the specific topic.
references/rtl-queries.md for RTL query priority (getByRole, getByLabelText, etc.), component test structure, async testing, and custom hook testing patterns.references/vitest-setup.md for Vitest configuration, mocking with vi.mock()/jest.mock(), partial mocks, and error state testing patterns.references/cypress-e2e.md for Cypress E2E test patterns with @testing-library/cypress queries.Before finalizing your review, check gotchas.md for common Claude mistakes in this domain.
When reviewing frontend tests:
userEvent used instead of fireEventfindBy or waitFor used for async assertionsbeforeEach(() => vi.clearAllMocks()))This skill supports advisor mode: when invoked by the SDD orchestrator with a GUIDANCE CONTEXT FROM PLANNER block in the prompt, use the following procedure instead of the standard interactive review flow.
Advisor mode is active when the prompt contains:
GUIDANCE CONTEXT FROM PLANNER: blockCURRENT PLAN EXCERPT: blockGUIDANCE CONTEXT FROM PLANNER block to understand what the planner needs reviewed.CURRENT PLAN EXCERPT to see the specific tasks and design decisions.Focus ONLY on your specialist domain: RTL queries, user-event, MSW mocking, test structure.
### Strengths
- [What looks sound in the plan from this skill's domain perspective]
### Issues Found
[Severity: Critical / Major / Minor — reference specific task IDs or section names]
- T001: [issue description]
### Recommendations
[Specific, actionable. Reference task ID or section name for each recommendation.]
- T001: [recommendation]
Save full advice output to engram:
mem_save(
title: "sdd/{change-name}/guidance/frontend-test-advisor",
type: "architecture",
project: "{project-name}",
content: "{your full structured advice output}"
)
If engram is unavailable, skip silently.
Return a concise summary (3-5 bullet points) plus the engram observation ID:
### Summary
- [key point 1]
- [key point 2]
- ...
### Engram ID
{observation_id or "unavailable"}
Do NOT return an SDD Envelope when in advisor mode.