getBy
getBy is a family of query functions used in the DOM Testing Library and React Testing Library to retrieve a single element from the rendered DOM during tests. These are synchronous queries that throw an error when no element matches or when more than one element matches, helping to catch missing or ambiguous elements early in test runs.
Common variants include getByText, getByRole, getByLabelText, getByPlaceholderText, getByDisplayValue, getByAltText, and getByTestId. They reflect how users typically
Usage considerations: getBy... queries model user interactions and accessibility semantics rather than relying on internal DOM