testID, accessibilityLabel information not visible in Appium (Android only)
See original GitHub issueDescription
When inspecting a react-native app on Android via Appium, testing identifiers like testID
or accessibilityLabel
sometimes appear and sometimes don’t. There is no major difference in how nested the elements are for when they appear and when they don’t - they just sometimes don’t. This is not an issue on iOS, everything works fine there.
Whether, as has been mentioned in various places, I put testID
, testID
& accessibilityLabel
or just accessibilityLabel
the issue is there. Whether or not I add the prop of accessible={true}
or not, the issue is there.
React Native version:
OS: macOS 10.15.7
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Memory: 59.60 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 13.12.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK:
API Levels: 26, 28, 29
Build Tools: 28.0.3, 29.0.2, 29.0.3
System Images: android-23 | Google APIs Intel x86 Atom, android-25 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_265 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found```
## Steps To Reproduce
Create a react native app, set up tests via `jest` and `appium` (as can be seen in countless different places online) and simply provide the testing props on a view `testID`, `accessibilityLabel` and for the test use `driver.hasElementByAccessibilityId()` function.
## Expected Results
The element is found based on the accessibility information I provide. Tests may fail due to various other appium issues (namely the driver limitations on the Android side) but the elements should be found.
## Snack, code example, screenshot, or link to a repository:
Sample React-Native View:
```return (
<>
<View
testID="container"
>
<Text testID="testText">Test</Text>
</View>
</>
);```
Sample Test code:
expect(await driver.hasElementByAccessibilityId(‘container’)).toBe(true); expect(await driver.hasElementByAccessibilityId(‘testText’)).toBe(true);
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to set the testID and the accessibilityLabel together with ...
If the testID is set together with the accessibilityLabel, the iOS app does not show the "accessibility id" in the component but the...
Read more >React Native UI element access via testID - Appium Discuss
I'm developing some iOS/Android apps using React Native. React Native Views (https://facebook.github.io/react-native/docs/view.html) can have a testID value ...
Read more >An end to the abuse of Accessibility IDs - DEV Community
We've long had the ability to specify a testID in React Native components for quite a while now, the problem was that Appium...
Read more >How to Test React Native Apps using Appium | BrowserStack
To ensure that there is consistency when testing both Android and iOS versions of the application, it is a good practice to add...
Read more >React-Native and unique identifiers - TIPS AND TRICKS
Through Appium, this testID attribute is exposed directly as "name" when working ... To add testability to Android, the "accessibilityLabel" could be used....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Facing the same issue
0.64.2
Any update for IOS on this ?