Skip to content

bestdeejay-design/agent-skills / skills/frontend-testing

frontend-testing

Verified

Scaffold and advise on frontend testing for production readiness, mapped to the Front-End-Checklist Testing category (13 rules). Defines a testing pyramid (unit, integration, E2E, visual, a11y, cross-browser, real-device, perf-budget, mutation, error-monitoring, coverage, mocking, contract) and emits copy-pasteable configs: Playwright config + smoke specs, axe a11y (jest-axe / @axe-core/playwright), Pact contract tests, and a GitHub Actions perf-budget + coverage CI. Use when the user asks for 'frontend testing', 'test strategy', 'e2e', 'visual regression', 'playwright setup', 'playwright test', 'unit test', 'integration test', 'write tests', 'test generation', 'test coverage', 'regression test', 'perf budget CI', 'accessibility testing in CI', 'contract testing', 'mutation testing', 'настрой тесты фронта', or wants tests before a release. Scaffolds & advises only — does not run your full CI; you wire the configs in. Composes with frontend-perfection, frontend-a11y, frontend-performance, /frontend.

references/visual-regression.md

View on GitHub
# Visual regression testing (rule 4)

Capture screenshots of components/pages and diff them against approved
baselines so unintended visual changes are caught before production.

## Approach

1. **Pick a tool.** Three common options, cheapest first:
   - **Playwright `toHaveScreenshot()`** — zero extra deps, stores PNG baselines
     in `e2e/**/__screenshots__/`, updates with `--update-snapshots`. Good enough
     for most teams.
   - **jest-image-snapshot** — Jest/Vitest matcher, same idea, no browser needed
     if you render to canvas/SSR.
   - **Percy / Argos / Chromatic** — managed, per-pixel + anti-flake + review UI.
     Best when you need a human approval workflow across PRs.

2. **Stabilize the page before shooting** — fixed viewport, seeded data, disable
   animations (`prefers-reduced-motion`), freeze fonts/timestamps. Flaky visuals
   are the #1 cause of noise.

3. **Scope baselines** to key screens + a few components, not every route.

## Playwright example (no extra deps)

```ts
// e2e/visual.spec.ts
import { test, expect } from '@playwright/test';

test('homepage matches baseline', async ({ page }) => {
  await page.goto('/');
  await expect(page).toHaveScreenshot('homepage.png', { fullPage: true });
});

test('pricing card matches baseline', async ({ page }) => {
  await page.goto('/pricing');
  await expect(page.getByTestId('pricing-card')).toHaveScreenshot('pricing-card.png');
});
```

Run / update:
```bash
npx playwright test e2e/visual.spec.ts            # fails on diff
npx playwright test e2e/visual.spec.ts --update-snapshots   # approve new baseline
```

## Managed-service example (Percy)

```ts
import { test } from '@playwright/test';
import percySnapshot from '@percy/playwright';

test('homepage', async ({ page }) => {
  await page.goto('/');
  await percySnapshot(page, 'Homepage');
});
```

Commit baselines to VCS (or the service) and treat a diff as a build-blocking
event in CI. Do NOT rely on visual diffing to catch logic bugs — that is what
E2E/unit own.
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall