frontend-testing

Add frontend test coverage using Playwright, MSW v2, and WCAG 2.2 accessibility gates.

Updated Feb 10, 2026
One-click install
npx skills add https://github.com/vesviet/agent-skills --skill frontend-testing-vesviet
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: frontend-testing
Source: https://github.com/vesviet/agent-skills/tree/main/core/skills/frontend/frontend-testing
Command: npx skills add https://github.com/vesviet/agent-skills --skill frontend-testing-vesviet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Frontend changes often ship without adequate regression coverage, leading to broken interactions, accessibility violations, and flaky visual regressions discovered only in production. This Skill guides the creation of deterministic UI tests that validate rendering, interaction, accessibility, and network-driven states before release. ## Core Features & Use Cases - Scoped Test Selection: Choose between component tests, page/route tests, and end-to-end journey tests based on the risk profile of the change. - Modern Tooling Standards: Enforces Playwright v1.48+ web-first auto-waiting assertions, MSW v2 transport-level network mocking with onUnhandledRequest: 'error', and HAR replay for third-party API stability. - Accessibility & Visual Gates: Runs automated WCAG 2.2 AA scans via @axe-core/playwright, verifies keyboard focus traps and restoration, and stabilizes visual snapshots with font readiness, animation disabling, and element masking. - Use Case: When adding a new checkout form, use this Skill to write component tests for validation states, mock the payment API with MSW v2 handlers, verify modal focus containment, and capture containerized visual regression baselines. ## Quick Start Use the frontend-testing skill to add regression tests for the new checkout form component, covering its error states, keyboard accessibility, and mocked API responses.

Frequently Asked Questions about frontend-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write deterministic Playwright tests without flaky waits?▼

Use Playwright's web-first auto-waiting locators such as expect(locator).toBeVisible() instead of arbitrary delays. Strictly avoid sleep() and page.waitForTimeout(); wait for explicit UI state or network idle predicates instead.

How do I mock API requests in frontend tests with MSW v2?▼

Use MSW v2 with setupServer for Node/Vitest and setupWorker for browser or Playwright environments. Author handlers with standard fetch http.* methods and typed HttpResponse.json(), and enforce onUnhandledRequest: 'error' to catch unmocked requests.

Should I use component tests or end-to-end tests for UI coverage?▼

Use component tests for isolated rendering variants, props, and focus traps; page or route tests for navigation and data loading; and end-to-end tests sparingly for high-risk multi-page journeys. Choose the smallest scope that proves the risk is covered.

How do I automate WCAG 2.2 accessibility testing in Playwright?▼

Run @axe-core/playwright with AxeBuilder.withTags(['wcag2a', 'wcag2aa', 'wcag22aa']).analyze() in CI with zero violations allowed. Also verify keyboard focus containment in modals and focus restoration to the trigger element on Escape.

Why do visual regression snapshots fail across different machines?▼

Cross-OS font rasterization and animations cause false-positive pixel diffs. Await document.fonts.ready, disable animations, mask dynamic elements like timestamps, run inside a containerized Linux environment, and set maxDiffPixelRatio to 0.002.

When should I use HAR replay instead of MSW handlers?▼

Use page.routeFromHAR() to record and replay deterministic network interactions when depending on external third-party APIs that are impractical to mock by hand. MSW v2 handlers remain the default for first-party API mocking.