Visitar URL original
ref(tests): Use screen for querying in RTL by matejminar · Pull Request #29312 · getsentry/sentry · GitHub
Skip to content

ref(tests): Use screen for querying in RTL - #29312

Merged
matejminar merged 2 commits into
masterfrom
ref/rtl-screen
Oct 15, 2021
Merged

matejminar merged 2 commits into
masterfrom
ref/rtl-screen

Conversation

@matejminar

@matejminar matejminar commented Oct 14, 2021 •

Copy link
Copy Markdown
Member

The benefit of using screen is you no longer need to keep the render call destructure up-to-date as you add/remove the queries you need. You only need to type screen. and let your editor's magic autocomplete take care of the rest.

screen was added in react testing library v9.

This is now the preferred/suggested way of querying by the library author.

@matejminar
matejminar marked this pull request as ready for review October 14, 2021 10:52
@matejminar
matejminar requested review from a team and removed request for a team October 14, 2021 10:52
@priscilawebdev

Copy link
Copy Markdown
Member

Nice... thanks @matejminar 🙏

This is now the preferred/suggested way of querying by the library author.

would you have a link to share? I'd love to read more about it

@matejminar

Copy link
Copy Markdown
Member Author

@priscilawebdev he talks about it in the course and it's also mentioned in this article: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen

This branch was successfully deployed

2 active deployments
Preview – sentry — ba67acba Deployed Oct 15, 2021 by vercel[bot]
Preview – storybook — ba67acba Deployed Oct 15, 2021 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants