@appium/coresim 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +66 -0
- package/binding.gyp +53 -0
- package/lib/src/commands/app.d.ts +88 -0
- package/lib/src/commands/app.d.ts.map +1 -0
- package/lib/src/commands/app.js +133 -0
- package/lib/src/commands/app.js.map +1 -0
- package/lib/src/commands/biometric.d.ts +33 -0
- package/lib/src/commands/biometric.d.ts.map +1 -0
- package/lib/src/commands/biometric.js +44 -0
- package/lib/src/commands/biometric.js.map +1 -0
- package/lib/src/commands/darwin-notification.d.ts +36 -0
- package/lib/src/commands/darwin-notification.d.ts.map +1 -0
- package/lib/src/commands/darwin-notification.js +35 -0
- package/lib/src/commands/darwin-notification.js.map +1 -0
- package/lib/src/commands/interaction.d.ts +48 -0
- package/lib/src/commands/interaction.d.ts.map +1 -0
- package/lib/src/commands/interaction.js +48 -0
- package/lib/src/commands/interaction.js.map +1 -0
- package/lib/src/commands/keychain.d.ts +25 -0
- package/lib/src/commands/keychain.d.ts.map +1 -0
- package/lib/src/commands/keychain.js +52 -0
- package/lib/src/commands/keychain.js.map +1 -0
- package/lib/src/commands/lifecycle.d.ts +101 -0
- package/lib/src/commands/lifecycle.d.ts.map +1 -0
- package/lib/src/commands/lifecycle.js +165 -0
- package/lib/src/commands/lifecycle.js.map +1 -0
- package/lib/src/commands/media.d.ts +28 -0
- package/lib/src/commands/media.d.ts.map +1 -0
- package/lib/src/commands/media.js +27 -0
- package/lib/src/commands/media.js.map +1 -0
- package/lib/src/commands/misc.d.ts +15 -0
- package/lib/src/commands/misc.d.ts.map +1 -0
- package/lib/src/commands/misc.js +12 -0
- package/lib/src/commands/misc.js.map +1 -0
- package/lib/src/commands/pasteboard.d.ts +24 -0
- package/lib/src/commands/pasteboard.d.ts.map +1 -0
- package/lib/src/commands/pasteboard.js +22 -0
- package/lib/src/commands/pasteboard.js.map +1 -0
- package/lib/src/commands/permissions.d.ts +48 -0
- package/lib/src/commands/permissions.d.ts.map +1 -0
- package/lib/src/commands/permissions.js +84 -0
- package/lib/src/commands/permissions.js.map +1 -0
- package/lib/src/commands/process.d.ts +16 -0
- package/lib/src/commands/process.d.ts.map +1 -0
- package/lib/src/commands/process.js +68 -0
- package/lib/src/commands/process.js.map +1 -0
- package/lib/src/commands/screenshot.d.ts +29 -0
- package/lib/src/commands/screenshot.d.ts.map +1 -0
- package/lib/src/commands/screenshot.js +30 -0
- package/lib/src/commands/screenshot.js.map +1 -0
- package/lib/src/commands/spawn.d.ts +48 -0
- package/lib/src/commands/spawn.d.ts.map +1 -0
- package/lib/src/commands/spawn.js +108 -0
- package/lib/src/commands/spawn.js.map +1 -0
- package/lib/src/commands/ui.d.ts +42 -0
- package/lib/src/commands/ui.d.ts.map +1 -0
- package/lib/src/commands/ui.js +44 -0
- package/lib/src/commands/ui.js.map +1 -0
- package/lib/src/commands/webinspector.d.ts +19 -0
- package/lib/src/commands/webinspector.d.ts.map +1 -0
- package/lib/src/commands/webinspector.js +16 -0
- package/lib/src/commands/webinspector.js.map +1 -0
- package/lib/src/errors.d.ts +51 -0
- package/lib/src/errors.d.ts.map +1 -0
- package/lib/src/errors.js +82 -0
- package/lib/src/errors.js.map +1 -0
- package/lib/src/index.d.ts +7 -0
- package/lib/src/index.d.ts.map +1 -0
- package/lib/src/index.js +5 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/native-simctl.d.ts +62 -0
- package/lib/src/native-simctl.d.ts.map +1 -0
- package/lib/src/native-simctl.js +221 -0
- package/lib/src/native-simctl.js.map +1 -0
- package/lib/src/types.d.ts +267 -0
- package/lib/src/types.d.ts.map +1 -0
- package/lib/src/types.js +29 -0
- package/lib/src/types.js.map +1 -0
- package/lib/src/utils/index.d.ts +3 -0
- package/lib/src/utils/index.d.ts.map +1 -0
- package/lib/src/utils/index.js +3 -0
- package/lib/src/utils/index.js.map +1 -0
- package/lib/src/utils/pkg-root.d.ts +6 -0
- package/lib/src/utils/pkg-root.d.ts.map +1 -0
- package/lib/src/utils/pkg-root.js +12 -0
- package/lib/src/utils/pkg-root.js.map +1 -0
- package/lib/src/utils/run-catching.d.ts +3 -0
- package/lib/src/utils/run-catching.d.ts.map +1 -0
- package/lib/src/utils/run-catching.js +11 -0
- package/lib/src/utils/run-catching.js.map +1 -0
- package/package.json +73 -0
- package/scripts/install.mjs +22 -0
- package/src/commands/app.ts +186 -0
- package/src/commands/biometric.ts +69 -0
- package/src/commands/darwin-notification.ts +51 -0
- package/src/commands/interaction.ts +74 -0
- package/src/commands/keychain.ts +63 -0
- package/src/commands/lifecycle.ts +210 -0
- package/src/commands/media.ts +38 -0
- package/src/commands/misc.ts +20 -0
- package/src/commands/pasteboard.ts +31 -0
- package/src/commands/permissions.ts +122 -0
- package/src/commands/process.ts +80 -0
- package/src/commands/screenshot.ts +46 -0
- package/src/commands/spawn.ts +133 -0
- package/src/commands/ui.ts +61 -0
- package/src/commands/webinspector.ts +23 -0
- package/src/coresim.mm +1066 -0
- package/src/errors.ts +93 -0
- package/src/index.ts +23 -0
- package/src/native/async_bridge.h +164 -0
- package/src/native/nserror_bridge.h +64 -0
- package/src/native/nserror_bridge.mm +30 -0
- package/src/native/objc_runtime.h +45 -0
- package/src/native/objc_runtime.mm +76 -0
- package/src/native/safe_dispatch.h +38 -0
- package/src/native/sim_device.h +143 -0
- package/src/native/sim_device.mm +355 -0
- package/src/native/sim_device_set.h +16 -0
- package/src/native/sim_device_set.mm +40 -0
- package/src/native/sim_pasteboard.h +16 -0
- package/src/native/sim_pasteboard.mm +295 -0
- package/src/native/sim_process.h +13 -0
- package/src/native/sim_process.mm +139 -0
- package/src/native/sim_screenshot.h +28 -0
- package/src/native/sim_screenshot.mm +226 -0
- package/src/native/sim_service_context.h +42 -0
- package/src/native/sim_service_context.mm +92 -0
- package/src/native/tcc_privacy.h +35 -0
- package/src/native/tcc_privacy.mm +256 -0
- package/src/native/value_bridge.h +18 -0
- package/src/native/value_bridge.mm +111 -0
- package/src/native-simctl.ts +288 -0
- package/src/types.ts +302 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/pkg-root.ts +14 -0
- package/src/utils/run-catching.ts +10 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/** Raw `SimDeviceState` enum values, as returned by `SimDevice.state`. */
|
|
2
|
+
export declare enum SimDeviceState {
|
|
3
|
+
Creating = 0,
|
|
4
|
+
Shutdown = 1,
|
|
5
|
+
Booting = 2,
|
|
6
|
+
Booted = 3,
|
|
7
|
+
ShuttingDown = 4
|
|
8
|
+
}
|
|
9
|
+
/** A device in the default device set, as returned by `NativeSimctl.getDevices()`/`createDevice()`. */
|
|
10
|
+
export interface SimDeviceInfo {
|
|
11
|
+
/** e.g. `"D768CB90-CBB4-4557-82F6-B89E1CD0E80B"`. */
|
|
12
|
+
udid: string;
|
|
13
|
+
/** Display name, e.g. `"iPhone 17"`. */
|
|
14
|
+
name: string;
|
|
15
|
+
state: SimDeviceState;
|
|
16
|
+
/** e.g. `com.apple.CoreSimulator.SimDeviceType.iPhone-15` — `""` if that device type is no longer installed. */
|
|
17
|
+
deviceTypeIdentifier: string;
|
|
18
|
+
/** e.g. `com.apple.CoreSimulator.SimRuntime.iOS-17-4` — `""` if that runtime is no longer installed. */
|
|
19
|
+
runtimeIdentifier: string;
|
|
20
|
+
}
|
|
21
|
+
/** A simulator device type this CoreSimulator install supports, as returned by `getSupportedDeviceTypes()`. */
|
|
22
|
+
export interface SimDeviceTypeInfo {
|
|
23
|
+
/** e.g. `com.apple.CoreSimulator.SimDeviceType.iPhone-15`. */
|
|
24
|
+
identifier: string;
|
|
25
|
+
/** Display name, e.g. `"iPhone 15"`. */
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
/** A simulator runtime this CoreSimulator install supports, as returned by `getSupportedRuntimes()`. */
|
|
29
|
+
export interface SimRuntimeInfo {
|
|
30
|
+
/** e.g. `com.apple.CoreSimulator.SimRuntime.iOS-17-4`. */
|
|
31
|
+
identifier: string;
|
|
32
|
+
/** Display name, e.g. `"iOS 17.4"`. */
|
|
33
|
+
name: string;
|
|
34
|
+
/** e.g. `"17.4"`. */
|
|
35
|
+
versionString: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Raw `SimDeviceBootInfo.status` values — a separate, more granular boot-progress signal than
|
|
39
|
+
* {@link SimDeviceState}, and the one `simctl bootstatus` itself actually monitors (see CLAUDE.md
|
|
40
|
+
* for how this was confirmed: runtime introspection against the loaded framework, and empirical
|
|
41
|
+
* polling during a real boot). `SimDeviceState` reaching `Booted`
|
|
42
|
+
* only means the OS kernel/launchd has started — data migration and system-app (SpringBoard)
|
|
43
|
+
* startup, which these values track, can still take **20+ seconds longer** after that.
|
|
44
|
+
* `simctl bootstatus`'s own output also names a `WaitingOnBackboard` phase whose numeric value
|
|
45
|
+
* wasn't observed in testing (not every boot passes through it) — a `status` outside this enum's
|
|
46
|
+
* values should be treated as "not yet terminal, keep waiting", not as an error.
|
|
47
|
+
*/
|
|
48
|
+
export declare enum SimBootStatus {
|
|
49
|
+
Booting = 0,
|
|
50
|
+
WaitingOnDataMigration = 2,
|
|
51
|
+
WaitingOnSystemApp = 4,
|
|
52
|
+
/** The only terminal value observed — `0xFFFFFFFF`. */
|
|
53
|
+
Finished = 4294967295
|
|
54
|
+
}
|
|
55
|
+
/** What `NativeSimctl.getBootStatus()` resolves with when the device has been booted at least once. */
|
|
56
|
+
export interface SimBootInfo {
|
|
57
|
+
/** One of {@link SimBootStatus}'s values, or an unrecognized/undocumented one — see there. */
|
|
58
|
+
status: number;
|
|
59
|
+
/**
|
|
60
|
+
* Whether this boot attempt has fully settled (success or failure). Confirmed empirically to
|
|
61
|
+
* **stay `true` after shutdown**, reflecting the *previous* boot session — this alone does not
|
|
62
|
+
* mean "currently booted"; check `SimDeviceState` too (see `getBootStatus()`).
|
|
63
|
+
*/
|
|
64
|
+
isTerminal: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Result of `NativeSimctl.getPermission` — mirrors the TCC database's own auth states rather than
|
|
68
|
+
* a plain boolean, since `'unset'` (never prompted/decided) and `'denied'` (explicitly refused)
|
|
69
|
+
* are different states with different UI implications. `'limited'` only applies to `photos`
|
|
70
|
+
* ("selected photos" access) and is never produced by `grantPermission` itself, but can already be
|
|
71
|
+
* present if something else set it.
|
|
72
|
+
*/
|
|
73
|
+
export type SimPermissionStatus = 'unset' | 'denied' | 'granted' | 'limited';
|
|
74
|
+
/**
|
|
75
|
+
* A privacy permission grantable via `NativeSimctl.grantPermission`/`revokePermission`/
|
|
76
|
+
* `resetPermission`. Each is backed by a row in the simulator's own TCC (privacy) database —
|
|
77
|
+
* `location` isn't included since CoreLocation simulation has its own subsystem, not a plain TCC
|
|
78
|
+
* row (see CLAUDE.md).
|
|
79
|
+
*/
|
|
80
|
+
export type SimPermissionService = 'calendar' | 'camera' | 'contacts' | 'health' | 'homekit' | 'medialibrary' | 'microphone' | 'motion' | 'photos' | 'reminders' | 'siri' | 'speech';
|
|
81
|
+
/**
|
|
82
|
+
* A device's renderable display, as returned by `NativeSimctl.getDisplays()`.
|
|
83
|
+
*/
|
|
84
|
+
export interface SimDisplayInfo {
|
|
85
|
+
/** Port UUID identifying this display — pass as `getScreenshot`'s `displayId` option to target it. */
|
|
86
|
+
id: string;
|
|
87
|
+
/** Raw `SimDisplayDescriptorState.displayClass` — 0 is always the primary display. */
|
|
88
|
+
displayClass: number;
|
|
89
|
+
/** Whether this is the primary display (`displayClass === 0`). */
|
|
90
|
+
isMain: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Options for `NativeSimctl.getScreenshot`. */
|
|
93
|
+
export interface ScreenshotOptions {
|
|
94
|
+
/** Image encoding — defaults to `'png'`. */
|
|
95
|
+
format?: 'png' | 'jpeg';
|
|
96
|
+
/**
|
|
97
|
+
* Which display to capture, by `id` from `getDisplays()`. Defaults to the primary display
|
|
98
|
+
* (falling back to the first renderable display if none is primary, e.g. tvOS).
|
|
99
|
+
*/
|
|
100
|
+
displayId?: string;
|
|
101
|
+
/**
|
|
102
|
+
* JPEG quality as a percentage (0 = smallest/most compressed, 100 = largest/least compressed).
|
|
103
|
+
* Only meaningful with `format: 'jpeg'` — ignored for `'png'`, which is always lossless.
|
|
104
|
+
* Defaults to ImageIO's own default (near-lossless) when omitted.
|
|
105
|
+
*/
|
|
106
|
+
quality?: number;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Options for `NativeSimctl.spawnProcess`, passed through to CoreSimulator's
|
|
110
|
+
* `spawnWithPath:options:terminationQueue:terminationHandler:error:`. Only keys confirmed
|
|
111
|
+
* empirically (see CLAUDE.md) are typed here. CoreSimulator also recognizes
|
|
112
|
+
* `binpref`/`standalone`/`wait_for_debugger`/`enableCheckedAllocations`/`stdin`/`stdout`/`stderr`,
|
|
113
|
+
* but the latter three's expected value shape (`NSFileHandle`/XPC file descriptor/`NSNumber`,
|
|
114
|
+
* never a path string) isn't yet confirmed safe — passing the wrong type crashes the whole process
|
|
115
|
+
* instead of throwing a catchable error (see CLAUDE.md) — so they're deliberately omitted here.
|
|
116
|
+
*/
|
|
117
|
+
export interface SpawnOptions {
|
|
118
|
+
/** Fully replaces argv, including argv[0] — `path` only selects the executable. */
|
|
119
|
+
arguments?: string[];
|
|
120
|
+
/** Merged additively into the spawned process's environment. */
|
|
121
|
+
environment?: Record<string, string>;
|
|
122
|
+
}
|
|
123
|
+
/** One running process/launchd job inside a device, as reported by `NativeSimctl.listProcesses`. */
|
|
124
|
+
export interface SimProcessInfo {
|
|
125
|
+
/** The process's real host OS pid (the simulator shares the host kernel). */
|
|
126
|
+
pid: number;
|
|
127
|
+
/** The launchd job's group, parsed from a label like `UIKitApplication:com.apple.app[...]` — `null` if the label has no group prefix. */
|
|
128
|
+
group: string | null;
|
|
129
|
+
/** The launchd job's name — a bundle identifier for an app process. */
|
|
130
|
+
name: string;
|
|
131
|
+
}
|
|
132
|
+
/** The `alert` field of {@link ApnsPayload}, when it's a dictionary rather than a plain string. */
|
|
133
|
+
export interface ApnsAlert {
|
|
134
|
+
title?: string;
|
|
135
|
+
subtitle?: string;
|
|
136
|
+
body?: string;
|
|
137
|
+
'title-loc-key'?: string;
|
|
138
|
+
'title-loc-args'?: string[];
|
|
139
|
+
'subtitle-loc-key'?: string;
|
|
140
|
+
'subtitle-loc-args'?: string[];
|
|
141
|
+
'loc-key'?: string;
|
|
142
|
+
'loc-args'?: string[];
|
|
143
|
+
'action-loc-key'?: string;
|
|
144
|
+
'launch-image'?: string;
|
|
145
|
+
}
|
|
146
|
+
/** The `sound` field of {@link ApnsPayload}, when it's a dictionary rather than a plain string. */
|
|
147
|
+
export interface ApnsSound {
|
|
148
|
+
critical?: 0 | 1;
|
|
149
|
+
name?: string;
|
|
150
|
+
volume?: number;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The `aps` dictionary of a simulated push notification payload — see Apple's
|
|
154
|
+
* {@link https://developer.apple.com/documentation/usernotifications/generating-a-remote-notification | Generating a Remote Notification}.
|
|
155
|
+
* Only the commonly used fields are typed; `[key: string]: unknown` covers newer/less common ones
|
|
156
|
+
* (e.g. Live Activity fields like `event`/`content-state`/`attributes-type`) without blocking them.
|
|
157
|
+
*/
|
|
158
|
+
export interface ApnsPayload {
|
|
159
|
+
alert?: string | ApnsAlert;
|
|
160
|
+
badge?: number;
|
|
161
|
+
sound?: string | ApnsSound;
|
|
162
|
+
'thread-id'?: string;
|
|
163
|
+
category?: string;
|
|
164
|
+
'content-available'?: 0 | 1;
|
|
165
|
+
'mutable-content'?: 0 | 1;
|
|
166
|
+
'target-content-id'?: string;
|
|
167
|
+
'interruption-level'?: 'passive' | 'active' | 'time-sensitive' | 'critical';
|
|
168
|
+
'relevance-score'?: number;
|
|
169
|
+
'filter-criteria'?: string;
|
|
170
|
+
[key: string]: unknown;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Payload for `NativeSimctl.pushNotification` — an `aps` key with valid Apple Push Notification
|
|
174
|
+
* content is required; a top-level `"Simulator Target Bundle"` key is not (the separate `bundleId`
|
|
175
|
+
* argument covers it). Additional top-level keys are allowed — APNs delivers them to the app as
|
|
176
|
+
* custom data alongside `aps`.
|
|
177
|
+
*/
|
|
178
|
+
export interface PushNotificationPayload {
|
|
179
|
+
aps: ApnsPayload;
|
|
180
|
+
[key: string]: unknown;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* What `NativeDeviceHandle.spawn()` resolves with once the process has started — `stdoutFd`/
|
|
184
|
+
* `stderrFd` are raw, already-`dup()`'d file descriptors (see coresim.mm) ready to be wrapped in a
|
|
185
|
+
* `net.Socket({fd, readable: true, writable: false})` (not `fs.createReadStream`, which would
|
|
186
|
+
* block a shared libuv threadpool worker for as long as the pipe stays quiet — see
|
|
187
|
+
* commands/spawn.ts); `pid` is a real host OS process id, killable directly.
|
|
188
|
+
*/
|
|
189
|
+
export interface NativeSpawnResult {
|
|
190
|
+
pid: number;
|
|
191
|
+
stdoutFd: number;
|
|
192
|
+
stderrFd: number;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Decoded wait(2)-style exit status (see CLAUDE.md for how the raw status was confirmed),
|
|
196
|
+
* mirroring Node's own `ChildProcess` `'exit'` event — exactly one of `code`/`signal` is set.
|
|
197
|
+
*/
|
|
198
|
+
export type NativeSpawnExitCallback = (code: number | null, signal: number | null) => void;
|
|
199
|
+
/** A `SimDevice`, wrapped by `coresim.mm`'s `NativeDevice` — what `NativeSimctl`'s `_findDevice()` resolves to. */
|
|
200
|
+
export interface NativeDeviceHandle {
|
|
201
|
+
udid(): string;
|
|
202
|
+
name(): string;
|
|
203
|
+
state(): number;
|
|
204
|
+
deviceTypeIdentifier(): string;
|
|
205
|
+
runtimeIdentifier(): string;
|
|
206
|
+
boot(options?: Record<string, unknown>): Promise<void>;
|
|
207
|
+
getBootStatus(): Promise<SimBootInfo | null>;
|
|
208
|
+
shutdown(): Promise<void>;
|
|
209
|
+
erase(): Promise<void>;
|
|
210
|
+
getenv(name: string): Promise<string>;
|
|
211
|
+
installApp(path: string, options?: Record<string, unknown>): Promise<void>;
|
|
212
|
+
uninstallApp(bundleId: string, options?: Record<string, unknown>): Promise<void>;
|
|
213
|
+
launchApp(bundleId: string, options?: Record<string, unknown>): Promise<number>;
|
|
214
|
+
terminateApp(bundleId: string): Promise<void>;
|
|
215
|
+
propertiesOfApplication(bundleId: string): Promise<Record<string, unknown>>;
|
|
216
|
+
installedApps(): Promise<Record<string, unknown>>;
|
|
217
|
+
openUrl(url: string): Promise<void>;
|
|
218
|
+
setLocation(latitude: number, longitude: number): Promise<void>;
|
|
219
|
+
clearLocation(): Promise<void>;
|
|
220
|
+
sendPushNotification(bundleId: string, payload: PushNotificationPayload): Promise<void>;
|
|
221
|
+
addCertificate(path: string, trustAsRoot: boolean): Promise<void>;
|
|
222
|
+
resetKeychain(): Promise<void>;
|
|
223
|
+
getUIAppearance(): Promise<number>;
|
|
224
|
+
setUIAppearance(style: number): Promise<void>;
|
|
225
|
+
getIncreaseContrast(): Promise<number>;
|
|
226
|
+
setIncreaseContrast(enabled: boolean): Promise<void>;
|
|
227
|
+
getContentSize(): Promise<number>;
|
|
228
|
+
setContentSize(category: number): Promise<void>;
|
|
229
|
+
grantPermission(service: string, bundleId: string): Promise<void>;
|
|
230
|
+
revokePermission(service: string, bundleId: string): Promise<void>;
|
|
231
|
+
resetPermission(service: string, bundleId: string): Promise<void>;
|
|
232
|
+
getPermission(service: string, bundleId: string): Promise<SimPermissionStatus>;
|
|
233
|
+
darwinNotificationGetState(name: string): Promise<bigint>;
|
|
234
|
+
darwinNotificationSetState(name: string, state: bigint): Promise<void>;
|
|
235
|
+
postDarwinNotification(name: string): Promise<void>;
|
|
236
|
+
addMedia(filePaths: string[]): Promise<void>;
|
|
237
|
+
addPhoto(filePath: string): Promise<void>;
|
|
238
|
+
addVideo(filePath: string): Promise<void>;
|
|
239
|
+
getPasteboard(): Promise<string>;
|
|
240
|
+
setPasteboard(content: string): Promise<void>;
|
|
241
|
+
getWebInspectorSocket(): Promise<string>;
|
|
242
|
+
screenshot(options?: {
|
|
243
|
+
format?: 'png' | 'jpeg';
|
|
244
|
+
displayId?: string;
|
|
245
|
+
quality?: number;
|
|
246
|
+
}): Promise<Buffer>;
|
|
247
|
+
getDisplays(): Promise<SimDisplayInfo[]>;
|
|
248
|
+
spawn(path: string, options: SpawnOptions | undefined, onExit: NativeSpawnExitCallback): Promise<NativeSpawnResult>;
|
|
249
|
+
}
|
|
250
|
+
/** A `SimDeviceSet`, wrapped by `coresim.mm`'s `NativeDeviceSet`. */
|
|
251
|
+
export interface NativeDeviceSetHandle {
|
|
252
|
+
devices(): Promise<NativeDeviceHandle[]>;
|
|
253
|
+
createDevice(deviceTypeIdentifier: string, runtimeIdentifier: string, name: string): Promise<NativeDeviceHandle>;
|
|
254
|
+
deleteDevice(device: NativeDeviceHandle): Promise<void>;
|
|
255
|
+
}
|
|
256
|
+
/** A `SimServiceContext`, wrapped by `coresim.mm`'s `NativeServiceContext`. */
|
|
257
|
+
export interface NativeServiceContextHandle {
|
|
258
|
+
defaultDeviceSet(): Promise<NativeDeviceSetHandle>;
|
|
259
|
+
supportedDeviceTypes(): Promise<SimDeviceTypeInfo[]>;
|
|
260
|
+
supportedRuntimes(): Promise<SimRuntimeInfo[]>;
|
|
261
|
+
}
|
|
262
|
+
/** The addon's module-level exports (`coresim.mm`'s `Init`) — the return value of `require('node-gyp-build')(...)`. */
|
|
263
|
+
export interface NativeCoreSimModule {
|
|
264
|
+
sharedServiceContext(developerDir: string): Promise<NativeServiceContextHandle>;
|
|
265
|
+
frameworkVersion(): Promise<string>;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,oBAAY,cAAc;IACxB,QAAQ,IA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zD;AAED,+EAA+E;AAC/E,MAAM,WAAW,0BAA0B;IACzC,gBAAgB,IAAI,OAAO,CAAC,qBAAqB,CAAC,CAAC;IACnD,oBAAoB,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACrD,iBAAiB,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAChD;AAED,uHAAuH;AACvH,MAAM,WAAW,mBAAmB;IAClC,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAChF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACrC"}
|
package/lib/src/types.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** Raw `SimDeviceState` enum values, as returned by `SimDevice.state`. */
|
|
2
|
+
export var SimDeviceState;
|
|
3
|
+
(function (SimDeviceState) {
|
|
4
|
+
SimDeviceState[SimDeviceState["Creating"] = 0] = "Creating";
|
|
5
|
+
SimDeviceState[SimDeviceState["Shutdown"] = 1] = "Shutdown";
|
|
6
|
+
SimDeviceState[SimDeviceState["Booting"] = 2] = "Booting";
|
|
7
|
+
SimDeviceState[SimDeviceState["Booted"] = 3] = "Booted";
|
|
8
|
+
SimDeviceState[SimDeviceState["ShuttingDown"] = 4] = "ShuttingDown";
|
|
9
|
+
})(SimDeviceState || (SimDeviceState = {}));
|
|
10
|
+
/**
|
|
11
|
+
* Raw `SimDeviceBootInfo.status` values — a separate, more granular boot-progress signal than
|
|
12
|
+
* {@link SimDeviceState}, and the one `simctl bootstatus` itself actually monitors (see CLAUDE.md
|
|
13
|
+
* for how this was confirmed: runtime introspection against the loaded framework, and empirical
|
|
14
|
+
* polling during a real boot). `SimDeviceState` reaching `Booted`
|
|
15
|
+
* only means the OS kernel/launchd has started — data migration and system-app (SpringBoard)
|
|
16
|
+
* startup, which these values track, can still take **20+ seconds longer** after that.
|
|
17
|
+
* `simctl bootstatus`'s own output also names a `WaitingOnBackboard` phase whose numeric value
|
|
18
|
+
* wasn't observed in testing (not every boot passes through it) — a `status` outside this enum's
|
|
19
|
+
* values should be treated as "not yet terminal, keep waiting", not as an error.
|
|
20
|
+
*/
|
|
21
|
+
export var SimBootStatus;
|
|
22
|
+
(function (SimBootStatus) {
|
|
23
|
+
SimBootStatus[SimBootStatus["Booting"] = 0] = "Booting";
|
|
24
|
+
SimBootStatus[SimBootStatus["WaitingOnDataMigration"] = 2] = "WaitingOnDataMigration";
|
|
25
|
+
SimBootStatus[SimBootStatus["WaitingOnSystemApp"] = 4] = "WaitingOnSystemApp";
|
|
26
|
+
/** The only terminal value observed — `0xFFFFFFFF`. */
|
|
27
|
+
SimBootStatus[SimBootStatus["Finished"] = 4294967295] = "Finished";
|
|
28
|
+
})(SimBootStatus || (SimBootStatus = {}));
|
|
29
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,2DAAY,CAAA;IACZ,2DAAY,CAAA;IACZ,yDAAW,CAAA;IACX,uDAAU,CAAA;IACV,mEAAgB,CAAA;AAClB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAiCD;;;;;;;;;;GAUG;AACH,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,qFAA0B,CAAA;IAC1B,6EAAsB,CAAA;IACtB,uDAAuD;IACvD,kEAAqB,CAAA;AACvB,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACvD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkg-root.d.ts","sourceRoot":"","sources":["../../../src/utils/pkg-root.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,oBAAoB,CAAC;AAE9C,gFAAgF;AAChF,eAAO,MAAM,UAAU,SAA2C,MAAM;;CAMtE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { node, util } from '@appium/support';
|
|
3
|
+
export const PACKAGE_NAME = '@appium/coresim';
|
|
4
|
+
/** Package root (contains binding.gyp, prebuilds/, or build/ after compile). */
|
|
5
|
+
export const getPkgRoot = util.memoize(function resolvePkgRoot() {
|
|
6
|
+
const root = node.getModuleRootSync(PACKAGE_NAME, fileURLToPath(import.meta.url));
|
|
7
|
+
if (!root) {
|
|
8
|
+
throw new Error(`Could not locate the root of the '${PACKAGE_NAME}' package`);
|
|
9
|
+
}
|
|
10
|
+
return root;
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=pkg-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pkg-root.js","sourceRoot":"","sources":["../../../src/utils/pkg-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAC,IAAI,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAE9C,gFAAgF;AAChF,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,cAAc;IAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAClF,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,qCAAqC,YAAY,WAAW,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-catching.d.ts","sourceRoot":"","sources":["../../../src/utils/run-catching.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAC1H,wBAAsB,gBAAgB,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAM1E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { wrapNativeError } from '../errors.js';
|
|
2
|
+
/** Shared by NativeSimctl and every `src/commands/*.ts` mixin — maps a raw error surfaced by the addon to a typed one. */
|
|
3
|
+
export async function runCatchingAsync(fn) {
|
|
4
|
+
try {
|
|
5
|
+
return await fn();
|
|
6
|
+
}
|
|
7
|
+
catch (err) {
|
|
8
|
+
wrapNativeError(err);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=run-catching.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-catching.js","sourceRoot":"","sources":["../../../src/utils/run-catching.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,0HAA0H;AAC1H,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAI,EAAoB;IAC5D,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,eAAe,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@appium/coresim",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Native bindings to CoreSimulator.framework for Apple platform simulator control",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/appium/coresim/issues"
|
|
7
|
+
},
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "Appium Contributors",
|
|
11
|
+
"url": "https://github.com/appium/coresim"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/appium/coresim.git"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"src",
|
|
19
|
+
"lib/src",
|
|
20
|
+
"prebuilds",
|
|
21
|
+
"scripts/install.mjs",
|
|
22
|
+
"binding.gyp",
|
|
23
|
+
"package.json",
|
|
24
|
+
"README.md",
|
|
25
|
+
"!.DS_Store",
|
|
26
|
+
"CHANGELOG.md",
|
|
27
|
+
"LICENSE"
|
|
28
|
+
],
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "lib/src/index.js",
|
|
31
|
+
"types": "lib/src/index.d.ts",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"clean": "rm -rf build node_modules lib",
|
|
37
|
+
"build": "tsc -b",
|
|
38
|
+
"build:addon": "node-gyp rebuild",
|
|
39
|
+
"build:addon:xcodebuild": "node-gyp configure -- -f xcode && xcodebuild -project build/binding.xcodeproj -target coresim -configuration Release build",
|
|
40
|
+
"build:prebuilds": "prebuildify --napi --strip",
|
|
41
|
+
"lint": "oxlint -c oxlint.config.mjs .",
|
|
42
|
+
"lint:fix": "oxlint -c oxlint.config.mjs --fix .",
|
|
43
|
+
"lint:cpp": "npm run build:compile-commands && bash scripts/ci/lint-cpp.sh",
|
|
44
|
+
"format": "oxfmt -c oxfmt.config.mjs .",
|
|
45
|
+
"format:check": "oxfmt -c oxfmt.config.mjs --check .",
|
|
46
|
+
"format:cpp": "clang-format -i src/coresim.mm src/native/*.mm src/native/*.h",
|
|
47
|
+
"format:cpp:check": "clang-format --dry-run --Werror src/coresim.mm src/native/*.mm src/native/*.h",
|
|
48
|
+
"build:compile-commands": "node-gyp configure -- -f compile_commands_json",
|
|
49
|
+
"install": "node scripts/install.mjs",
|
|
50
|
+
"prepare": "npm run build",
|
|
51
|
+
"test": "npm run test:unit && npm run test:integration",
|
|
52
|
+
"test:unit": "node --enable-source-maps --test --test-force-exit --test-timeout=15000 \"lib/test/unit/**/*.spec.js\"",
|
|
53
|
+
"test:integration": "node --enable-source-maps --test --test-force-exit --test-concurrency=1 --test-timeout=1200000 \"lib/test/integration/**/*.spec.js\""
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@appium/support": "^7.2.0",
|
|
57
|
+
"asyncbox": "^6.4.3",
|
|
58
|
+
"node-addon-api": "^8.5.0",
|
|
59
|
+
"node-gyp-build": "^4.8.4"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@appium/oxc-config": "^1.1.0",
|
|
63
|
+
"@appium/semantic-release-config": "^1.1.0",
|
|
64
|
+
"@appium/tsconfig": "^1.2.0",
|
|
65
|
+
"@types/node": "^26.1.2",
|
|
66
|
+
"prebuildify": "^6.0.1"
|
|
67
|
+
},
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": "^20.19.0 || ^22.12.0 || >=24.0.0",
|
|
70
|
+
"npm": ">=10"
|
|
71
|
+
},
|
|
72
|
+
"gypfile": true
|
|
73
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {execFileSync} from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
// Overridable only for test/unit/install-script.spec.ts, which spawns this file as a real
|
|
4
|
+
// subprocess to verify the skip branch without needing to fake process.platform themselves.
|
|
5
|
+
const platform = process.env.CORESIM_TEST_PLATFORM ?? process.platform;
|
|
6
|
+
|
|
7
|
+
// CoreSimulator.framework only exists on macOS — there's nothing to build or load anywhere else.
|
|
8
|
+
// Skip straight to a no-op there so `npm install` always succeeds regardless of platform; the
|
|
9
|
+
// package still installs fine (its TS/error-class surface is plain JS), it just throws a clear,
|
|
10
|
+
// typed error the first time native functionality is actually used (see native-simctl.ts's
|
|
11
|
+
// loadNative()). Any macOS arch is fine here — an Intel Mac just compiles from source instead of
|
|
12
|
+
// using the darwin-arm64 prebuild.
|
|
13
|
+
if (platform !== 'darwin') {
|
|
14
|
+
process.stdout.write(
|
|
15
|
+
`[@appium/coresim] Skipping native addon build: CoreSimulator.framework requires macOS ` +
|
|
16
|
+
`(current platform: ${platform}). This package will throw a NativeSimUnavailableError at ` +
|
|
17
|
+
'runtime if used here.\n',
|
|
18
|
+
);
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
execFileSync('node-gyp-build', {stdio: 'inherit', shell: true});
|