Skip to content
masterclass Buddy

React Testing Library · Concept

screen

Testing Library queries find elements in the DOM. Choose getBy, queryBy, or findBy, plus their All variants, based on match count and whether the result appears asynchronously.

Last updated

Syntax

screen.getByRole(role, options)
screen.queryByText(text, options)
await screen.findByText(text, queryOptions, waitForOptions)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • getByRole
  • getByLabelText
  • findByRole
  • queryByText
  • getAllByText
  • within
  • waitFor
  • user-event

Source: About Queries | Testing Library. Checked 2026-11-03.