Sample react-native app to verify testID replacement to resource-id while test automation on android device. Please use UI Automator Viewer tool to test this feature. changes to react-native master at facebook/react-native#29610
Verified below componets with testID and accessibilityLabel props.
- View
- Text
- Image
- ScrollView
- StausBar
- Flatlist
How to use
- Make sure your project is on react-native 0.64.0 version
- Add the above props to your component like below For ex: <View style={styles.sectionContainer} testID={"main-view"} accessibilityLabel={"titleView"}>
- Build and run your app in emulator/actual device
- Open uiautomatorviewer.bat file from the below path C:\Users\xyz\AppData\Local\Android\Sdk\tools\bin (in my windows machine this is the path. Please check yours)
- Once uiautomatorviewer is launched please click on the icon "Device screeshot" from the top left screen of the tool
- then in the top right side of the tool you see all of your component nodes, please select the one where you have used testID props
- Now you should see testID is mapped to resource-id and acessibilityLabel mapped to content-desc. this is there in bottom right side of your tool.
NOTE:
TextInput component does not work.