-
Notifications
You must be signed in to change notification settings - Fork 4
Replacing the usage of getByTestId and data-testid #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for the pull request, @jacobo-dominguez-wgu! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
a7ef06f to
561c5bb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #30 +/- ##
=======================================
Coverage 94.32% 94.32%
=======================================
Files 44 44
Lines 881 881
Branches 176 176
=======================================
Hits 831 831
Misses 48 48
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
tonybusa
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does well to address the requirement of removing getTestId and improve the querying best practices of React Testing Library. However, it did raise my concern that most of the tests rely on mocking out components. Particularly, mocking out components that exist within the application. We should strive to test the application components as-is as much as possible but that should likely be tracked in a separate issue.
Thanks! I agree we should not be mocking components, I tried to delete some of them but the PR will grow a lot an that was not part of the scope. We definitely should create a new issue to address that. |
arbrandes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a bunch! Not only did you use address the main issue, you also added aria-labels, which is great for accessibility. 👍🏼
Description
This PR modernizes our unit tests by replacing getByTestId queries with more accessible, user-centric testing approaches as recommended by React Testing Library's query priority guidelines . In order to follow those modern standards for testing, all the occurrences of
getByTestIdanddata-testidwere replaced by alternatives likegetByRoleandgetByText.It closes #28
Previous PRs where asked for this change:
feat(authz): [FC-0099] create an custom error boundery #11 (comment)(fixed somewhere else)feat: [FC-0099] allow deleting user's roles #13 (comment)(fixed somewhere else)