Skip to content

fix MaestroTimer.withTimeout usage for iOS app stop / start#3164

Open
rubu wants to merge 1 commit intomobile-dev-inc:mainfrom
rubu:fix/prevent-app-launch-hangs
Open

fix MaestroTimer.withTimeout usage for iOS app stop / start#3164
rubu wants to merge 1 commit intomobile-dev-inc:mainfrom
rubu:fix/prevent-app-launch-hangs

Conversation

@rubu
Copy link
Copy Markdown

@rubu rubu commented Apr 9, 2026

Proposed changes

I hit a case where trying to test an app that was linking to a missing framework crashed immediately but the launchApp command in maestro never resolved, while looking into that I noticed that both ensureStopped / ensureRunning use a while loop inside MaestroTimer.withTimeout which expects the block to return, but in this case if the app either does not start (or at least is dead until the first check or vice versa never stops) those blocks run indefinitely. This was the fix that helped locally to at least honour the 10s timeout.

A complete fix would be to maybe take into account the state of the original spawn process - if that has exited then the app is dead, but that is a much broader change whereas this fix seems intuitive to me and since i'm new to this tool I dont know the policies etc.

Testing

I verified that an app launch for an app that crashes immediately actually fails after 10s instead of hanging.

Does this need e2e tests? Please consider contributing them to the demo app repository.
Regarding e2e tests, I'm not sure, shuld a faulty app be added for e2e in this scenario?

Issues fixed

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