Queries, Events, Assertions — Forms & Async UI
Use getBy/findBy queries, user-event for typing/clicks, and jest-dom assertions. Test forms and async screens with confidence.
User-focused testing
Goal: Test like a user.
- Queries: getBy*/findBy*
- Events: user-event (click, type)
- Assertions: jest-dom
Queries: pick the right one
- getBy*: sync; fails if missing
- findBy*: async; waits
- queryBy*: returns null when missing
- Prefer role/label over test IDs
All lessons in this course
- React Testing Library + Vitest/Jest Setup
- Queries, Events, Assertions — Forms & Async UI
- Mocking Fetch & Timers