MCPcopy Index your code
hub / github.com/callstack/agent-device / createAppleInteractor

Function createAppleInteractor

src/platforms/apple/interactor.ts:24–154  ·  view source on GitHub ↗
(
  device: DeviceInfo,
  runnerContext: RunnerContext,
)

Source from the content-addressed store, hash-verified

22} from '../../snapshot/snapshot-quality.ts';
23
24export function createAppleInteractor(
25 device: DeviceInfo,
26 runnerContext: RunnerContext,
27): Interactor {
28 // watchOS unsupported sentinel: XCUITest cannot drive watchOS UI (no
29 // XCUIApplication), so a watchOS device has no runner backend. Reject it
30 // explicitly here rather than letting `appleOs: 'watchos'` silently fall
31 // through to the iOS runner profile (see resolveRunnerPlatformNameForAppleOs).
32 if (device.appleOs === 'watchos') {
33 throw new AppError(
34 'UNSUPPORTED_PLATFORM',
35 'watchOS is not supported: XCUITest cannot drive watchOS UI, so this device has no runner backend.',
36 );
37 }
38 const { overrides, runnerOpts } = iosRunnerOverrides(device, runnerContext);
39 return {
40 open: (app, options) =>
41 openIosApp(device, app, {
42 appBundleId: options?.appBundleId,
43 launchConsole: options?.launchConsole,
44 launchArgs: options?.launchArgs,
45 terminateRunningApp: options?.terminateRunningApp,
46 url: options?.url,
47 }),
48 openDevice: () => openIosDevice(device),
49 close: (app) => closeIosApp(device, app),
50 screenshot: async (outPath, options) => {
51 if (isMacOs(device) && options?.surface && options.surface !== 'app') {
52 await runMacOsScreenshotAction(outPath, {
53 surface: options.surface,
54 fullscreen: options.fullscreen,
55 });
56 return;
57 }
58 await screenshotIos(device, outPath, {
59 appBundleId: options?.appBundleId,
60 fullscreen: options?.fullscreen,
61 runnerOptions: runnerOpts,
62 normalizeStatusBar: options?.normalizeStatusBar,
63 skipIosSimulatorBootCheck: options?.skipIosSimulatorBootCheck,
64 });
65 },
66 snapshot: async (options) => {
67 const result = readAppleSnapshotResult(
68 await withDiagnosticTimer(
69 'snapshot_capture',
70 async () =>
71 await runAppleRunnerCommand(
72 device,
73 {
74 command: 'snapshot',
75 appBundleId: options?.appBundleId,
76 interactiveOnly: options?.interactiveOnly,
77 depth: options?.depth,
78 scope: options?.scope,
79 raw: options?.raw,
80 },
81 runnerOpts,

Callers 3

createFunction · 0.90
plugin.tsFile · 0.85

Calls 15

iosRunnerOverridesFunction · 0.90
openIosAppFunction · 0.90
openIosDeviceFunction · 0.90
closeIosAppFunction · 0.90
isMacOsFunction · 0.90
runMacOsScreenshotActionFunction · 0.90
screenshotIosFunction · 0.90
withDiagnosticTimerFunction · 0.90
runAppleRunnerCommandFunction · 0.90
isTvOsDeviceFunction · 0.90
appleRemotePressCommandFunction · 0.90

Tested by 1

createFunction · 0.72