score:0

You can do the ff instead:

expect(stuff.textContent).toBe('100')

score:1

Get the the text using innerHTML

const element = await waitFor(() => document.querySelector('<YOUR_QUERY>'));

expect(element.innerHTML).toEqual('100')

score:1

Use getByText like so,

const { getByText } = render(<YourComponent />)

expect(getByText('text you\'re looking for')).beInTheDocument()

This assumes it will be there, so if there's a chance it won't be, use queryByText.


Related Query

More Query from same tag