Skip to content

Instantly share code, notes, and snippets.

@ErikGMatos
Last active June 7, 2022 01:02
Show Gist options
  • Save ErikGMatos/51cd7dba72a66eda889e050be1359a5d to your computer and use it in GitHub Desktop.
Save ErikGMatos/51cd7dba72a66eda889e050be1359a5d to your computer and use it in GitHub Desktop.
import { waitFor, screen } from '@testing-library/react';
describe('Component X', async () => {
it('should render the component and to wait for something', async () => {
// to mount the component
// here you wait for some element/text
await waitFor(() => {
expect(screen.getByText('some string')).toBeInTheDocument();
}, {
timeout: 5000 // miliseconds
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment