diff --git a/packages/react/src/Alert/Alert.test.tsx b/packages/react/src/Alert/Alert.test.tsx index ecc1331366..82cd201905 100644 --- a/packages/react/src/Alert/Alert.test.tsx +++ b/packages/react/src/Alert/Alert.test.tsx @@ -55,10 +55,9 @@ describe('Alert', () => { it('renders the close button with a label', () => { const { container } = render() - const component = container.querySelector(':only-child') - const closeButton = component?.querySelector('.ams-icon-button') + const closeButton = screen.getByRole('button', { name: 'Close' }) - expect(closeButton).toHaveTextContent('Close') + expect(closeButton).toBeInTheDocument() }) it('fires the onClose event when the close button is clicked', () => {