Skip to content

Fix flaky sectionlist-viewability E2E flow on iOS - #59395

Closed
cipolleschi wants to merge 1 commit into
react:mainfrom
cipolleschi:cipolleschi/fix-sectionlist-viewability-e2e
Closed

cipolleschi wants to merge 1 commit into
react:mainfrom
cipolleschi:cipolleschi/fix-sectionlist-viewability-e2e

Conversation

@cipolleschi

Copy link
Copy Markdown
Contributor

Summary:

test_e2e_ios_rntester on main keeps failing on sectionlist-viewability.yml, with No visible element found: id: Brownie on all 5 attempts. It isn't a recent regression: the same flow has failed this way regularly on main since at least Oct 8.

Root cause. In the horizontal waitForInteraction step, scrollUntilVisible scrolls until Brownie is centered, with a 60s timeout:

  • With direction: RIGHT, Maestro (2.6.1, UiElement.isElementNearScreenCenter) counts an element as centered only when its center is left of centerX + width/5, which is 70% of the screen width. Brownie is the last item of the list, so its center can never get that far left (it ends at about 85% of the width).
  • When the element is visible but not centered, Maestro spends maxRetryCenterCount (4+1) more swipes before falling back to the plain visibilityPercentage check.
  • On CI each swipe moves the list by about one item and takes ~3–4s. In the recorded failure (Release, run 39903033948), scrolling starts at ~104s of the video and only reaches the end of the list at ~162s, about 58s into the 60s budget. The step then times out during the extra centering swipes, even though Brownie is fully on screen.

Whether it passes depends on runner speed, so the flow is flaky. flatlist-viewability.yml has the same structure but targets Cheesecake, the second-to-last item, and it rarely fails.

Fix.

  • Target Cheesecake, like the FlatList flow does. It reaches the center zone, and it's the item the next step asserts on (output contains Cheesecake).
  • Raise the step timeout to 120s, to give the full traverse some headroom.

The Android-only vertical block is unchanged; it passes on Android.

Changelog:

[INTERNAL] [FIXED] - Fix flaky sectionlist-viewability E2E flow on iOS

Test Plan:

  • Looked through the iOS RNTester E2E jobs of ~225 main runs from Oct 8–22. sectionlist-viewability is by far the most common hard failure, in both Debug and Release, before and after Target the SectionList viewability item by test ID #58991 switched the selector from text to testID.
  • Pulled frames from the failure recording (e2e_ios_…_report_Release_NewArch) to confirm the timeline above. The last frame shows the list scrolled to the end, with Cheesecake and Brownie fully visible and the output showing Cheesecake, Brownie.
  • I couldn't run Maestro locally because the network policy on my machine blocks Maestro's localhost connection to its XCTest driver. The test_e2e_ios_rntester jobs on this PR verify the change.

The horizontal waitForInteraction step scrolled until the last item
(`Brownie`) was centered, with a 60s timeout. With `direction: RIGHT`,
Maestro only considers an element centered once its center is left of
70% of the screen width, which the last item of the list can never reach.
Maestro then needs 5 extra swipes before falling back to the plain
visibility check. On CI each swipe moves the list by about one item and
takes ~3-4s, so just reaching the end of the list takes ~58s, and the
step times out during those extra swipes whenever the runner is slow.

Target `Cheesecake` instead, like the FlatList viewability flow does: it
does reach the center zone, and it's the item the next step asserts on.
Also raise the timeout to 120s, to give the full traverse some headroom.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2026
@meta-codesync

meta-codesync Bot commented Oct 23, 2026

Copy link
Copy Markdown

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D127135564.

@meta-codesync meta-codesync Bot closed this in ffd341a Oct 23, 2026
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @cipolleschi in ffd341a

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Oct 23, 2026
@meta-codesync

meta-codesync Bot commented Oct 23, 2026

Copy link
Copy Markdown

@cipolleschi merged this pull request in ffd341a.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants