fix(mobile): wait for transitions before screen swipes

Merged
SH
6d ago
+178-20
  • Screen swipes in tests now honor the transition budget after the preceding action, including native alert dismissal.
  • Share waitOutTransition(operation, budget) with control transitions. Unchanged-control shortcuts and agent settling remain. A budget too short for the transition fails unsent, including an early timer wake.
flowchart LR
  A[Last action returns] --> B[Wait within transition and action budgets]
  B --> C{Cancelled or budget too short?}
  C -->|Yes| D[No input]
  C -->|No| E[Send screen swipe]

Issue

Fixes #1562.

Verified

Ran it locally: yes.

Public controlled CLI reproduction: main 1bbda5a fails, this branch f52bdc7 passes. All 505 mobile tests and pnpm check pass. The agent-origin regression fails if its wait is made unconditional; integer/fractional early-wake, cancellation, and sufficient-budget cases pass.

Native pacing cost is measurable. Fixture source/build and timing suite, reports, and clips are public. These are median test-body seconds from the official bench:ab harness on the same UIKit 40-row list binary, iPhone 15 Pro / iOS 27.0 Simulator, agent-device 0.21.36. Each budget has three measured pairs and one excluded warmup, one worker, zero retries. Both builds pass both cases with matching reported behavior/counters.

TransitionNative caseMain 1bbda5aPR f52bdc7Action API time, main → PR
500 msFour consecutive swipes4.48 s6.35 s2.21 → 4.11 s
500 msscrollUntilVisible, row 255.44 s6.53 s3.63 → 4.60 s
1500 msFour consecutive swipes4.44 s10.32 s2.21 → 8.11 s
1500 msscrollUntilVisible, row 255.69 s10.46 s3.70 → 8.56 s

API time sums the four screen.swipe steps or the one scrollUntilVisible step. Test bodies also include app launch and assertions. Identical temporary fixture files were untracked in both prepared checkouts; production files matched the listed commits.

Waiting between consecutive test swipes is intentional: a swipe can itself start a scroll or pager animation, and a screen-root gesture has no target binding whose unchanged position proves readiness. Captures and assertions consume the budget before the next swipe. The configured budget is a heuristic, not proof that a native animation has completed.

These fixture runs measure pacing cost, not a failure-rate improvement or the entire Expo benchmark suite. One measured pair per budget is linked below. GitHub disallows uploading attachments to this upstream repository with this account's read access, so the clips are published on the public evidence branch.

TransitionMain clipPR clip
500 ms
1500 ms