-
Notifications
You must be signed in to change notification settings - Fork 156
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
feat: Adds extra selectors to the test utils #2932
feat: Adds extra selectors to the test utils #2932
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2932 +/- ##
=======================================
Coverage 96.24% 96.24%
=======================================
Files 769 769
Lines 21722 21726 +4
Branches 7371 7430 +59
=======================================
+ Hits 20907 20911 +4
Misses 762 762
Partials 53 53 ☔ View full report in Codecov by Sentry. |
de75033
to
5e25a4b
Compare
5e25a4b
to
2bc4260
Compare
0142e34
to
f7fd88e
Compare
2c6f204
to
369a0c5
Compare
95b2b79
to
dbf99f5
Compare
dbf99f5
to
be2ffae
Compare
44ecbba
to
a7dcd25
Compare
common: { | ||
// These components are not meant to be present in multiple instances in a single app. | ||
// For this reason no findAll and findByTestId finders will be generated for them. | ||
noExtraFinders: ['AppLayout', 'TopNavigation'], |
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.
A bit more context on this: The "root" element of these two components behave differently. For example for the top navigation:
<div data-testid="assiged-by-user">
<div>
<div class="awsui-hashed-root-class">
...
</div>
</div>
</div>
So data-testid
is the rootClass
has are not assigned to the same element. This means findTopNavigationByTestId
will never return any result and might make the users confused.
Since these two components are also not meant to be multiple in a single app, we decided to keep these two as exceptions. They won't receive findAllXX
and findXXByTestId
finders.
We'll address them separately later as it might need a change to the component itself.
a7dcd25
to
50f534a
Compare
50f534a
to
4406433
Compare
Description
Adds two new test utils selectors to each component wrapper.
find[COMPONENT_NAME]ByTestId(testId: string)
findAll[COMPONENT_NAME]s()
Depends on cloudscape-design/test-utils#74 (This is why the Github checks are failing)
Followed by #2944
Related links, issue #, if available: Test utils API improvements project
How has this been tested?
✅ This PR: #2944
💹 Copies including the JSDocs and the pluralizations have been reviewed by the content team.
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md
.CONTRIBUTING.md
.Security
checkSafeUrl
function.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.