-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[No QA] Use displayName for testID #27978
Conversation
Hey! I see that you made changes to our Form component. Make sure to update the docs in FORMS.md accordingly. Cheers! |
@ Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosWebMobile Web - ChromeMobile Web - SafariDesktopiOSAndroid |
# Conflicts: # src/pages/TeachersUnite/ImTeacherPage.js
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.3.73-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.73-1 🚀
|
🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.3.74-0 🚀
|
@@ -171,7 +171,7 @@ class SearchPage extends Component { | |||
return ( | |||
<ScreenWrapper | |||
includeSafeAreaPaddingBottom={false} | |||
testID="SearchPage" | |||
testID={SearchPage.displayName} |
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 is class component so displayName
cannot be set according to lint rule:
Class components must not set the displayName property.
(rulesdir/display-name-property)
So testID={undefined}
for now and showing console error:
Failed prop type: The prop testID is marked as required in ScreenWrapper, but it's value is undefined
@roryabraham Which option do you suggest for class components?
- revert back to hardcoded name -
testID="SearchPage"
- make
testID
optional - remove
displayName
lint rule in class component - Any better option?
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.
remove displayName lint rule in class component
This one. Let's set displayName
everywhere. It's more consistent and also class components are going to soon be a thing of the past so I don't think we need to optimize the DX for them so much.
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.
Then maybe we need to revert lint rule that every component (both function and class) requires displayName?
This way, we won't miss any component missing testID and console error won't happen again.
i.e. #28334
🚀 Deployed to production by https://github.com/chiragsalian in version: 1.3.74-3 🚀
|
Details
https://expensify.slack.com/archives/C9YU7BX5M/p1695351823567809?thread_ts=1692292292.149339&cid=C9YU7BX5M
Fixed Issues
$ n/a
Tests
Run the web app and verify that data-testID is set correctly
Offline tests
None
QA Steps
None
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android