0Pricing
React Academy · Lesson

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

  1. React Testing Library + Vitest/Jest Setup
  2. Queries, Events, Assertions — Forms & Async UI
  3. Mocking Fetch & Timers
← Back to React Academy