Testing library (React): Selecting text in multiple HTML elements

<h3>Hello <strong>World</strong></h3>

*ByRole

screen.getByRole('heading', { name: 'Hello World' });

or.toHaveTextContent

expect(screen.getByTestId('my-id')).toHaveTextContent('Hello World');