If you're using Testing Library, you're certainly using the *ByRole
functions to query for elements rendered by your test.
However, it's not always obvious what arguments to use when using the *ByRole
functions. Luckily, there is a feature in the Chrome DevTools that will show you the role and accessable name of a selected element in the elements panel.
There's an example image in the gist box below.
Now you can see exactly what to query by. In this particular example, it might look something like this:
expect(screen.getByRole('combobox', { name: /search/i })).toBeInTheDocument();
Happy testing!