perf: speed up iOS swipes and harden runner cache#676
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c63e3b541
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| durationMs: iosSwipeDurationMs(durationMs), | ||
| synthesized: true, | ||
| appBundleId: ctx.appBundleId, |
There was a problem hiding this comment.
Gate synthesized swipes to iOS only
In macOS sessions createAppleInteractor also gets its swipe implementation from iosRunnerOverrides, so this now sends synthesized: true for macOS swipes as well. The macOS runner's synthesized path always returns unsupported, and RunnerTests+CommandExecution.swift then falls back using synthesizedSwipeFallbackHoldDuration, which converts a requested/default 300 ms swipe into a 60 ms hold capped at 120 ms instead of the previous direct drag duration. This can make macOS swipe/scroll gestures much shorter than requested; only set this flag for iOS/touch devices or preserve the old duration path on macOS.
Useful? React with 👍 / 👎.
d19aa27 to
835582d
Compare
92a072f to
3930d5a
Compare
3930d5a to
3412898
Compare
|
Summary
Speed up and harden the iOS/Android Maestro replay path used by React Navigation.
iOS gestures
swipenow uses a synthesized iOS runner drag path instead of XCTest's long press/drag path. This makes swipes closer to user/Maestro timing and avoids the multi-second pauses we saw in material top tabs.Repeated iOS swipes (
--count > 1/dragSeries) now use the same synthesized path and skip XCTest idle-timeout wrapping.panis also aligned withswipe/scrollfor non-tvOS iOS targets, so common drag-like gestures no longer quietly stay on the old slow path.If synthesized drag is unavailable, the runner still falls back to XCTest coordinate dragging, but the fallback is exposed in response data and emitted as a debug diagnostic so slow fallback paths are observable.
iOS runner cache
The iOS runner derived-data cache is now keyed by a stable runner fingerprint and guarded by a filesystem lock. Identical runner builds can be reused across sessions/worktrees, while stale or foreign artifacts are rejected through metadata/path/product validation.
This avoids unnecessary runner rebuilds without accepting stale cache risk.
Maestro compat runtime
Maestro compat now prefers optimized snapshots for normal assertions, taps, and
runFlow.whenchecks, then uses raw fallback only where we still need it on iOS. The raw fallback policy is shared in runtime support.Android optimized snapshots now keep nodes with meaningful app ids so
testIDselectors can resolve without raw snapshots. Generic Android framework/resource ids remain filtered, so the snapshot can grow slightly but should not regress into noisy framework output.Selector/tap geometry was tightened for React Navigation-style tab bars so visible/on-screen tab targets are preferred over broad parent containers.
CI setup
iOS smoke/nightly workflows now prepare the iOS runner before replay. This prevents the first Maestro snapshot from paying a cold
xcodebuildcost inside the daemon request timeout.Validation
pnpm exec vitest run src/core/__tests__/dispatch-interactions.test.ts src/platforms/ios/__tests__/index.test.ts src/compat/maestro/__tests__/runtime-flow.test.tspnpm exec vitest run src/compat/maestro/__tests__/runtime-assertions.test.ts src/compat/maestro/__tests__/runtime-interactions.test.ts src/platforms/ios/__tests__/runner-client.test.tspnpm check:fallow --base 491ad7e9224d787f1d90568085479e2b2c7787f3pnpm check:quickpnpm build:xcuitestcache-22e3c70b47ebf0c4, iPhone 17 Pro reused the same.xctestrun, and warm reruns reused the same cache on both simulators withensure_xctestrunat 14-26ms