Testing library (React): Selecting text in multiple HTML elements
<h3 data-testid="hello-header">Hello <strong>World</strong></h3> *ByRole screen.getByRole('heading', { name: 'Hello World' }); or.toHaveTextContent expect(screen.getByTestId('hello-header')).toHaveTextContent('Hello World');
Oct 16, 20241 min read1