-
Notifications
You must be signed in to change notification settings - Fork 725
Closed
Labels
good first issue 🏁Good for newcomersGood for newcomers
Description
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Following the example https://github.com/testing-library/testing-library-docs/blob/main/docs/react-testing-library/example-intro.mdx
- On Line 96
await waitFor(() => screen.getByRole('heading'))
- Throws the eslint error
Prefer `findByRole` query over using `waitFor` + `getByRole`
Expected behavior Expect to wait until "heading" element is rendered by the Fetch.js component (see step 1 example for file)
- OS: Windows 10
Additional context
When using the CLI fix recommendation, it changes the line to read
await screen.findByRole("heading");
However, the same error is thrown.
Additional Resources
https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#using-waitfor-to-wait-for-elements-that-can-be-queried-with-find
timdeschryver
Metadata
Metadata
Assignees
Labels
good first issue 🏁Good for newcomersGood for newcomers