feat: register the swipe routes on watchOS - #1257
Open
ThiagoLannes wants to merge 1 commit into
Open
Conversation
`/wda/element/:uuid/swipe` and `/wda/swipe` are currently registered only in the `#elif !TARGET_OS_WATCH` branch of `FBElementCommands.routes`, under a comment saying gesture synthesis is not supported on watchOS. That is true of the routes that synthesise events, but swipe does not synthesise anything: * `XCUIElement.h` in the WatchSimulator SDK declares `swipeUp`, `swipeDown`, `swipeLeft`, `swipeRight` and their `WithVelocity:` variants with no watchOS exclusion — only the taps carry `API_UNAVAILABLE(tvos)`. * `-[XCUIElement fb_swipeWithDirection:velocity:]` invokes those methods by selector, and `XCUIElement+FBSwiping.m` has no `TARGET_OS_WATCH` guard, so it is already compiled into the watchOS target. * `handleSwipe:` itself is in the non-tvOS branch, so it is already compiled there too. So the capability is present and only the registration was missing: on watchOS `mobile: swipe` returns `404 Unhandled endpoint`. Verified on a paired Apple Watch Series 11 (46mm) / watchOS 26.5 simulator with appium-xcuitest-driver 12.8.0. Before: `POST /wda/swipe` -> 404 "Unhandled endpoint". After: 200, and a horizontal swipe turns a SwiftUI `TabView(.page)` in a real watch app. Six UI tests that had been unrunnable because the app's in-round screens are a horizontal pager now pass. W3C actions remain unavailable on watchOS (`fb_performW3CActions:` is compiled out with the rest of the touch-synthesis stack) and this change does not touch that.
|
mykola-mokhnach
approved these changes
Sep 10, 2026
|
thanks @ThiagoLannes |
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.
On watchOS
POST /wda/swipeandPOST /wda/element/:uuid/swipereturn404 Unhandled endpoint, somobile: swipeis unavailable through the XCUITest driver.They are registered only inside the
#elif !TARGET_OS_WATCHbranch ofFBElementCommands.routes, under a comment stating that gesture synthesis is not supported on watchOS. That is accurate for the routes which synthesise events — but swipe does not synthesise anything:XCUIElement.hin the WatchSimulator SDK declaresswipeUp,swipeDown,swipeLeft,swipeRightand theWithVelocity:variants with no watchOS exclusion. Only the tap family carriesAPI_UNAVAILABLE(tvos).-[XCUIElement fb_swipeWithDirection:velocity:]invokes those methods by selector, andXCUIElement+FBSwiping.mcarries noTARGET_OS_WATCHguard — it is already compiled into the watchOS target.handleSwipe:lives in the non-tvOS branch of the implementation, so it is compiled there too.The capability is therefore already present on watchOS and only the route registration was missing. This adds it in a
#if TARGET_OS_WATCHblock and reworks the neighbouring comment so it no longer implies swipe is impossible there.Verification
Paired Apple Watch Series 11 (46mm) / watchOS 26.5 simulator,
appium-xcuitest-driver12.8.0, real watch app.POST /wda/swipe404 {"error":"unknown command","message":"Unhandled endpoint: …/wda/swipe"}200, and the swipe turns a SwiftUITabView(.page)Six UI tests that could not run — the app under test puts its in-round screens on a horizontal pager, so only the initially-selected page was reachable — now pass.
Scope
W3C actions stay unavailable on watchOS:
fb_performW3CActions:is compiled out along with the rest of the touch-synthesis stack (XCUIApplication+FBTouchAction.m,FBW3CActionsSynthesizer.m,FBBaseActionsSynthesizer.mare each guarded#if !TARGET_OS_TV && !TARGET_OS_WATCH). This change deliberately does not touch that — it only exposes the native swipe that is already built.Happy to add a functional test under the existing watchOS CI job if you would like one.