From ef56dce244218091f819bfaeac06c4b985004de5 Mon Sep 17 00:00:00 2001 From: Nick Lefever Date: Fri, 13 Nov 2026 18:58:45 +0000 Subject: [PATCH] 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 --- packages/rn-tester/visual-tests/flows/scroll-view.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/rn-tester/visual-tests/flows/scroll-view.yml b/packages/rn-tester/visual-tests/flows/scroll-view.yml index 27f484746d8..fef36d4611e 100644 --- a/packages/rn-tester/visual-tests/flows/scroll-view.yml +++ b/packages/rn-tester/visual-tests/flows/scroll-view.yml @@ -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: