diff --git a/app/soapbox/features/verification/__tests__/registration.test.tsx b/app/soapbox/features/verification/__tests__/registration.test.tsx index fbde2fce3..b408947f6 100644 --- a/app/soapbox/features/verification/__tests__/registration.test.tsx +++ b/app/soapbox/features/verification/__tests__/registration.test.tsx @@ -30,7 +30,10 @@ describe('', () => { fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} }); }); - expect(screen.getByTestId('toast')).toHaveTextContent(/welcome to/i); + await waitFor(() => { + expect(screen.getByTestId('toast')).toHaveTextContent(/welcome to/i); + }); + expect(screen.queryAllByRole('heading')).toHaveLength(0); }); }); @@ -47,7 +50,9 @@ describe('', () => { fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} }); }); - expect(screen.getByTestId('toast')).toHaveTextContent(/this username has already been taken/i); + await waitFor(() => { + expect(screen.getByTestId('toast')).toHaveTextContent(/this username has already been taken/i); + }); }); it('handles generic errors', async() => { @@ -61,7 +66,9 @@ describe('', () => { fireEvent.submit(screen.getByTestId('button'), { preventDefault: () => {} }); }); - expect(screen.getByTestId('toast')).toHaveTextContent(/failed to register your account/i); + await waitFor(() => { + expect(screen.getByTestId('toast')).toHaveTextContent(/failed to register your account/i); + }); }); });