* 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>
* feat: for self-healing e2e tests; assertions
* fix: support long-press on iOS simulators via XCTest runner
The long-press command was failing on iOS simulators because dispatch.ts
called interactor.longPress() which mapped to a stub in ios/index.ts
that always threw UNSUPPORTED_OPERATION. Unlike press, type, fill, etc.,
the long-press case was missing the iOS simulator routing through the
XCTest runner.
Rather than adding yet another platform branch in dispatch.ts, this
refactors the Interactor abstraction to absorb runner routing internally.
getInteractor() now accepts an optional RunnerContext; when the device is
an iOS simulator, it returns an interactor whose tap/longPress/focus/
type/fill/scroll/scrollIntoView methods route through
runIosRunnerCommand. This removes 7 scattered if-ios-simulator branches
from dispatch.ts, making it impossible to forget runner routing for
future commands.
Changes:
- Swift runner: add longPress command type + longPressAt helper using
XCUICoordinate.press(forDuration:)
- runner-client.ts: add longPress to RunnerCommand type + durationMs field
- interactors.ts: add RunnerContext type, createIosSimulatorInteractor()
that routes through the XCTest runner, move invertScrollDirection here
- dispatch.ts: pass RunnerContext to getInteractor, remove all iOS sim
branching for interactor commands (-90 lines)
Co-authored-by: Cursor <cursoragent@cursor.com>
* restore attempts
* refactor: unify iOS interactor, remove dead input stubs
Since runnerContext is always passed and the capability matrix ensures
iOS only runs on simulators in v1, the two iOS interactor code paths
collapse into one: shared methods (open, close, screenshot) plus runner
overrides spread on top. No branch needed.
This deletes 7 dead iOS input stubs from ios/index.ts (pressIos,
longPressIos, focusIos, typeIos, fillIos, scrollIos, scrollIntoViewIos)
that only ever threw UNSUPPORTED_OPERATION errors.
Co-authored-by: Cursor <cursoragent@cursor.com>
* cleanup
* fixup save-script
* update
---------
Co-authored-by: Cursor <cursoragent@cursor.com>