fix(apple): press Home through simulator HID on a foldable simulator

Merged
KA
4d ago
+203-9

Summary

On a foldable iOS simulator (iPhone Duo), home and app-switcher reported success, but the app stayed in the foreground. XCUITest's XCUIDevice.shared.press(.home) never reaches SpringBoard there.

On a simulator with more than one panel, both commands now press Home through the fold helper's simulator HID: one consumer Menu key for home, two for app-switcher. This is the same routing orientation already uses. Single-panel simulators, physical devices, tvOS, and macOS keep the runner press.

Scope: help foldable also documents reaching Split View through SpringBoard.

Before / after

iPhone Duo, iOS 27.2, open pose, app in front:

# base 22bb75b
$ agent-device home        -> Home
$ agent-device appstate    -> State: runningForeground
$ agent-device app-switcher -> Opened app switcher
$ agent-device appstate    -> State: runningForeground

# head 92fb89d
$ agent-device home        -> Home
$ agent-device appstate    -> State: runningBackground   (home screen shown)
$ agent-device app-switcher -> Opened app switcher        (switcher shown)

Screenshots after each command, base left, head right:

iPhone Duo home and app-switcher, base vs head

Validation

  • pnpm check:affected --run --head 92fb89d: passed, exactCommit: true.
  • Device: node bin/agent-device.mjs at head on an iPhone Duo simulator (iOS 27.2, default set). home and app-switcher each passed in the closed, half-open, and open poses, checked with appstate and the screenshots above. The Split View steps were checked by hand with agent-device 0.21.39.
  • Not run: a scoped device set (--ios-simulator-device-set), and a live single-panel simulator. Unit tests cover the single-panel routing.

Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.