React Testing Library · Matcher
toBeInTheDocument
Use toBeInTheDocument to check that an element is in the document. Use its negated form with queryBy when checking that an element is absent.
Last updated
Syntax
expect(screen.queryByRole('button', { name: 'Submit' })).not.toBeInTheDocument()In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
queryByqueryAllBygetBytoBeNull@testing-library/jest-dom