Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

front-end-testing

БесплатноБез исполняемых скриптовНе проверен

Behavior-driven UI testing patterns across Vitest Browser Mode, Playwright E2E evidence boundaries, and DOM Testing Library. Use when testing any front-end…

citypaulот citypaul★ 764 звезды на GitHub13 установок в других каталогах

Об этом скилле

Front-End Testing

For React-specific patterns (components, hooks, context), load the react-testing skill. For TDD workflow, load the tdd skill. For general testing patterns (factories, public-interface testing), load the testing skill.

Every hand-back states the harness and where its evidence stops. Whenever you report finished UI test work — the reply, a PR body, a CI step label — name the runner and environment that produced the evidence (Playwright against the served app, Vitest in jsdom, Browser Mode in a real browser) and, in the same breath, the nearest thing it does not prove. A jsdom suite does not prove real rendering, CSS, focus, or the browser's own event dispatch; a component-level suite does not prove the served app, its routing, or the real server; one journey does not prove the paths it never walks. "All tests pass" with the boundary left unsaid reads as a stronger claim than the tests support.

Deep-dive resources are in the resources/ directory. Load them on demand:

Resource Load when...
resources/playwright-e2e.md Writing or auditing Playwright Test E2E/user-journey suites against a running app — who may initiate requests, observing network without performing it, the direct-transport audit, auth/lifecycle evidence
resources/async-patterns.md Using findBy/waitFor/waitForElementToBeRemoved, testing loading states, debounce, or reviewing waitFor usage
resources/msw.md Mocking APIs — full setupWorker (Browser Mode) and setupServer (Node/jsdom) setup, per-test overrides
resources/dom-testing-library-legacy.md Working in a jsdom/@testing-library/dom codebase — screen object, fireEvent vs userEvent, jest-dom matchers, ESLint plugins

Core Philosophy

Test behavior users see, not implementation details. This applies in every environment — Browser Mode, jsdom, anything.

Your UI has two users:

  1. End-users: Interact through the DOM (clicks, typing, reading text)
  2. Developers: You, refactoring implementation

Kent C. Dodds principle: "The more your tests resemble the way your software is used, the more confidence they can give you."

False negatives (tests break on refactor):

// ❌ WRONG - Coupled to state implementation; breaks when state → signals → stores
it('should update internal state', () => {
  const component = new CounterComponent();
  component.setState({ count: 5 });
  expect(component.state.count).toBe(5);
});

False positives (bugs pass tests):

// ❌ WRONG - Button exists but onClick is broken; test still passes
it('should render button', () => {
  render('<button data-testid="submit-btn">Submit</button>');
  expect(screen.getByTestId('submit-btn')).toBeInTheDocument();
});

✅ CORRECT - Drive the UI the way a user would, assert what the user sees: type into labelled fields, click the submit button, assert the submit handler received the form data. This survives refactors, tests the contract, and catches real bugs (broken onClick, validation errors).


Vitest Browser Mode for Browser-Observable Behaviour

Prefer Vitest Browser Mode when the claim depends on real rendering, CSS, events, focus management, accessibility, or browser APIs and the repository already supports it or the added harness cost is justified. Keep an existing stable jsdom/happy-dom harness, or use a lighter environment, when it proves pure logic or component contracts without browser-specific behaviour.

Why Browser Mode Over jsdom

Aspect jsdom/happy-dom Browser Mode
Environment Simulated DOM in Node.js Real browser (Chromium/Firefox/WebKit)
CSS Not rendered Real CSS rendering, layout, computed styles
Events Synthetic JS events CDP-based real browser events
APIs Subset of Web APIs Full browser API surface
Focus/a11y Approximate Real focus management, accessibility tree
Debugging Console only Full browser DevTools

Setup

Inspect the repository's package manager, lockfile, existing test harness, and installed versions before changing dependencies or configuration. If a new harness is justified and the user has authorized setup, select exact mutually compatible versions from the official compatibility/peer-dependency evidence, install them with the repository package manager, and invoke only the repository-local binaries (no implicit download). For example:

<repo-pm> add --save-dev vitest@<reviewed-version> @vitest/browser-playwright@<reviewed-version>
<repo-pm> exec playwright install chromium  # inspect this binary download before authorizing it
// vitest.config.ts
import { defineConfig } from 'vitest/config'
import { playwright } from '@vitest/browser-playwright'

export default defineConfig({
  test: {
    browser: {
      enabled: true,
      provider: playwright(),
      headless: true,
      instances: [{ browser: 'chromium' }],
    },
Полный SKILL.md на GitHub

Установить front-end-testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

resources/async-patterns.mdresources/dom-testing-library-legacy.mdresources/msw.mdresources/playwright-e2e.md

FAQ

Что делает скилл front-end-testing?

Behavior-driven UI testing patterns across Vitest Browser Mode, Playwright E2E evidence boundaries, and DOM Testing Library. Use when testing any front-end application, writing UI or end-to-end tests, querying DOM elements, simulating user interactions, or choosing the lightest harness that proves a browser-observable claim. For React-specific patterns, see the react-testing skill.

Как установить скилл front-end-testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл front-end-testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить front-end-testing с