/web:frontend-testingfrom web
Writes behavior-first DOM Testing Library tests for non-React UI (Vue, Svelte, Angular, web components, vanilla JS/TS) in Vitest or Jest with jsdom. Covers queries, accessible names, userEvent, async results, network stubs, and false-positive assertions. Declines e2e journeys, visual appearance, and cross-document navigation.
Ships in web. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Write behaviour-first DOM Testing Library tests for UI built without React. For React components, hooks and providers, load web:react-testing. For the TDD workflow, load tdd.
This skill covers tests that run against a DOM inside a test runner, such as Vitest or Jest with jsdom. Decline these parts of a request:
HttpOnly, Secure and SameSite. Reasons: jsdom does not navigate between documents or open real tabs. A real server sets an HttpOnly cookie, and page scripts cannot read it, so document.cookie in jsdom cannot prove it. Exception: jsdom holds a URL and a cookie jar, so a client-side URL or document.cookie check inside one document is in scope.To decline (principle-state-the-scope):
Do not offer a jsdom test that fakes the navigation, the server or the rendering as an equivalent.
@testing-library/dom exports no render. Mount the markup yourself. When a framework wrapper such as @testing-library/vue supplies render, mount through it; this skill still governs the queries and the interactions.
Use the runner, matchers, network stub and helpers the project already has. Do not add a testing dependency or a lint plugin unasked (principle-reuse-before-building).
userEvent from @testing-library/user-event, created with userEvent.setup() in each test. Use fireEvent only for an event that userEvent does not support, or when the project shows that user-event is not installed. In the second case, say that user-event would model the interaction more closely.toBeInTheDocument() and toBeDisabled(). Only when the project shows that its setup does not register jest-dom, assert absence with toBeNull(), text with textContent, and state with the element's own property, such as disabled.server and handlers, otherwise its own stub helper. Override an MSW handler for one test with server.use(...). When the project has an MSW server, do not add a fetch or axios spy. When the code receives its request function by injection, pass a mock for that function.eslint-plugin-testing-library and eslint-plugin-jest-dom are missing, recommend them. Install them only when asked.Test what users see and do through the DOM: clicks, typing and visible text (principle-test-behavior-not-implementation). For each assertion, ask which plausible wrong implementation would still pass. Write the assertion that fails on it.
Mount the real component under test. Let it own its markup and event wiring. Do not read or set its internal state. Do not write your own listener and then assert that it ran. Return a runnable test that imports the code under test. When the task does not give the module path, import from an assumed path beside the test file and say that the path is assumed.
getBy* for state already present, findBy* for state that appears later, queryBy* for absence.screen. Use within(element) to scope a query to one region. Do not bind queries to a container, for example with getQueriesForElement. Do not use a CSS class selector when an accessible query reaches the element.waitFor and every other retrying callback. Put only assertions inside a retrying callback.findBy* or waitFor. Do not put a fixed delay in place of that wait, such as setTimeout, a sleep promise or a fake-timer advance.document.body yourself between tests, for example with document.body.innerHTML = '' in afterEach. Do not call cleanup() in a test file.A role query's name option matches the accessible name, not the text. These roles take a name only from aria-label or aria-labelledby, never from their content: status, alert, region, dialog, navigation and form. Without those attributes they have no name, and { name: /order placed/i } finds nothing. Find such an element by role alone, then assert its text:
const status = await screen.findByRole("status");
expect(status).toHaveTextContent(/order placed/i);
Use this form only when the role first appears in its terminal state. When an earlier state uses the same role, such as a pending status, findByRole returns that earlier element at once. Then retry on the terminal text:
await waitFor(() => expect(screen.getByRole("status")).toHaveTextContent(/order placed/i));
Use { name } for roles named by their content, such as button, link, heading and option. <input type="password"> has no ARIA role, so getByRole('textbox') does not find it. Find it with getByLabelText.
Work down the priority order in queries.md. When an element exposes no role, label, text, alt text or title:
<label>, then an ARIA attribute.getByTestId. Record the reason in a comment beside the query.element.querySelector('canvas') and getAttribute('data-render-count'). screen has no attribute query; screen.getByAttribute does not exist. queryHelpers and buildQueries can build one; do this only for a pattern repeated across many tests.Never assume a role, label or accessible name that the supplied markup lacks; the test then fails on the real component. Never invent a query name. The built-in queries on screen are the eight *By* families in queries.md, each with its get, query, find and All forms.
A test proves a rule only when it observes both sides of that rule.
toHaveBeenCalledTimes(n). toHaveBeenCalledWith(...) proves the arguments of one call, not how many calls happened.queryBy*, which returns null when nothing matches; never with a throwing getBy* inside expect(...).toThrow(). queryBy* still throws when several elements match. Only when the supplied markup can render several matches, use queryAllBy* and assert an empty array. waitForElementToBeRemoved throws when the element is already gone at call time; use it only for a removal that has not happened yet.Read a reference when the task needs its detail:
| Reference | Read for |
|---|---|
| queries.md | Query priority, variants, query mistakes |
| user-events.md | userEvent against fireEvent, userEvent.setup(), clicking, typing, keyboard, fake timers |
| async-testing.md | findBy*, waitFor, waitForElementToBeRemoved; loading states, API responses, debounced inputs |
| msw.md | MSW setupServer, per-test handler overrides |
| anti-patterns.md | Mistakes and fixes, cleanup, ESLint plugin configuration |
| accessibility-first-testing.md | ARIA against semantic HTML |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Vue, Svelte, Angular, Vitest, Jest, TypeScript, JavaScript
dom-testing-library, vitest, jest, jsdom, user-event, accessible-names
npx claudepluginhub mintuz/skills --plugin web10 skills in this plugin
/browser-testingWHEN authoring or repairing real-browser journeys or automated screenshot comparisons with the project's selected runner; NOT DOM-only tests, interactive visual judgement or verification-recipe maintenance; provides native-runner fixtures, assertions and visual-comparison guidance./chatgpt-app-sdkWHEN building ChatGPT apps using the OpenAI Apps SDK and MCP; NOT for OpenAI API chat completions, agent frameworks, or MCP servers with no ChatGPT widget; create conversational, composable experiences with proper UX, UI, state management, and server patterns./cssUSE WHEN writing, fixing or reviewing plain CSS or Sass for a web page, even a one-line change, including a rule that loses to another, a third-party stylesheet you cannot edit, units, spacing between components, shorthands, skip links, hidden and focus styles, or deleting styles that look unused; NOT WHEN the project uses Tailwind (tailwind.config.js, utility classes, CVA variants, Tailwind theme tokens); produces CSS that wins the cascade without ID selectors or reactive !important, scales with the reader's text size, keeps spacing in the parent and deletes styles only on evidence.Other plugins' skills for the same job