Test

From aladicf/better-web-ui · View interactive version

Test is an AI agent skill from the GitHub repository aladicf/better-web-ui. Build or improve a UI testing strategy covering visual regression, interaction testing, and accessibility assertions. Use when the user asks to add tests, set up testing, fix flaky tests, improve test coverage, validate UI behavior, catch visual bugs, or establish confidence in shipping frontend cha

How to use this skill

Skill file

Establish systematic confidence in UI behavior through the right mix of visual regression, interaction testing, and accessibility assertions.

Treat testing as a design input, not a post-ship safety net. The goal is not maximum coverage; it is catching the bugs that matter most without drowning the team in maintenance.

Consult the accessibility testing reference when the testing strategy needs automated axe checks, screen reader validation, or keyboard traversal tests.

Consult the component accessibility reference when testing custom components for focus management, ARIA correctness, and keyboard behavior.

Consult the interaction design reference when validating workflows under stress, error, or edge-case conditions.

Consult the error-recovery reference when testing validation behavior, recoverable field errors, or abandonment paths.

Consult the loading feedback and perceived performance reference when testing loading states, skeletons, stale-data cues, or perceived-performance behavior.

MANDATORY PREPARATION

Users start this workflow with /test. Once this skill is active, load $frontend-design — it contains design principles, anti-patterns, and the Context Gathering Protocol. Follow that protocol before proceeding — if no design context exists yet, you MUST load $setup first. Additionally gather: the most common UI bugs currently escaping to production, the team's tolerance for test maintenance, and which parts of the UI change most frequently.

Assess Testing Needs

Identify what is breaking and what should be caught:

  1. Map bug escape routes:
  1. Evaluate current coverage:
  1. Prioritize by risk and churn:

Testing Dimensions

Visual Regression

Catch unintended visual changes before they ship.

What to capture:

Baseline discipline:

Anti-flake practices:

Scope boundaries:

Interaction Testing

Validate that user actions produce correct outcomes.

Component-level interactions:

User flow validation:

Test data strategy:

Accessibility Assertions

Embed accessibility validation into the testing pipeline.

Automated checks (run on every build):

Keyboard traversal tests:

Screen reader smoke tests (for critical paths):

Motion and animation:

Test Pyramid for UI

Balance speed, confidence, and maintenance cost:

| Layer | Scope | Speed | Purpose |

|-------|-------|-------|---------|

| Unit (component) | Single component, mocked dependencies | Fast (< 1s) | Logic, rendering, prop handling |

| Integration (component + context) | Component with real providers, stubs | Medium (< 10s) | Interaction behavior, state transitions |

| End-to-end (full browser) | Real browser, real network or stubs | Slow (< 30s per test) | Critical user flows, cross-page behavior |

| Visual regression | Screenshot comparison | Medium (parallelizable) | Unintended visual changes |

Guidance:

Tool Selection

Match the tool to the team's stack and the testing layer:

| Need | Strong options | Considerations |

|------|----------------|----------------|

| Component unit/integration | Vitest + Testing Library, Jest + Testing Library | Framework-agnostic; prefer Testing Library queries that mirror user behavior |

| End-to-end critical flows | Playwright, Cypress | Playwright for speed and cross-browser parallelism; Cypress for simpler setup |

| Visual regression | Chromatic, Loki, Playwright screenshots, Percy | Chromatic for Storybook integration; Playwright for in-house baseline management |

| Accessibility automation | axe-core, @axe-core/react, Playwright + axe | Integrate into CI; treat as warnings, not blockers, until baseline is clean |

| Interaction / user flow | Playwright, Cypress, Storybook Test Runner | Storybook Test Runner for isolated component interactions; Playwright/Cypress for full flows |

Pragmatic rules:

Anti-Patterns

Verify Testing Confidence

Before shipping the testing strategy:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.