web-testing-react-testing-library
Installation
SKILL.md
React Testing Library Patterns
Quick Guide: Query through the accessibility tree (
getByRolefirst,getByTestIdlast), drive interactions withuserEventrather thanfireEvent, and reach forfindBy*whenever the element arrives asynchronously.userEventhas been async andsetup()-first since v14, so every call is awaited. The library renders and interacts; the assertion API, mock functions and fake timers come from whatever test runner is executing the file.
Detailed Resources:
- examples/core.md — query hierarchy, choosing between role, label, text and test id
- examples/user-events.md — typing, clicking, keyboard shortcuts, tab order, and the cases fireEvent still covers
- examples/async-testing.md —
findBy*,waitFor,waitForElementToBeRemoved - examples/custom-render.md — a render wrapped in the app's providers, with per-test initial state
- examples/hooks.md —
renderHook,rerender,unmount, wrappers, hooks that throw - examples/accessibility.md — keyboard navigation, ARIA attributes, live regions, focus trapping
- examples/scoped-queries.md —
within()for tables, cards, sections and modals - examples/configuration.md — fake timers, pointer-events checks, timeout overrides
- reference.md — query and role tables, userEvent methods, keyboard syntax, matcher list, debug checklist