fix: missing long-press on iOS simulator#26
Merged
Conversation
|
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>
5ed5030 to
0e97276
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
long-presson iOS simulators threwUNSUPPORTED_OPERATIONbecause it was missing the XCTest runner routing that other commands (press,type,fill, etc.) hadAdded
longPresscommand to the Swift XCTest runner, and refactored theInteractorabstraction to absorb all iOS simulator runner routing — eliminating 7 scatteredif (ios && simulator)branches fromdispatch.tsFixes #22