Skip to content

ci(ios): fix the flaky Detox e2e tests - #4422

Merged
mfazekas merged 1 commit into
mainfrom
ci/ios-e2e-flakes
Oct 28, 2026
Merged

mfazekas merged 1 commit into
mainfrom
ci/ios-e2e-flakes

Conversation

@mfazekas

Copy link
Copy Markdown
Contributor

Description

Fixes the iOS Detox e2e flakes (about 5% of iOS jobs; every retry passed). Root causes, from the CI logs and #4418 diagnostics, each reproduced locally:

  1. beforeAll timeout (docs(example): add snackSupported example metadata #4416 run): after simctl launch, Detox awaits a simctl get_app_container call that is only used to print a log hint. On CI that call stalled for 2 m 04 s, although the app had already connected. Fix: a yarn patch so Detox doesn't await the hint.
  2. "should finish loading a map" failing on the network: in the docs: state minimum Mapbox Maps SDK version in install docs #4415 run, api.mapbox.com style requests timed out for over 2 minutes; other runs had 7–8 s TLS connects. Detox also waited on the hung request, and the resulting LogBox toasts covered "Show Map", so the next test failed too. Fixes:
    • the Map Loaded example uses a local styleJSON, so the test checks the map, not the network;
    • the tests don't sync on *.mapbox.com requests (setURLBlacklist);
    • LogBox is hidden when the app is launched with e2eIgnoreAllLogs.
  3. "should show click location": the device log shows Detox's touch-down and touch-up 6.8 s apart because of a main-thread stall. The map treats that as a long press, not a tap. Fix: tap again, up to 3 times, until the bubble appears.

I left the timeouts unchanged.

Checklist

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Component to reproduce the issue you're fixing

These are test-only provocations, kept out of the PR. Each was run locally on the ios.debug.ci build and firstTest.e2e.js:

Provocation Before After
NODE_OPTIONS=--require slow-simctl.js: delays the post-launch get_app_container by 150 s 4/4 fail (hook timeout) 4/4 pass
Native redirect of mapbox://styles/* to the black-hole IP 192.0.2.1 3/4 fail; same LogBox toast screenshot as the #4415 run 4/4 pass in 40 s
First map tap held 2 s (longPress(2000)), like the stalled touch-up bubble never shows retry shows it
54 busy loops on the host plus the simulator reniced, combined with slow simctl n/a 4/4 pass
// slow-simctl.js, loaded with NODE_OPTIONS=--require
const cp = require('child_process');
let launched = false;
const exec = cp.exec;
cp.exec = function (cmd, ...rest) {
  if (/simctl launch /.test(cmd)) launched = true;
  if (launched && /simctl get_app_container /.test(cmd)) {
    launched = false;
    return exec.call(this, `sleep 150; ${cmd}`, ...rest);
  }
  return exec.call(this, cmd, ...rest);
};

- Don't block device.launchApp on Detox's logging hint, whose
  simctl get_app_container call can stall for minutes on loaded runners.
- Load the Map Loaded example from a local style, so its test doesn't
  depend on the connection to api.mapbox.com.
- Don't let Detox wait for Mapbox requests, and hide LogBox toasts that
  cover the example list.
- Retry the map tap when a main-thread stall turns it into a long press.
@mfazekas
mfazekas marked this pull request as ready for review October 28, 2026 00:57
@mfazekas
mfazekas merged commit 8a55c05 into main Oct 28, 2026
40 checks passed
@mfazekas
mfazekas deleted the ci/ios-e2e-flakes branch October 28, 2026 01:45

This branch was previously deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant