Wait for the horizontal ScrollView to start scrolling before its visual screenshots

Summary:
The `scroll-view/horizontal-scroll-to` visual test taps a button that scrolls with an animation, then runs `waitForAnimationToEnd` and takes a screenshot. `waitForAnimationToEnd` returns as soon as two consecutive frames are the same, so if the animated scroll hasn't started yet when it first looks, it returns at once and the screenshot catches the position from before the tap. On iOS this has produced a `start` screenshot that is identical to the `end` one, and `end` screenshots taken at the start position or mid-scroll.

After each tap, wait for an item that is only on screen once the scroll has moved there (`Item 11` at the end, `Item 0` at the start), then wait for the animation to end as before. The horizontal ScrollView spans the screen, so the other end's items are off screen and the wait can't pass before the scroll moves.

The vertical `scroll-to` and `sticky-header` steps are left as they are: their items below the 200pt ScrollView are still on screen, and Maestro only drops elements that are outside the screen, not ones clipped by a parent, so the same wait would pass immediately there.

Changelog: [Internal]

Differential Revision: D131824504

Pull Request resolved: https://github.com/react/react-native/pull/60001
This commit is contained in:
Nick Lefever authored and GitHub committed 2026-11-13 18:58:45 +00:00
1 parent 649c1054e7
commit ef56dce244
1 file changed
+10
@@ -34,6 +34,12 @@ appId: ${APP_ID}
timeout: 15000
- tapOn:
id: 'scroll_to_end_button'
# waitForAnimationToEnd returns at once if the scroll hasn't started yet, so
# wait for an item that is only on screen once it has.
- extendedWaitUntil:
visible:
text: 'Item 11'
timeout: 5000
- waitForAnimationToEnd:
timeout: 5000
- takeScreenshot:
@@ -42,6 +48,10 @@ appId: ${APP_ID}
id: 'scroll_horizontal'
- tapOn:
id: 'scroll_to_start_button'
- extendedWaitUntil:
visible:
text: 'Item 0'
timeout: 5000
- waitForAnimationToEnd:
timeout: 5000
- takeScreenshot: