[Android] ScrollView: handling testID correctly for horizontal scroll view#48254
[Android] ScrollView: handling testID correctly for horizontal scroll view#48254mateoguzmana wants to merge 2 commits intofacebook:mainfrom
testID correctly for horizontal scroll view#48254Conversation
|
|
…iew and reverting the test id prop setter overwrite
testID propertytestID correctly for horizontal scroll view
@javache thanks to your observation, I went back and checked the full flow and actually the methods were called correctly. When doing my fix I did some clean up in the repro example and actually made me think it got fixed (my mistake during testing 😄) With the above said, I narrowed down the issue and discovered it only happens when we use a horizontal scroll view. For the vertical one it was working already correctly. I've updated the PR info as well to reflect this, used also Appium to double check it's not a problem of a single e2e tool. |
javache
left a comment
There was a problem hiding this comment.
Awesome, thanks for digging in!
|
@javache has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
This pull request was successfully merged by @mateoguzmana in 81c74cd When will my fix make it into a release? | How to file a pick request? |
Summary: Follow up from #48271 and #48254, I noticed that the Modal component also doesn't map the `resource-id` from the `testID` on Android. This PR addresses that. ## Changelog: [ANDROID] [FIXED] - Modal: Setting `resource-id` from `testID` prop Pull Request resolved: #48313 Test Plan: Alternatively do: ``` $ adb shell uiautomator dump UI hierchary dumped to: /sdcard/window_dump.xml $ adb pull /sdcard/window_dump.xml /sdcard/window_dump.xml: 1 file pulled, 0 skipped. 1.1 MB/s (3505 bytes in 0.003s) ``` and check in XML: ` resource-id="playground-modal" class="android.view.ViewGroup" ` ------- Using Appium, check that the `testID` prop passed from JS is mapped as `resource-id` in the rendered view group of the Modal. <details> <summary>Example of the code implementation in the RNTester Playground:</summary> ```tsx function Playground() { const [modalVisible, setModalVisible] = React.useState(false); return ( <> <Modal visible={modalVisible} testID="playground-modal"> <Text testID="inner-text-test-id">Hello World!</Text> </Modal> <Button title="Open Modal" onPress={() => { setModalVisible(true); }} /> </> ); } ``` </details> <details> <summary>Output in Appium Inspector:</summary> <img width="913" alt="image" src="https://github.com/user-attachments/assets/514ae2b3-35a8-4a1a-8efc-1ca6bd73f189" /> </details> Reviewed By: javache Differential Revision: D67369350 Pulled By: alanleedev fbshipit-source-id: a799ad5b974895a39d9287e3d76d1139a6ef6a83
Summary:
Fixes #46180
This PR fixes the
testIDnot being set as aresource-idin theHorizontalScrollView.Currently the
resource-idis being set correctly when we use a vertical scroll view (this is done here for reference) but we still miss setting this when we use a horizontal one as the managers for both components are different.Changelog:
[ANDROID][FIXED] - Handling
testIDcorrectly for horizontal scroll viewTest Plan:
Render a simple
ScrollViewcomponent withhorizontalset astrueand pass atestIDproperty as shown:Open Maestro Studio and search for customScrollViewTestId in the search bar.
Before the fix: The `testID` is not found. (See screenshot)
See the same in Appium. (See screenshot)
Apply this fix, and search again in Maestro Studio.
After the fix: The `testID` is now recognised and can be found in the search bar. (See screenshot)
See the same in Appium. (See screenshot)