Skip to content

fix: missing long-press on iOS simulator#26

Merged
thymikee merged 7 commits into
mainfrom
fix/ios-long-press
Feb 9, 2026
Merged

fix: missing long-press on iOS simulator#26
thymikee merged 7 commits into
mainfrom
fix/ios-long-press

Conversation

@thymikee
Copy link
Copy Markdown
Member

@thymikee thymikee commented Feb 9, 2026

The long-press on iOS simulators threw UNSUPPORTED_OPERATION because it was missing the XCTest runner routing that other commands (press, type, fill, etc.) had

Added longPress command to the Swift XCTest runner, and refactored the Interactor abstraction to absorb all iOS simulator runner routing — eliminating 7 scattered if (ios && simulator) branches from dispatch.ts

Fixes #22

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 9, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-26/

Built to branch gh-pages at 2026-02-09 10:23 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@thymikee thymikee changed the base branch from feat/replay-update to main February 9, 2026 10:01
thymikee and others added 6 commits February 9, 2026 11:11
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>
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>
@thymikee thymikee merged commit d2954f6 into main Feb 9, 2026
5 of 6 checks passed
@thymikee thymikee deleted the fix/ios-long-press branch February 9, 2026 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error (UNSUPPORTED_OPERATION): long-press is not supported on iOS simulators without XCTest runner support

1 participant