Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose the testID to black-box testing frameworks on Android (#29610)
Summary: There has been a long-standing issue where black-box testing frameworks like Appium and Xamarin UITest have not been able to access the `testID` view prop for Android (see #7135). A natural place for this to be exposed is via a view's `resource-id`. The `resource-id` is what I have used when working on UIAutomator-based tests for native Android apps and is a non-localized, development-only identifier. As mentioned in the linked ticket, you can dynamically set the resource-id using the view's AccessibilityNodeInfo. This change simply checks to see if a testID is provided for a view and then exposes it through the view's accessibility node delegate. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fixes #7135, #9942, and #16137. Display the `testID` as the `resource-id` for black-box testing frameworks Pull Request resolved: #29610 Test Plan: I used the `uiautomatorviewer` tool to verify that the resource-id is populated with the `testID` of a few different views of the RNTester app. <img width="912" alt="Screen Shot 2020-08-10 at 3 38 27 PM" src="https://user-images.githubusercontent.com/875498/89838534-55044100-db20-11ea-9be2-ba507a81f6fb.png"> <img width="1096" alt="Screen Shot 2020-08-10 at 3 40 41 PM" src="https://user-images.githubusercontent.com/875498/89838542-5897c800-db20-11ea-9895-462c6fea1130.png"> Reviewed By: JoshuaGross Differential Revision: D25799550 Pulled By: fkgozali fbshipit-source-id: e64ff1b90fb66b427fce7af533aa94792cfbcad3
- Loading branch information