Skip to content

Target the SectionList viewability item by test ID - #58991

Closed
Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D124664726
Closed

Abbondanzo wants to merge 1 commit into
react:mainfrom
Abbondanzo:export-D124664726

Conversation

@Abbondanzo

Copy link
Copy Markdown
Contributor

Summary:
Locate Brownie by its existing testID in the horizontal SectionList viewability flow rather than its rendered text. Keep the scrolling parameters and viewability callback assertions unchanged.

Changelog: [Internal]

Differential Revision: D124664726

Summary:
Locate `Brownie` by its existing `testID` in the horizontal SectionList viewability flow rather than its rendered text. Keep the scrolling parameters and viewability callback assertions unchanged.

Changelog: [Internal]

Differential Revision: D124664726
@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 11, 2026
@meta-codesync

meta-codesync Bot commented Oct 11, 2026

Copy link
Copy Markdown

@Abbondanzo has exported this pull request. If you are a Meta employee, you can view the originating Diff in D124664726.

@meta-codesync meta-codesync Bot closed this in 85065b3 Oct 12, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 12, 2026
@meta-codesync

meta-codesync Bot commented Oct 12, 2026

Copy link
Copy Markdown

This pull request has been merged in 85065b3.

@Abbondanzo
Abbondanzo deleted the export-D124664726 branch October 12, 2026 03:08
meta-codesync Bot pushed a commit that referenced this pull request Oct 23, 2026
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

Pull Request resolved: #59395

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 #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.

Reviewed By: javache

Differential Revision: D127135564

Pulled By: cipolleschi

fbshipit-source-id: 675aba648bf343358aeea9cbdd359d8b5eb3b56f
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. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant