Skip to content

test(e2e): wait for Android emulator to settle and hide ANR dialogs - #501

Draft
KisaneNeko wants to merge 1 commit into
callstack:mainfrom
KisaneNeko:fix/android-e2e-settle-emulator
Draft

KisaneNeko wants to merge 1 commit into
callstack:mainfrom
KisaneNeko:fix/android-e2e-settle-emulator

Conversation

@KisaneNeko

Copy link
Copy Markdown
Contributor

Refs #499

Problem

Android Detox E2E jobs (Expo 57, Expo 58, Vanilla) fail randomly. In 5 of the 7 failed runs I checked, the app was running fine, but a "System UI isn't responding" dialog was covering it. The emulator is overloaded right after boot (CPU pressure ~98%) and system apps hit ANRs. UIAutomator only sees the dialog window, so the greeting check times out.

Change

prepare-android-emulator-for-detox.sh now does three things before Detox starts:

  1. Sets hide_error_dialogs 1 so ANRs don't show a dialog.
  2. Waits until CPU pressure (/proc/pressure/cpu, some avg10) stays below 40 for ~15 s. It gives up after 300 s and continues; this step never fails the job.
  3. Sends CLOSE_SYSTEM_DIALOGS to close a dialog that was already showing.

Tested locally on an API 34 emulator by forcing an ANR: the dialog reproduces the CI symptom, and both commands remove it. Android closes the app that hung, which for system apps means a restart.

Before merging

Draft PR. I want to re-run the Android E2E jobs 10–20 times here to check two things:

  • whether the ANR failures are gone
  • whether the native Hermes crash from the other 2 failed runs also goes away once the emulator isn't overloaded

🤖 Generated with Claude Code

Right after boot the CI emulator is CPU-saturated and system apps
(System UI, GMS) hit ANRs. The "System UI isn't responding" dialog then
covers the app, UIAutomator only sees the dialog window, and the greeting
check times out.

Before Detox starts, suppress error dialogs, wait until CPU pressure
(/proc/pressure/cpu) stays low, and close any dialog already showing.
The wait is best-effort and never fails the job.

Refs callstack#499

This branch has not been deployed

No deployments
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