-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
RN: Add accessibility labels to OnDeviceUI #1780
Conversation
Main motivation for this is so that Appium[1] can inspect and automate the UI rendered by Storybook. The two added properties are * accessibilityLabel[2] for Android * testID[3] for iOS [1] http://appium.io/ [2] https://facebook.github.io/react-native/docs/view.html#accessibilitylabel [3] https://facebook.github.io/react-native/docs/view.html#testid
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.
LGTM. I really wish react-native would make testid work on both...
Codecov Report
@@ Coverage Diff @@
## release/3.3 #1780 +/- ##
============================================
Coverage 23.14% 23.14%
============================================
Files 253 253
Lines 5756 5756
Branches 695 689 -6
============================================
Hits 1332 1332
+ Misses 3930 3919 -11
- Partials 494 505 +11
Continue to review full report at Codecov.
|
Been using these new IDs for automated screenshot testing of my Storybook stories. Works great. I recently ran into a limitation: if the list item is far off the screen, then the ID cannot be found. I suppose this is some kind of lazy-rendering optimization in React Native, although I thought only FlatList's lazily rendered, and not ListView's. I could in theory scroll the story list, which would be a pain, but I would still need a test ID on the ListView. I wonder if anyone has any ideas....? |
@hellogerard yes, ran in to the same problem. didn't follow through on my automation efforts yet, but if I do I will probably employ the strategy you mentioned:
... Another option would be to add a search field that allows (also automated scripts) to search for components ? |
This adds two added properties,
accessibilityLabel
(for Android) andtestID
(for iOS) to theOnDeviceUI
controls of the component.Main motivation for this is so that Appium can inspect and automate the UI rendered by Storybook (for automation testing, buy mainly screenshotting).
The values are just two strings that uniquely identify the component (similar to
id
in DOM land). The strings I'm proposing here kind of follow a namespaced internal approach that has proven useful in the future. Also happy to change the strings to something else, if need be.