Files
Nick Dima 43aae1d30a fix(ios): correctly implement runner fallback for physical device screenshots (#132)
* fix(ios): use XCTest runner for screenshots on physical devices

`xcrun devicectl device screenshot` was removed in Xcode 26.x, causing
`agent-device screenshot` to fail on physical iOS devices with exit code 64.

This fix routes physical device screenshots through the AgentDeviceRunner
XCTest runner (already used for snapshot/interaction commands) instead:

- Add `screenshot` command to the Swift runner's `CommandType` enum
- Implement the handler using `XCUIScreen.main.screenshot()`, writing a
  timestamped PNG to the app's temp directory (returned as `tmp/<file>`)
- If `appBundleId` is provided, activate the target app before capturing
  so the screenshot shows the app under test rather than the runner itself
- In `screenshotIos()`, pass `appBundleId` to the runner command then pull
  the file back to the host via `xcrun devicectl device copy from` (same
  mechanism used by the recording feature)
- Thread `appBundleId` through `Interactor.screenshot()` → `dispatch.ts`
  → `screenshotIos()` so the active session's app is always captured
- Extract `IOS_RUNNER_CONTAINER_BUNDLE_IDS` to `runner-client.ts` so it
  can be shared between `apps.ts` and `record-trace.ts`

Fixes: screenshots failing with "Failed to capture iOS screenshot" on
devices using Xcode 26.x / devicectl 506.6+

* fix: clean up iOS screenshot fallback follow-ups

---------

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
2026-02-25 16:11:01 +01:00
..

agent-device iOS Runner

This folder is reserved for the lightweight XCUITest runner used to provide element-level automation on iOS.

Intent

  • Provide a minimal XCTest target that exposes UI automation over a small HTTP server.
  • Allow local builds via xcodebuild and caching for faster subsequent runs.
  • Support simulator prebuilds where compatible.

Status

Planned for the automation layer. See docs/ios-automation.md and docs/ios-runner-protocol.md.