node-simctl 7.3.4 → 7.3.6
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/CHANGELOG.md +15 -0
- package/build/lib/simctl.d.ts +46 -1
- package/build/lib/simctl.d.ts.map +1 -1
- package/build/lib/simctl.js +69 -5
- package/build/lib/simctl.js.map +1 -1
- package/build/lib/subcommands/addmedia.d.ts +2 -1
- package/build/lib/subcommands/addmedia.d.ts.map +1 -1
- package/build/lib/subcommands/addmedia.js +3 -0
- package/build/lib/subcommands/addmedia.js.map +1 -1
- package/build/lib/subcommands/appinfo.d.ts +2 -1
- package/build/lib/subcommands/appinfo.d.ts.map +1 -1
- package/build/lib/subcommands/appinfo.js +3 -0
- package/build/lib/subcommands/appinfo.js.map +1 -1
- package/build/lib/subcommands/boot.d.ts +2 -1
- package/build/lib/subcommands/boot.d.ts.map +1 -1
- package/build/lib/subcommands/boot.js +1 -0
- package/build/lib/subcommands/boot.js.map +1 -1
- package/build/lib/subcommands/bootstatus.d.ts +2 -1
- package/build/lib/subcommands/bootstatus.d.ts.map +1 -1
- package/build/lib/subcommands/bootstatus.js +3 -0
- package/build/lib/subcommands/bootstatus.js.map +1 -1
- package/build/lib/subcommands/create.d.ts +2 -1
- package/build/lib/subcommands/create.d.ts.map +1 -1
- package/build/lib/subcommands/create.js +3 -0
- package/build/lib/subcommands/create.js.map +1 -1
- package/build/lib/subcommands/delete.d.ts +2 -1
- package/build/lib/subcommands/delete.d.ts.map +1 -1
- package/build/lib/subcommands/delete.js +1 -0
- package/build/lib/subcommands/delete.js.map +1 -1
- package/build/lib/subcommands/erase.d.ts +2 -1
- package/build/lib/subcommands/erase.d.ts.map +1 -1
- package/build/lib/subcommands/erase.js +1 -0
- package/build/lib/subcommands/erase.js.map +1 -1
- package/build/lib/subcommands/get_app_container.d.ts +2 -1
- package/build/lib/subcommands/get_app_container.d.ts.map +1 -1
- package/build/lib/subcommands/get_app_container.js +2 -0
- package/build/lib/subcommands/get_app_container.js.map +1 -1
- package/build/lib/subcommands/getenv.d.ts +2 -1
- package/build/lib/subcommands/getenv.d.ts.map +1 -1
- package/build/lib/subcommands/getenv.js +3 -0
- package/build/lib/subcommands/getenv.js.map +1 -1
- package/build/lib/subcommands/install.d.ts +2 -1
- package/build/lib/subcommands/install.d.ts.map +1 -1
- package/build/lib/subcommands/install.js +1 -0
- package/build/lib/subcommands/install.js.map +1 -1
- package/build/lib/subcommands/io.d.ts +2 -1
- package/build/lib/subcommands/io.d.ts.map +1 -1
- package/build/lib/subcommands/io.js +1 -0
- package/build/lib/subcommands/io.js.map +1 -1
- package/build/lib/subcommands/keychain.d.ts +6 -3
- package/build/lib/subcommands/keychain.d.ts.map +1 -1
- package/build/lib/subcommands/keychain.js +9 -1
- package/build/lib/subcommands/keychain.js.map +1 -1
- package/build/lib/subcommands/launch.d.ts +2 -1
- package/build/lib/subcommands/launch.d.ts.map +1 -1
- package/build/lib/subcommands/launch.js +3 -0
- package/build/lib/subcommands/launch.js.map +1 -1
- package/build/lib/subcommands/list.d.ts +12 -6
- package/build/lib/subcommands/list.d.ts.map +1 -1
- package/build/lib/subcommands/list.js +18 -1
- package/build/lib/subcommands/list.js.map +1 -1
- package/build/lib/subcommands/location.d.ts +6 -3
- package/build/lib/subcommands/location.d.ts.map +1 -1
- package/build/lib/subcommands/location.js +4 -1
- package/build/lib/subcommands/location.js.map +1 -1
- package/build/lib/subcommands/openurl.d.ts +2 -1
- package/build/lib/subcommands/openurl.d.ts.map +1 -1
- package/build/lib/subcommands/openurl.js +3 -0
- package/build/lib/subcommands/openurl.js.map +1 -1
- package/build/lib/subcommands/pbcopy.d.ts +4 -3
- package/build/lib/subcommands/pbcopy.d.ts.map +1 -1
- package/build/lib/subcommands/pbcopy.js +11 -6
- package/build/lib/subcommands/pbcopy.js.map +1 -1
- package/build/lib/subcommands/pbpaste.d.ts +2 -1
- package/build/lib/subcommands/pbpaste.d.ts.map +1 -1
- package/build/lib/subcommands/pbpaste.js +3 -0
- package/build/lib/subcommands/pbpaste.js.map +1 -1
- package/build/lib/subcommands/privacy.d.ts +6 -3
- package/build/lib/subcommands/privacy.d.ts.map +1 -1
- package/build/lib/subcommands/privacy.js +3 -0
- package/build/lib/subcommands/privacy.js.map +1 -1
- package/build/lib/subcommands/push.d.ts +2 -1
- package/build/lib/subcommands/push.d.ts.map +1 -1
- package/build/lib/subcommands/push.js +1 -0
- package/build/lib/subcommands/push.js.map +1 -1
- package/build/lib/subcommands/shutdown.d.ts +2 -1
- package/build/lib/subcommands/shutdown.d.ts.map +1 -1
- package/build/lib/subcommands/shutdown.js +1 -0
- package/build/lib/subcommands/shutdown.js.map +1 -1
- package/build/lib/subcommands/spawn.d.ts +4 -2
- package/build/lib/subcommands/spawn.d.ts.map +1 -1
- package/build/lib/subcommands/spawn.js +6 -0
- package/build/lib/subcommands/spawn.js.map +1 -1
- package/build/lib/subcommands/terminate.d.ts +2 -1
- package/build/lib/subcommands/terminate.d.ts.map +1 -1
- package/build/lib/subcommands/terminate.js +1 -0
- package/build/lib/subcommands/terminate.js.map +1 -1
- package/build/lib/subcommands/ui.d.ts +4 -2
- package/build/lib/subcommands/ui.d.ts.map +1 -1
- package/build/lib/subcommands/ui.js +4 -0
- package/build/lib/subcommands/ui.js.map +1 -1
- package/build/lib/subcommands/uninstall.d.ts +2 -1
- package/build/lib/subcommands/uninstall.d.ts.map +1 -1
- package/build/lib/subcommands/uninstall.js +1 -0
- package/build/lib/subcommands/uninstall.js.map +1 -1
- package/lib/simctl.js +92 -5
- package/lib/subcommands/addmedia.js +3 -0
- package/lib/subcommands/appinfo.js +3 -0
- package/lib/subcommands/boot.js +1 -0
- package/lib/subcommands/bootstatus.js +3 -0
- package/lib/subcommands/create.js +3 -0
- package/lib/subcommands/delete.js +1 -0
- package/lib/subcommands/erase.js +1 -0
- package/lib/subcommands/get_app_container.js +2 -0
- package/lib/subcommands/getenv.js +3 -0
- package/lib/subcommands/install.js +1 -0
- package/lib/subcommands/io.js +1 -0
- package/lib/subcommands/keychain.js +9 -1
- package/lib/subcommands/launch.js +3 -0
- package/lib/subcommands/list.js +18 -1
- package/lib/subcommands/location.js +4 -1
- package/lib/subcommands/openurl.js +3 -0
- package/lib/subcommands/pbcopy.js +11 -6
- package/lib/subcommands/pbpaste.js +3 -0
- package/lib/subcommands/privacy.js +3 -0
- package/lib/subcommands/push.js +1 -0
- package/lib/subcommands/shutdown.js +1 -0
- package/lib/subcommands/spawn.js +6 -0
- package/lib/subcommands/terminate.js +1 -0
- package/lib/subcommands/ui.js +4 -0
- package/lib/subcommands/uninstall.js +1 -0
- package/package.json +3 -3
- package/build/lib/subcommands/index.d.ts +0 -3
- package/build/lib/subcommands/index.d.ts.map +0 -1
- package/build/lib/subcommands/index.js +0 -34
- package/build/lib/subcommands/index.js.map +0 -1
- package/lib/subcommands/index.js +0 -56
package/lib/subcommands/erase.js
CHANGED
|
@@ -6,6 +6,7 @@ const commands = {};
|
|
|
6
6
|
* Reset the content and settings of the particular Simulator.
|
|
7
7
|
* It is required that Simulator is in _shutdown_ state.
|
|
8
8
|
*
|
|
9
|
+
* @this {import('../simctl').Simctl}
|
|
9
10
|
* @param {number} [timeout=10000] - The maximum number of milliseconds to wait
|
|
10
11
|
* unit device reset is completed.
|
|
11
12
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
@@ -7,6 +7,7 @@ const commands = {};
|
|
|
7
7
|
* like 'com.apple.springboard'.
|
|
8
8
|
* It is required that Simulator is in _booted_ state.
|
|
9
9
|
*
|
|
10
|
+
* @this {import('../simctl').Simctl}
|
|
10
11
|
* @param {string} bundleId - Bundle identifier of an application.
|
|
11
12
|
* @param {string?} [containerType=null] - Which container type to return. Possible values
|
|
12
13
|
* are 'app', 'data', 'groups', '<A specific App Group container>'.
|
|
@@ -22,6 +23,7 @@ commands.getAppContainer = async function getAppContainer (bundleId, containerTy
|
|
|
22
23
|
if (containerType) {
|
|
23
24
|
args.push(containerType);
|
|
24
25
|
}
|
|
26
|
+
// @ts-ignore The returned type is ok
|
|
25
27
|
const {stdout} = await this.exec('get_app_container', {args});
|
|
26
28
|
return (stdout || '').trim();
|
|
27
29
|
};
|
|
@@ -3,6 +3,7 @@ const commands = {};
|
|
|
3
3
|
/**
|
|
4
4
|
* Retrieves the value of a Simulator environment variable
|
|
5
5
|
*
|
|
6
|
+
* @this {import('../simctl').Simctl}
|
|
6
7
|
* @param {string} varName - The name of the variable to be retrieved
|
|
7
8
|
* @returns {Promise<string|null>} The value of the variable or null if the given variable
|
|
8
9
|
* is not present in the Simulator environment
|
|
@@ -10,6 +11,8 @@ const commands = {};
|
|
|
10
11
|
* @throws {Error} If the `udid` instance property is unset
|
|
11
12
|
*/
|
|
12
13
|
commands.getEnv = async function getEnv (varName) {
|
|
14
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
15
|
+
// @ts-ignore the returned type is ok
|
|
13
16
|
const {stdout, stderr} = await this.exec('getenv', {
|
|
14
17
|
args: [this.requireUdid('getenv'), varName],
|
|
15
18
|
logErrors: false,
|
|
@@ -4,6 +4,7 @@ const commands = {};
|
|
|
4
4
|
* Install the particular application package on Simulator.
|
|
5
5
|
* It is required that Simulator is in _booted_ state.
|
|
6
6
|
*
|
|
7
|
+
* @this {import('../simctl').Simctl}
|
|
7
8
|
* @param {string} appPath - Full path to .app package, which is
|
|
8
9
|
* going to be installed.
|
|
9
10
|
* @throws {Error} If the corresponding simctl subcommand command
|
package/lib/subcommands/io.js
CHANGED
|
@@ -10,6 +10,7 @@ const commands = {};
|
|
|
10
10
|
* Gets base64 screenshot for device
|
|
11
11
|
* It is required that Simulator is in _booted_ state.
|
|
12
12
|
*
|
|
13
|
+
* @this {import('../simctl').Simctl}
|
|
13
14
|
* @since Xcode SDK 8.1
|
|
14
15
|
* @return {Promise<string>} Base64-encoded Simulator screenshot.
|
|
15
16
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
@@ -7,6 +7,11 @@ import { rimraf } from 'rimraf';
|
|
|
7
7
|
|
|
8
8
|
const commands = {};
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {string|Buffer} payload
|
|
13
|
+
* @param {(filePath: string) => Promise<any>} onPayloadStored
|
|
14
|
+
*/
|
|
10
15
|
async function handleRawPayload (payload, onPayloadStored) {
|
|
11
16
|
const filePath = path.resolve(os.tmpdir(), `${uuidV4()}.pem`);
|
|
12
17
|
try {
|
|
@@ -33,6 +38,7 @@ async function handleRawPayload (payload, onPayloadStored) {
|
|
|
33
38
|
* Adds the given certificate to the Trusted Root Store on the simulator
|
|
34
39
|
*
|
|
35
40
|
* @since Xcode 11.4 SDK
|
|
41
|
+
* @this {import('../simctl').Simctl}
|
|
36
42
|
* @param {string} cert the full path to a valid .cert file containing
|
|
37
43
|
* the certificate content or the certificate content itself, depending on
|
|
38
44
|
* options
|
|
@@ -45,7 +51,7 @@ commands.addRootCertificate = async function addRootCertificate (cert, opts = {}
|
|
|
45
51
|
const {
|
|
46
52
|
raw = false,
|
|
47
53
|
} = opts;
|
|
48
|
-
const execMethod = async (certPath) => await this.exec('keychain', {
|
|
54
|
+
const execMethod = async (/** @type {string} */certPath) => await this.exec('keychain', {
|
|
49
55
|
args: [this.requireUdid('keychain add-root-cert'), 'add-root-cert', certPath],
|
|
50
56
|
});
|
|
51
57
|
if (raw) {
|
|
@@ -59,6 +65,7 @@ commands.addRootCertificate = async function addRootCertificate (cert, opts = {}
|
|
|
59
65
|
* Adds the given certificate to the Keychain Store on the simulator
|
|
60
66
|
*
|
|
61
67
|
* @since Xcode 11.4 SDK
|
|
68
|
+
* @this {import('../simctl').Simctl}
|
|
62
69
|
* @param {string} cert the full path to a valid .cert file containing
|
|
63
70
|
* the certificate content or the certificate content itself, depending on
|
|
64
71
|
* options
|
|
@@ -85,6 +92,7 @@ commands.addCertificate = async function addCertificate (cert, opts = {}) {
|
|
|
85
92
|
* Resets the simulator keychain
|
|
86
93
|
*
|
|
87
94
|
* @since Xcode 11.4 SDK
|
|
95
|
+
* @this {import('../simctl').Simctl}
|
|
88
96
|
* @throws {Error} if the current SDK version does not support the command
|
|
89
97
|
* or there was an error while resetting the keychain
|
|
90
98
|
* @throws {Error} If the `udid` instance property is unset
|
|
@@ -8,6 +8,7 @@ const commands = {};
|
|
|
8
8
|
* It is required that Simulator is in _booted_ state and
|
|
9
9
|
* the application with given bundle identifier is already installed.
|
|
10
10
|
*
|
|
11
|
+
* @this {import('../simctl').Simctl}
|
|
11
12
|
* @param {string} bundleId - Bundle identifier of the application,
|
|
12
13
|
* which is going to be removed.
|
|
13
14
|
* @param {number} [tries=5] - The maximum number of retries before
|
|
@@ -20,6 +21,8 @@ const commands = {};
|
|
|
20
21
|
commands.launchApp = async function launchApp (bundleId, tries = 5) {
|
|
21
22
|
// @ts-ignore A string will always be returned
|
|
22
23
|
return await retryInterval(tries, 1000, async () => {
|
|
24
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
25
|
+
// @ts-ignore the returned type is ok
|
|
23
26
|
const {stdout} = await this.exec('launch', {
|
|
24
27
|
args: [this.requireUdid('launch'), bundleId],
|
|
25
28
|
});
|
package/lib/subcommands/list.js
CHANGED
|
@@ -17,6 +17,7 @@ const commands = {};
|
|
|
17
17
|
* Parse the list of existing Simulator devices to represent
|
|
18
18
|
* it as convenient mapping.
|
|
19
19
|
*
|
|
20
|
+
* @this {import('../simctl').Simctl}
|
|
20
21
|
* @param {string?} [platform] - The platform name, for example 'watchOS'.
|
|
21
22
|
* @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version,
|
|
22
23
|
* for example '10.3' and the corresponding value is an
|
|
@@ -25,7 +26,8 @@ const commands = {};
|
|
|
25
26
|
* returns non-zero return code.
|
|
26
27
|
*/
|
|
27
28
|
commands.getDevicesByParsing = async function getDevicesByParsing (platform) {
|
|
28
|
-
|
|
29
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
30
|
+
// @ts-ignore the returned type is ok
|
|
29
31
|
const {stdout} = await this.exec('list', {
|
|
30
32
|
args: ['devices'],
|
|
31
33
|
});
|
|
@@ -90,6 +92,7 @@ commands.getDevicesByParsing = async function getDevicesByParsing (platform) {
|
|
|
90
92
|
* Parse the list of existing Simulator devices to represent
|
|
91
93
|
* it as convenient mapping for the particular platform version.
|
|
92
94
|
*
|
|
95
|
+
* @this {import('../simctl').Simctl}
|
|
93
96
|
* @param {string?} [forSdk] - The sdk version,
|
|
94
97
|
* for which the devices list should be parsed,
|
|
95
98
|
* for example '10.3'.
|
|
@@ -105,6 +108,8 @@ commands.getDevicesByParsing = async function getDevicesByParsing (platform) {
|
|
|
105
108
|
commands.getDevices = async function getDevices (forSdk, platform) {
|
|
106
109
|
let devices = {};
|
|
107
110
|
try {
|
|
111
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
112
|
+
// @ts-ignore the returned type is ok
|
|
108
113
|
const {stdout} = await this.exec('list', {
|
|
109
114
|
args: ['devices', '-j'],
|
|
110
115
|
});
|
|
@@ -174,6 +179,7 @@ commands.getDevices = async function getDevices (forSdk, platform) {
|
|
|
174
179
|
/**
|
|
175
180
|
* Get the runtime for the particular platform version using --json flag
|
|
176
181
|
*
|
|
182
|
+
* @this {import('../simctl').Simctl}
|
|
177
183
|
* @param {string} platformVersion - The platform version name,
|
|
178
184
|
* for example '10.3'.
|
|
179
185
|
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
|
|
@@ -182,6 +188,8 @@ commands.getDevices = async function getDevices (forSdk, platform) {
|
|
|
182
188
|
*/
|
|
183
189
|
commands.getRuntimeForPlatformVersionViaJson = async function getRuntimeForPlatformVersionViaJson (
|
|
184
190
|
platformVersion, platform = 'iOS') {
|
|
191
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
192
|
+
// @ts-ignore the returned type is ok
|
|
185
193
|
const {stdout} = await this.exec('list', {
|
|
186
194
|
args: ['runtimes', '--json'],
|
|
187
195
|
});
|
|
@@ -197,6 +205,7 @@ commands.getRuntimeForPlatformVersionViaJson = async function getRuntimeForPlatf
|
|
|
197
205
|
/**
|
|
198
206
|
* Get the runtime for the particular platform version.
|
|
199
207
|
*
|
|
208
|
+
* @this {import('../simctl').Simctl}
|
|
200
209
|
* @param {string} platformVersion - The platform version name,
|
|
201
210
|
* for example '10.3'.
|
|
202
211
|
* @param {string} [platform='iOS'] - The platform name, for example 'watchOS'.
|
|
@@ -207,6 +216,8 @@ commands.getRuntimeForPlatformVersion = async function getRuntimeForPlatformVers
|
|
|
207
216
|
platformVersion, platform = 'iOS') {
|
|
208
217
|
// Try with parsing
|
|
209
218
|
try {
|
|
219
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
220
|
+
// @ts-ignore The returned type is ok
|
|
210
221
|
const {stdout} = await this.exec('list', {
|
|
211
222
|
args: ['runtimes'],
|
|
212
223
|
});
|
|
@@ -228,10 +239,13 @@ commands.getRuntimeForPlatformVersion = async function getRuntimeForPlatformVers
|
|
|
228
239
|
/**
|
|
229
240
|
* Get the list of device types available in the current Xcode installation
|
|
230
241
|
*
|
|
242
|
+
* @this {import('../simctl').Simctl}
|
|
231
243
|
* @return {Promise<string[]>} List of the types of devices available
|
|
232
244
|
* @throws {Error} If the corresponding simctl command fails
|
|
233
245
|
*/
|
|
234
246
|
commands.getDeviceTypes = async function getDeviceTypes () {
|
|
247
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
248
|
+
// @ts-ignore The returned type is ok
|
|
235
249
|
const {stdout} = await this.exec('list', {
|
|
236
250
|
args: ['devicetypes', '-j'],
|
|
237
251
|
});
|
|
@@ -257,6 +271,7 @@ commands.getDeviceTypes = async function getDeviceTypes () {
|
|
|
257
271
|
/**
|
|
258
272
|
* Get the full list of runtimes, devicetypes, devices and pairs as Object
|
|
259
273
|
*
|
|
274
|
+
* @this {import('../simctl').Simctl}
|
|
260
275
|
* @return {Promise<Object>} Object containing device types, runtimes devices and pairs.
|
|
261
276
|
* The resulting JSON will be like:
|
|
262
277
|
* {
|
|
@@ -289,6 +304,8 @@ commands.getDeviceTypes = async function getDeviceTypes () {
|
|
|
289
304
|
* @throws {Error} If the corresponding simctl command fails
|
|
290
305
|
*/
|
|
291
306
|
commands.list = async function list () {
|
|
307
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
308
|
+
// @ts-ignore The returned type is ok
|
|
292
309
|
const {stdout} = await this.exec('list', {
|
|
293
310
|
args: ['-j'],
|
|
294
311
|
});
|
|
@@ -19,6 +19,7 @@ function formatArg (name, value) {
|
|
|
19
19
|
* Set the Simulator location to a specific latitude and longitude.
|
|
20
20
|
* This functionality is only available since Xcode 14.
|
|
21
21
|
*
|
|
22
|
+
* @this {import('../simctl').Simctl}
|
|
22
23
|
* @param {string|number} latitude Location latitude value
|
|
23
24
|
* @param {string|number} longitude Location longitude value
|
|
24
25
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
@@ -35,7 +36,9 @@ commands.setLocation = async function setLocation (latitude, longitude) {
|
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* Stop any running scenario and clear any simulated location.
|
|
38
|
-
*
|
|
39
|
+
*
|
|
40
|
+
* @since Xcode 14.
|
|
41
|
+
* @this {import('../simctl').Simctl}
|
|
39
42
|
*/
|
|
40
43
|
commands.clearLocation = async function clearLocation () {
|
|
41
44
|
await this.exec('location', {
|
|
@@ -5,6 +5,7 @@ const commands = {};
|
|
|
5
5
|
* to find a matching application, which supports the given scheme.
|
|
6
6
|
* It is required that Simulator is in _booted_ state.
|
|
7
7
|
*
|
|
8
|
+
* @this {import('../simctl').Simctl}
|
|
8
9
|
* @param {string} url - The URL scheme to open, for example http://appiom.io
|
|
9
10
|
* will be opened by the built-in mobile browser.
|
|
10
11
|
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
|
|
@@ -13,6 +14,8 @@ const commands = {};
|
|
|
13
14
|
* @throws {Error} If the `udid` instance property is unset
|
|
14
15
|
*/
|
|
15
16
|
commands.openUrl = async function openUrl (url) {
|
|
17
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
18
|
+
// @ts-ignore The returned type is ok
|
|
16
19
|
return await this.exec('openurl', {
|
|
17
20
|
args: [this.requireUdid('openurl'), url],
|
|
18
21
|
});
|
|
@@ -5,24 +5,29 @@ const commands = {};
|
|
|
5
5
|
* It is required that Simulator is in _booted_ state.
|
|
6
6
|
*
|
|
7
7
|
* @since Xcode SDK 8.1
|
|
8
|
+
* @this {import('../simctl').Simctl}
|
|
8
9
|
* @param {string} content - The actual string content to be set.
|
|
9
|
-
* @param {
|
|
10
|
-
*
|
|
10
|
+
* @param {BufferEncoding} [encoding='utf8'] - The encoding of the given pasteboard content.
|
|
11
|
+
* utf8 by default.
|
|
11
12
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
12
13
|
* returns non-zero return code.
|
|
13
14
|
* @throws {Error} If the `udid` instance property is unset
|
|
14
15
|
*/
|
|
15
16
|
commands.setPasteboard = async function setPasteboard (content, encoding = 'utf8') {
|
|
17
|
+
/** @type {import('teen_process').SubProcess} */
|
|
18
|
+
// @ts-ignore The returned type is ok
|
|
16
19
|
const pbCopySubprocess = await this.exec('pbcopy', {
|
|
17
20
|
args: [this.requireUdid('pbcopy')],
|
|
18
21
|
asynchronous: true,
|
|
19
22
|
});
|
|
20
23
|
await pbCopySubprocess.start(0);
|
|
21
24
|
const exitCodeVerifier = pbCopySubprocess.join();
|
|
22
|
-
const stdin = pbCopySubprocess.proc
|
|
23
|
-
stdin
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
const stdin = pbCopySubprocess.proc?.stdin;
|
|
26
|
+
if (stdin) {
|
|
27
|
+
stdin.setDefaultEncoding(encoding);
|
|
28
|
+
stdin.write(content);
|
|
29
|
+
stdin.end();
|
|
30
|
+
}
|
|
26
31
|
await exitCodeVerifier;
|
|
27
32
|
};
|
|
28
33
|
|
|
@@ -5,6 +5,7 @@ const commands = {};
|
|
|
5
5
|
* It is required that Simulator is in _booted_ state.
|
|
6
6
|
*
|
|
7
7
|
* @since Xcode 8.1 SDK
|
|
8
|
+
* @this {import('../simctl').Simctl}
|
|
8
9
|
* @param {string} [encoding='utf8'] - The encoding of the returned pasteboard content.
|
|
9
10
|
* UTF-8 by default.
|
|
10
11
|
* @return {Promise<string>} Current content of Simulator pasteboard or an empty string.
|
|
@@ -13,6 +14,8 @@ const commands = {};
|
|
|
13
14
|
* @throws {Error} If the `udid` instance property is unset
|
|
14
15
|
*/
|
|
15
16
|
commands.getPasteboard = async function getPasteboard (encoding = 'utf8') {
|
|
17
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
18
|
+
// @ts-ignore The returned type is ok
|
|
16
19
|
const {stdout} = await this.exec('pbpaste', {
|
|
17
20
|
args: [this.requireUdid('pbpaste')],
|
|
18
21
|
encoding,
|
|
@@ -4,6 +4,7 @@ const commands = {};
|
|
|
4
4
|
* Grants the given permission on the app with the given bundle identifier
|
|
5
5
|
*
|
|
6
6
|
* @since Xcode 11.4 SDK
|
|
7
|
+
* @this {import('../simctl').Simctl}
|
|
7
8
|
* @param {string} bundleId the identifier of the application whose
|
|
8
9
|
* privacy settings are going to be changed
|
|
9
10
|
* @param {string} perm one of possible permission values:
|
|
@@ -35,6 +36,7 @@ commands.grantPermission = async function grantPermission (bundleId, perm) {
|
|
|
35
36
|
* after it has been granted
|
|
36
37
|
*
|
|
37
38
|
* @since Xcode 11.4 SDK
|
|
39
|
+
* @this {import('../simctl').Simctl}
|
|
38
40
|
* @param {string} bundleId the identifier of the application whose
|
|
39
41
|
* privacy settings are going to be changed
|
|
40
42
|
* @param {string} perm one of possible permission values (see `grantPermission`)
|
|
@@ -53,6 +55,7 @@ commands.revokePermission = async function revokePermission (bundleId, perm) {
|
|
|
53
55
|
* to its default state
|
|
54
56
|
*
|
|
55
57
|
* @since Xcode 11.4 SDK
|
|
58
|
+
* @this {import('../simctl').Simctl}
|
|
56
59
|
* @param {string} bundleId the identifier of the application whose
|
|
57
60
|
* privacy settings are going to be changed
|
|
58
61
|
* @param {string} perm one of possible permission values (see `grantPermission`)
|
package/lib/subcommands/push.js
CHANGED
|
@@ -10,6 +10,7 @@ const commands = {};
|
|
|
10
10
|
* Send a simulated push notification
|
|
11
11
|
*
|
|
12
12
|
* @since Xcode 11.4 SDK
|
|
13
|
+
* @this {import('../simctl').Simctl}
|
|
13
14
|
* @param {Object} payload - The object that describes Apple push notification content.
|
|
14
15
|
* It must contain a top-level "Simulator Target Bundle" key with a string value matching
|
|
15
16
|
* the target application‘s bundle identifier and "aps" key with valid Apple Push Notification values.
|
|
@@ -6,6 +6,7 @@ const commands = {};
|
|
|
6
6
|
/**
|
|
7
7
|
* Shutdown the given Simulator if it is running.
|
|
8
8
|
*
|
|
9
|
+
* @this {import('../simctl').Simctl}
|
|
9
10
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
10
11
|
* returns non-zero return code.
|
|
11
12
|
* @throws {Error} If the `udid` instance property is unset
|
package/lib/subcommands/spawn.js
CHANGED
|
@@ -7,6 +7,7 @@ const commands = {};
|
|
|
7
7
|
* Spawn the particular process on Simulator.
|
|
8
8
|
* It is required that Simulator is in _booted_ state.
|
|
9
9
|
*
|
|
10
|
+
* @this {import('../simctl').Simctl}
|
|
10
11
|
* @param {string|string[]} args - Spawn arguments
|
|
11
12
|
* @param {object} [env={}] - Additional environment variables mapping.
|
|
12
13
|
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
|
|
@@ -19,6 +20,8 @@ commands.spawnProcess = async function spawnProcess (args, env = {}) {
|
|
|
19
20
|
throw new Error('Spawn arguments are required');
|
|
20
21
|
}
|
|
21
22
|
|
|
23
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
24
|
+
// @ts-ignore The returned type is ok
|
|
22
25
|
return await this.exec('spawn', {
|
|
23
26
|
args: [this.requireUdid('spawn'), ...(_.isArray(args) ? args : [args])],
|
|
24
27
|
env,
|
|
@@ -29,6 +32,7 @@ commands.spawnProcess = async function spawnProcess (args, env = {}) {
|
|
|
29
32
|
* Prepare SubProcess instance for a new process, which is going to be spawned
|
|
30
33
|
* on Simulator.
|
|
31
34
|
*
|
|
35
|
+
* @this {import('../simctl').Simctl}
|
|
32
36
|
* @param {string|string[]} args - Spawn arguments
|
|
33
37
|
* @param {object} [env={}] - Additional environment variables mapping.
|
|
34
38
|
* @return {Promise<import('teen_process').SubProcess>} The instance of the process to be spawned.
|
|
@@ -39,6 +43,8 @@ commands.spawnSubProcess = async function spawnSubProcess (args, env = {}) {
|
|
|
39
43
|
throw new Error('Spawn arguments are required');
|
|
40
44
|
}
|
|
41
45
|
|
|
46
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
47
|
+
// @ts-ignore The returned type is ok
|
|
42
48
|
return await this.exec('spawn', {
|
|
43
49
|
args: [this.requireUdid('spawn'), ...(_.isArray(args) ? args : [args])],
|
|
44
50
|
env,
|
|
@@ -4,6 +4,7 @@ const commands = {};
|
|
|
4
4
|
* Terminate the given running application on Simulator.
|
|
5
5
|
* It is required that Simulator is in _booted_ state.
|
|
6
6
|
*
|
|
7
|
+
* @this {import('../simctl').Simctl}
|
|
7
8
|
* @param {string} bundleId - Bundle identifier of the application,
|
|
8
9
|
* which is going to be terminated.
|
|
9
10
|
* @throws {Error} If the corresponding simctl subcommand command
|
package/lib/subcommands/ui.js
CHANGED
|
@@ -7,12 +7,15 @@ const commands = {};
|
|
|
7
7
|
* Retrieves the current UI appearance value from the given simulator
|
|
8
8
|
*
|
|
9
9
|
* @since Xcode 11.4 SDK
|
|
10
|
+
* @this {import('../simctl').Simctl}
|
|
10
11
|
* @return {Promise<string>} the appearance value, for example 'light' or 'dark'
|
|
11
12
|
* @throws {Error} if the current SDK version does not support the command
|
|
12
13
|
* or there was an error while getting the value
|
|
13
14
|
* @throws {Error} If the `udid` instance property is unset
|
|
14
15
|
*/
|
|
15
16
|
commands.getAppearance = async function getAppearance () {
|
|
17
|
+
/** @type {import('teen_process').TeenProcessExecResult} */
|
|
18
|
+
// @ts-ignore We know the returned type is ok
|
|
16
19
|
const {stdout} = await this.exec('ui', {
|
|
17
20
|
args: [this.requireUdid('ui'), 'appearance'],
|
|
18
21
|
});
|
|
@@ -23,6 +26,7 @@ commands.getAppearance = async function getAppearance () {
|
|
|
23
26
|
* Sets the UI appearance to the given style
|
|
24
27
|
*
|
|
25
28
|
* @since Xcode 11.4 SDK
|
|
29
|
+
* @this {import('../simctl').Simctl}
|
|
26
30
|
* @param {string} appearance valid appearance value, for example 'light' or 'dark'
|
|
27
31
|
* @throws {Error} if the current SDK version does not support the command
|
|
28
32
|
* or there was an error while getting the value
|
|
@@ -5,6 +5,7 @@ const commands = {};
|
|
|
5
5
|
* It is required that Simulator is in _booted_ state and
|
|
6
6
|
* the application with given bundle identifier is already installed.
|
|
7
7
|
*
|
|
8
|
+
* @this {import('../simctl').Simctl}
|
|
8
9
|
* @param {string} bundleId - Bundle identifier of the application,
|
|
9
10
|
* which is going to be removed.
|
|
10
11
|
* @throws {Error} If the corresponding simctl subcommand command
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"ios",
|
|
7
7
|
"simctl"
|
|
8
8
|
],
|
|
9
|
-
"version": "7.3.
|
|
9
|
+
"version": "7.3.6",
|
|
10
10
|
"author": "Appium Contributors",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"repository": {
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@types/node": "^20.4.7",
|
|
87
87
|
"@types/sinon": "^10.0.16",
|
|
88
88
|
"@types/sinon-chai": "^3.2.9",
|
|
89
|
-
"@types/teen_process": "2.0.
|
|
89
|
+
"@types/teen_process": "2.0.1",
|
|
90
90
|
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
91
91
|
"@typescript-eslint/parser": "^5.62.0",
|
|
92
92
|
"appium-xcode": "^5.0.0",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"prettier": "^3.0.0",
|
|
106
106
|
"proxyquire": "^2.1.3",
|
|
107
107
|
"semantic-release": "^21.1.0",
|
|
108
|
-
"sinon": "^
|
|
108
|
+
"sinon": "^16.0.0",
|
|
109
109
|
"ts-node": "^10.9.1",
|
|
110
110
|
"typescript": "^5.1.6"
|
|
111
111
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../lib/subcommands/index.js"],"names":[],"mappings":";AA2BA,+BA0BE"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const addmedia_1 = __importDefault(require("./addmedia"));
|
|
7
|
-
const appinfo_1 = __importDefault(require("./appinfo"));
|
|
8
|
-
const boot_1 = __importDefault(require("./boot"));
|
|
9
|
-
const bootstatus_1 = __importDefault(require("./bootstatus"));
|
|
10
|
-
const create_1 = __importDefault(require("./create"));
|
|
11
|
-
const delete_1 = __importDefault(require("./delete"));
|
|
12
|
-
const erase_1 = __importDefault(require("./erase"));
|
|
13
|
-
const get_app_container_1 = __importDefault(require("./get_app_container"));
|
|
14
|
-
const install_1 = __importDefault(require("./install"));
|
|
15
|
-
const io_1 = __importDefault(require("./io"));
|
|
16
|
-
const keychain_1 = __importDefault(require("./keychain"));
|
|
17
|
-
const launch_1 = __importDefault(require("./launch"));
|
|
18
|
-
const list_1 = __importDefault(require("./list"));
|
|
19
|
-
const openurl_1 = __importDefault(require("./openurl"));
|
|
20
|
-
const pbcopy_1 = __importDefault(require("./pbcopy"));
|
|
21
|
-
const pbpaste_1 = __importDefault(require("./pbpaste"));
|
|
22
|
-
const privacy_1 = __importDefault(require("./privacy"));
|
|
23
|
-
const push_1 = __importDefault(require("./push"));
|
|
24
|
-
const getenv_1 = __importDefault(require("./getenv"));
|
|
25
|
-
const shutdown_1 = __importDefault(require("./shutdown"));
|
|
26
|
-
const spawn_1 = __importDefault(require("./spawn"));
|
|
27
|
-
const terminate_1 = __importDefault(require("./terminate"));
|
|
28
|
-
const ui_1 = __importDefault(require("./ui"));
|
|
29
|
-
const uninstall_1 = __importDefault(require("./uninstall"));
|
|
30
|
-
const location_1 = __importDefault(require("./location"));
|
|
31
|
-
// xcrun simctl --help
|
|
32
|
-
const subcommands = Object.assign({}, addmedia_1.default, appinfo_1.default, boot_1.default, bootstatus_1.default, create_1.default, delete_1.default, erase_1.default, get_app_container_1.default, install_1.default, io_1.default, keychain_1.default, launch_1.default, list_1.default, openurl_1.default, pbcopy_1.default, pbpaste_1.default, privacy_1.default, push_1.default, getenv_1.default, shutdown_1.default, spawn_1.default, terminate_1.default, ui_1.default, uninstall_1.default, location_1.default);
|
|
33
|
-
exports.default = subcommands;
|
|
34
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/subcommands/index.js"],"names":[],"mappings":";;;;;AAAA,0DAA0C;AAC1C,wDAAwC;AACxC,kDAAkC;AAClC,8DAA8C;AAC9C,sDAAsC;AACtC,sDAAsC;AACtC,oDAAoC;AACpC,4EAA0D;AAC1D,wDAAwC;AACxC,8CAA8B;AAC9B,0DAA0C;AAC1C,sDAAsC;AACtC,kDAAkC;AAClC,wDAAwC;AACxC,sDAAsC;AACtC,wDAAwC;AACxC,wDAAwC;AACxC,kDAAkC;AAClC,sDAAmC;AACnC,0DAA0C;AAC1C,oDAAoC;AACpC,4DAA4C;AAC5C,8CAA8B;AAC9B,4DAA4C;AAC5C,0DAA0C;AAE1C,sBAAsB;AACtB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,EAChC,kBAAgB,EAChB,iBAAe,EACf,cAAY,EACZ,oBAAkB,EAClB,gBAAc,EACd,gBAAc,EACd,eAAa,EACb,2BAAuB,EACvB,iBAAe,EACf,YAAU,EACV,kBAAgB,EAChB,gBAAc,EACd,cAAY,EACZ,iBAAe,EACf,gBAAc,EACd,iBAAe,EACf,iBAAe,EACf,cAAY,EACZ,gBAAW,EACX,kBAAgB,EAChB,eAAa,EACb,mBAAiB,EACjB,YAAU,EACV,mBAAiB,EACjB,kBAAgB,CACnB,CAAC;AAEF,kBAAe,WAAW,CAAC"}
|
package/lib/subcommands/index.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import addmediaCommands from './addmedia';
|
|
2
|
-
import appinfoCommands from './appinfo';
|
|
3
|
-
import bootCommands from './boot';
|
|
4
|
-
import bootstatusCommands from './bootstatus';
|
|
5
|
-
import createCommands from './create';
|
|
6
|
-
import deleteCommands from './delete';
|
|
7
|
-
import eraseCommands from './erase';
|
|
8
|
-
import getappcontainerCommands from './get_app_container';
|
|
9
|
-
import installCommands from './install';
|
|
10
|
-
import ioCommands from './io';
|
|
11
|
-
import keychainCommands from './keychain';
|
|
12
|
-
import launchCommands from './launch';
|
|
13
|
-
import listCommands from './list';
|
|
14
|
-
import openurlCommands from './openurl';
|
|
15
|
-
import pbcopyCommands from './pbcopy';
|
|
16
|
-
import pbpasteCommands from './pbpaste';
|
|
17
|
-
import privacyCommands from './privacy';
|
|
18
|
-
import pushCommands from './push';
|
|
19
|
-
import envCommands from './getenv';
|
|
20
|
-
import shutdownCommands from './shutdown';
|
|
21
|
-
import spawnCommands from './spawn';
|
|
22
|
-
import terminateCommands from './terminate';
|
|
23
|
-
import uiCommands from './ui';
|
|
24
|
-
import uninstallCommands from './uninstall';
|
|
25
|
-
import locationCommands from './location';
|
|
26
|
-
|
|
27
|
-
// xcrun simctl --help
|
|
28
|
-
const subcommands = Object.assign({},
|
|
29
|
-
addmediaCommands,
|
|
30
|
-
appinfoCommands,
|
|
31
|
-
bootCommands,
|
|
32
|
-
bootstatusCommands,
|
|
33
|
-
createCommands,
|
|
34
|
-
deleteCommands,
|
|
35
|
-
eraseCommands,
|
|
36
|
-
getappcontainerCommands,
|
|
37
|
-
installCommands,
|
|
38
|
-
ioCommands,
|
|
39
|
-
keychainCommands,
|
|
40
|
-
launchCommands,
|
|
41
|
-
listCommands,
|
|
42
|
-
openurlCommands,
|
|
43
|
-
pbcopyCommands,
|
|
44
|
-
pbpasteCommands,
|
|
45
|
-
privacyCommands,
|
|
46
|
-
pushCommands,
|
|
47
|
-
envCommands,
|
|
48
|
-
shutdownCommands,
|
|
49
|
-
spawnCommands,
|
|
50
|
-
terminateCommands,
|
|
51
|
-
uiCommands,
|
|
52
|
-
uninstallCommands,
|
|
53
|
-
locationCommands,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
export default subcommands;
|