TextMatch in detail

Most query functions (e.g. getByText() and getByLabelText()) take a TextMatch as their first argument.

screen.getByText(
  'Something Here' // TextMatch arg
);

It can either be:

  • a string (like the example above)
  • a regex
  • or a function

In this lesson we'll go over these and how to use them.

Loading full lesson content & code...

Ready to try running tests for this lesson?