Skip to content

Spike: drive watchOS simulators with the XCUITest runner #4735

Closed

Description

@thymikee

Purpose

Find out whether agent-device can drive watchOS simulators with the existing XCUITest runner design. The result is a go or no-go, plus a scoped follow-up issue. This is a spike. Do not ship a watchOS platform from it.

Today watchOS is an explicit unsupported sentinel. The interactor, gesture admission and the supported-deployment check reject appleOs: 'watchos', and discovery never produces it (#977, packages/platform-apple/src/__tests__/interactor-watchos-sentinel.test.ts). ADR 0009 records the reason as "XCUITest cannot drive watchOS UI" (docs/adr/0009-apple-platform-consolidation.md:29).

That reason looks outdated. The Xcode 27.1 watchOS simulator SDK ships XCUIAutomation.framework with XCUIApplication, XCUIElement, XCUIDevice and accessibility audits. It also has watch-specific APIs: performHandGesture: (watchOS 10+), a flick hand gesture (watchOS 12+), hasHardwareButton: (watchOS 9+), and openURL: and location (watchOS 9.4+). The runner's own xcodebuild output already lists "watchOS Simulator" as a destination.

Scope

Simulators only. Remote access needs no new transport. It goes through the existing paths: a Simlock-leased watch simulator (ADR 0021) on the ordinary local runtime, and/or agent-device proxy (Remote proxy) from another machine. Physical watches are out of scope, because a watch reaches the Mac through its paired iPhone, so the runner's direct HTTP connection may not apply.

Questions the spike must answer

  1. Can a watchOS UI-test bundle in the runner project build and run on a watchOS simulator with xcodebuild test-without-building?
  2. Can the runner drive an app other than its own host by bundle ID (XCUIApplication(bundleIdentifier:)), as the iOS runner does?
  3. Can the runner's in-test command server accept connections from the host daemon on a watchOS simulator, with the same transport as iOS simulators?
  4. Which existing runner commands work unchanged? List snapshot (tree shape, frames, hittability), tap on an element and on a coordinate, swipe and scroll, text input, Digital Crown (hardware button or rotation), hand gestures, screenshot and app lifecycle (simctl install, launch, terminate). Note which commands must stay refused, as tvOS refuses coordinate gestures.
  5. Does discovery, boot, install and screenshot through simctl work for watch simulators with the current Apple tool provider and simulator-set scoping?
  6. Does a Simlock lease or agent-device proxy need any change to carry a watch simulator? Expect none. Say so if that holds.

Completion conditions

  • A spike branch (not merged) with the minimal watchOS runner target and host wiring needed to answer the questions. Commands, simulator model, watchOS runtime, Xcode version and raw output are recorded for each question.
  • A runnable demo on a watchOS simulator: open an app by bundle ID, take a snapshot, tap a named element, then take a screenshot, all through the branch-built CLI.
  • A comment here that starts with Decision: watchOS simulators:. It gives go or no-go with the evidence and the command matrix (works, needs work, must stay refused).
  • On go, a follow-up implementation issue that lists the runner target, discovery, interactor admission and the refused-command cells. It also amends ADR 0009's watchOS reasoning. On no-go, the decision comment names the blocking limitation, and ADR 0009 is updated with the verified reason.

Notes

  • The host needs a watchOS simulator runtime. Download it with xcodebuild -downloadPlatform watchOS, which is several GB.
  • Keep the spike's edits isolated from the iOS runner build. Do not change iOS runner behavior or caches.
  • Follow docs/agents/device-verification.md: verify with the branch-built CLI and close every session and simulator you start.

Activity

  1. added
    enhancement
    needs-triage
    on Nov 19, 2026
  2. apex-sentinel-staging commented on Nov 19, 2026

    @apex-sentinel-staging

    Apex Sentinel · Issue review

    Suggested label: feature

    The issue defines a scoped spike to investigate whether watchOS simulators can be supported, with specific scope, questions, completion conditions, and a go/no-go deliverable. It is not merely asking how to do something; it requests maintainer investigation work toward possible new behavior.

  3. thymikee commented on Nov 19, 2026

    @thymikee
    MemberAuthor

    Decision: watchOS simulators: go.

    The XCUITest runner drives watchOS simulators. Its existing source set builds and runs on watchOS with small os(watchOS) guards. ADR 0009's reason, "XCUITest cannot drive watchOS UI", is outdated. Follow-up implementation issue: #4738.

    Spike branch (not for merge): t3/watchos-simulator-support (d96e340). Evidence, commands, and raw output are in apple/runner/AgentDeviceRunnerWatch/SPIKE.md.
    Environment: Xcode 27.1 (27A9275), watchOS 27.0 simulator (24R362). Simulators: Apple Watch Series 11 46mm, SE 3 40mm, and Series 11 42mm in a private simulator set.

    Answers

    1. Build and run: yes. An isolated XcodeGen project (a SwiftUI watch host plus a UI-test target) compiles the existing AgentDeviceRunnerUITests/ sources. The first build failed in two files only: XCUIDevice.orientation and AVAssetWriter are unavailable on watchOS. All Objective-C bridges compiled unchanged. xcodebuild test-without-building started the runner and printed AGENT_DEVICE_RUNNER_LISTENER_READY and AGENT_DEVICE_RUNNER_PORT=47911.
    2. Other apps by bundle ID: yes. XCUIApplication(bundleIdentifier: "com.apple.NanoSettings") launched and drove Settings.
    3. Transport: yes, unchanged. The host reached the runner with token-authenticated POST 127.0.0.1:<port>/command, the same as on iOS simulators.
    4. Command matrix: see below.
    5. simctl paths: yes. Discovery (default set and --ios-simulator-device-set), boot (32 s), install (4 s), open, simctl screenshot, and close --shutdown all work. One gap: the managed runner build uses AgentDeviceRunner.xcodeproj, and xcodebuild rejects watchOS destinations for it. The spike used --ios-xctestrun-file.
    6. Simlock and proxy: no change needed. agent-device has no Simlock code. The lease contract is --ios-simulator-device-set, and it works for a watch: discovery, boot, test-without-building -DVTSimulatorSetLocation, snapshot, and press succeeded in a private set. agent-device proxy has no Apple OS branch. The proxy was not exercised.

    Demo (branch-built CLI, Series 11 46mm)

    open com.apple.NanoSettings --platform ios --udid <watch> --ios-xctestrun-file <watch xctestrun>  → Opened
    snapshot -i                         → 13 nodes (0.35 s warm)
    press 'label="Smart Stack"' --settle → Tapped (104, 150); settled +9 -12
    screenshot watch-demo.png           → 208x248, Smart Stack screen
    

    Command matrix

    Works Needs work Must stay refused
    snapshot (tree, frames, hittability) managed runner build (watch targets in the runner project) orientation / rotate
    tap: coordinate and selector type/fill: type into the system input sheet, then commit with Done (spike typed hello) multi-touch gesture (pinch, rotate)
    longpress keyboardStatus (reports hidden while the sheet is up) runner recordStart (no AVAssetWriter; use simctl recording)
    drag back (press the nav-bar Back button; today it hits the visionOS refusal)
    screenshot (runner and simctl) scroll (frame resolution is iOS-only today)
    appstate, terminate, find/query SpringBoard modal probe must be off (done in the spike; without it the first snapshot ends the runner)
    home (crown press) discovery ranking: never pick a watch implicitly for --platform ios
    boot, install, open, close --shutdown Digital Crown rotation and hand gestures dispatch; no command yet, separate issue if needed

    Cleanup: I closed every session, shut down the simulators I booted, deleted both spike simulators and the private set, and removed the stray watchos-simulator derived cache.

  4. removed
    needs-triage
    on Nov 20, 2026
  5. thymikee commented on Nov 21, 2026

    @thymikee
    MemberAuthor

    Closing: the spike is done. The go decision is recorded above, and the feature landed under #4738.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions