Skip to content

Commit 7db7726

Browse files
committed
fix(ios): fail-fast macOS pinch + align capability/docs with synthesis-only
Follow-through for removing the macOS coordinate pinch path (the runner now returns UNSUPPORTED_OPERATION for macOS pinch): reject it at admission instead of round-tripping. - capabilities.ts: pinch now matches rotate-gesture/transform-gesture (Android + iOS simulator only); macOS dropped. Removes the now-unused isMacOsOrMobileAppleSimulator helper. - capabilities.test.ts: pinch expected unsupported on macOS and tvOS. - website/docs/docs/commands.md: pinch listed for Android + iOS simulators only (removed from the macOS app-session list); documents that iOS rotate ignores the optional velocity arg (synthesis uses a fixed duration; direction comes from the sign of degrees). Addresses PR #645 review HIGH #2 and MEDIUM #3.
1 parent f5e3240 commit 7db7726

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/core/__tests__/capabilities.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ test('device capability matrix stays consistent across shared command groups', (
7474
{ device: iosSimulator, expected: true, label: 'on iOS sim' },
7575
{ device: iosDevice, expected: false, label: 'on iOS device' },
7676
{ device: androidDevice, expected: true, label: 'on Android' },
77-
{ device: macOsDevice, expected: true, label: 'on macOS' },
77+
{ device: macOsDevice, expected: false, label: 'on macOS' },
78+
{ device: tvOsSimulator, expected: false, label: 'on tvOS simulator' },
7879
],
7980
},
8081
{
@@ -233,7 +234,6 @@ test('macOS supports the Apple runner interaction core but excludes mobile-only
233234
'logs',
234235
'network',
235236
'open',
236-
'pinch',
237237
'perf',
238238
'press',
239239
'record',
@@ -255,6 +255,7 @@ test('macOS supports the Apple runner interaction core but excludes mobile-only
255255
'home',
256256
'install',
257257
'install-from-source',
258+
'pinch',
258259
'push',
259260
'reinstall',
260261
'rotate',

src/core/capabilities.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export type CommandCapability = {
1717
const isNotMacOs = (device: DeviceInfo): boolean => device.platform !== 'macos';
1818
const isMacOsOrAppleSimulator = (device: DeviceInfo): boolean =>
1919
device.platform === 'macos' || device.kind === 'simulator';
20-
const isMacOsOrMobileAppleSimulator = (device: DeviceInfo): boolean =>
21-
device.platform === 'macos' || (device.kind === 'simulator' && device.target !== 'tv');
2220
const isIosMobileSimulator = (device: DeviceInfo): boolean =>
2321
device.platform === 'ios' && device.kind === 'simulator' && device.target !== 'tv';
2422

@@ -55,12 +53,14 @@ const COMMAND_CAPABILITY_MATRIX: Record<string, CommandCapability> = {
5553
supports: (device) => device.platform === 'android' || isMacOsOrAppleSimulator(device),
5654
},
5755
pinch: {
58-
// macOS desktop targets report kind=device, so this stays enabled here and the
59-
// supports() guard excludes iOS physical devices.
6056
apple: { simulator: true, device: true },
6157
android: { emulator: true, device: true, unknown: true },
6258
linux: LINUX_NONE,
63-
supports: (device) => device.platform === 'android' || isMacOsOrMobileAppleSimulator(device),
59+
// iOS-simulator-only (plus Android): pinch is driven by the two-finger XCTest synthesis
60+
// path (RunnerSynthesizedGesture), which is iOS-only. macOS has no multi-touch synthesis, so
61+
// it is excluded and fails fast at admission rather than round-tripping to an unsupported
62+
// runner. Matches rotate-gesture / transform-gesture.
63+
supports: (device) => device.platform === 'android' || isIosMobileSimulator(device),
6464
},
6565
'rotate-gesture': {
6666
apple: { simulator: true, device: true },

website/docs/docs/commands.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ agent-device snapshot -i --platform apple --target desktop
158158
- Status-item apps often expose little or no useful UI through the default macOS `app` surface. Prefer `--surface menubar` for discovery when the app lives in the top menu bar.
159159
- Use `frontmost-app`, `desktop`, and `menubar` mainly for `snapshot`, `get`, `is`, and `wait`.
160160
- If you inspect with `desktop` or `menubar` and then need to click or fill inside one app, open that app in a normal `app` session.
161-
- macOS also supports `clipboard read|write`, `trigger-app-event`, `logs`, `network dump`, `alert`, `gesture pinch` in app sessions, `settings appearance`, and `settings permission <grant|reset> <accessibility|screen-recording|input-monitoring>`.
161+
- macOS also supports `clipboard read|write`, `trigger-app-event`, `logs`, `network dump`, `alert`, `settings appearance`, and `settings permission <grant|reset> <accessibility|screen-recording|input-monitoring>`.
162162
- In macOS app sessions, `screenshot` captures the target app window bounds rather than the full desktop.
163163
- Prefer selector or `@ref`-driven interactions on macOS. Window position can shift between runs, so raw x/y point commands are less stable than snapshot-derived targets.
164164
- Use `click --button secondary` for context menus on macOS, then run `snapshot -i` again.
@@ -302,8 +302,8 @@ done
302302
```
303303

304304
`longpress` is supported on iOS and Android.
305-
`gesture pinch` is supported on Android, Apple simulators, and macOS app sessions.
306-
`gesture rotate` is supported on Android and iOS simulator app sessions. Use `rotate` for device orientation.
305+
`gesture pinch` is supported on Android and iOS simulator app sessions.
306+
`gesture rotate` is supported on Android and iOS simulator app sessions. Use `rotate` for device orientation. On iOS the optional `velocity` argument is ignored — rotation is synthesized over a fixed duration and direction is taken from the sign of `degrees`.
307307
`gesture transform` is supported on Android and iOS simulator app sessions.
308308

309309
## Find (semantic)

0 commit comments

Comments
 (0)