Skip to content

Conversation

@shawnesquivel
Copy link

By implementing tis change, the eslint suggestion "Prefer findByRole query over using waitFor + `getByRole" is removed. The change implements the recommended suggestions by these two articles, which is the same as the automatic command line "quickfix." [1] https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
[2] https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#using-waitfor-to-wait-for-elements-that-can-be-queried-with-find

By implementing tis change, the eslint suggestion "Prefer `findByRole` query over using `waitFor` + `getByRole" is removed. The change implements the recommended suggestions by these two articles, which is the same as the automatic command line "quickfix."
[1] https://github.com/testing-library/eslint-plugin-testing-library/blob/main/docs/rules/prefer-find-by.md
 [2] https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#using-waitfor-to-wait-for-elements-that-can-be-queried-with-find
@netlify
Copy link

netlify bot commented Dec 13, 2022

Deploy Preview for testing-library ready!

Name Link
🔨 Latest commit c0c36b3
🔍 Latest deploy log https://app.netlify.com/sites/testing-library/deploys/6398fa565dd02c0009e0dbf8
😎 Deploy Preview https://deploy-preview-1189--testing-library.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
Could you also update the other examples on this page?
For example on line 113, 139, and 213.

fireEvent.click(screen.getByText('Load Greeting'))

await waitFor(() => screen.getByRole('heading'))
await screen.findByRole('heading')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The waitFor import on line 77 can be removed.

@ledenis
Copy link
Contributor

ledenis commented Apr 15, 2023

I think this could be closed in favor of #1242

@timdeschryver
Copy link
Member

You're right, thanks @ledenis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants