Finding elements with React Testing Library queries Course
Become familiar with all the ways to find elements in your rendered components with React Testing Library. This is a more in depth look at all the getBy, findBy and queryBy functions
Course Lessons
17 lessons to learn everything about Finding elements with React Testing Library queries
React Testing Library queries intro
Intro to React Testing Library queries
Welcome to this course on React Testing Library queries
GetBy, QueryBy, FindBy
The difference between GetBy, QueryBy, FindBy
Single vs Multiple queries
Learn how to select either a single element, or multiple elements
Picking a query function by priority
How to pick the most suitable query to get an element
Accessing queries with the screen object
How to get the functions that we need to query for elements, via the screen object
Common query options (except TextMatch)
Some common query options that are on multiple query functions
TextMatch in detail
Explaining what TextMatch is
Getting direct access to the DOM
How to get elements in the DOM with regular functions, like document.querySelector
React Testing Library queries
ByRole (common uses)
All of the common uses for the ByRole queries: how to use them and how to find which roles to query by
ByRole (less common uses)
This lesson covers the remaining configuration options for the ByRole query
ByLabelText
Covering the ByLabelText queries: how to find form elements via their labels
ByPlaceholderText
Everything you need to know about the byPlaceholderText queries, how to use it to find input elements by their placeholder text
ByText
How to use the byText queries to find elements by their text content
ByDisplayValue
Lesson on the byDisplayValue queries, how to use it to find form elements by their current display value
ByAltText
Query for images by using the byAltText queries
ByTitle
Learn how to use the byTitle queries, how to use it to find elements by their title attribute
ByTestId
As a fallback, use the byTestId queries to target elements with data-testid, how to use it to find elements by their data-testid attributes