Adding Custom Testing Library Queries

Testing Library is great. But it’s lacking a few queries I would find useful.

Here’s an example of enhancing Cypress Testing Library with a plain function:

Testing Library supports formally adding custom queries as well, but a simple function like this is straightforward and does the trick.

This technique is inspired by this issue.