node-simctl 7.2.1 → 7.3.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/CHANGELOG.md +14 -0
- package/build/index.js +9 -17
- package/build/lib/helpers.d.ts +13 -0
- package/build/lib/helpers.d.ts.map +1 -0
- package/build/lib/helpers.js +22 -16
- package/build/lib/helpers.js.map +1 -1
- package/build/lib/logger.d.ts +4 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +13 -19
- package/build/lib/logger.js.map +1 -1
- package/build/lib/simctl.d.ts +131 -0
- package/build/lib/simctl.d.ts.map +1 -0
- package/build/lib/simctl.js +170 -94
- package/build/lib/simctl.js.map +1 -1
- package/build/lib/subcommands/addmedia.d.ts +16 -0
- package/build/lib/subcommands/addmedia.d.ts.map +1 -0
- package/build/lib/subcommands/addmedia.js +17 -12
- package/build/lib/subcommands/addmedia.js.map +1 -1
- package/build/lib/subcommands/appinfo.d.ts +45 -0
- package/build/lib/subcommands/appinfo.d.ts.map +1 -0
- package/build/lib/subcommands/appinfo.js +47 -15
- package/build/lib/subcommands/appinfo.js.map +1 -1
- package/build/lib/subcommands/boot.d.ts +12 -0
- package/build/lib/subcommands/boot.d.ts.map +1 -0
- package/build/lib/subcommands/boot.js +47 -22
- package/build/lib/subcommands/boot.js.map +1 -1
- package/build/lib/subcommands/bootstatus.d.ts +56 -0
- package/build/lib/subcommands/bootstatus.d.ts.map +1 -0
- package/build/lib/subcommands/bootstatus.js +102 -87
- package/build/lib/subcommands/bootstatus.js.map +1 -1
- package/build/lib/subcommands/create.d.ts +34 -0
- package/build/lib/subcommands/create.d.ts.map +1 -0
- package/build/lib/subcommands/create.js +115 -65
- package/build/lib/subcommands/create.js.map +1 -1
- package/build/lib/subcommands/delete.d.ts +12 -0
- package/build/lib/subcommands/delete.d.ts.map +1 -0
- package/build/lib/subcommands/delete.js +13 -12
- package/build/lib/subcommands/delete.js.map +1 -1
- package/build/lib/subcommands/erase.d.ts +15 -0
- package/build/lib/subcommands/erase.d.ts.map +1 -0
- package/build/lib/subcommands/erase.js +19 -14
- package/build/lib/subcommands/erase.js.map +1 -1
- package/build/lib/subcommands/get_app_container.d.ts +22 -0
- package/build/lib/subcommands/get_app_container.d.ts.map +1 -0
- package/build/lib/subcommands/get_app_container.js +26 -19
- package/build/lib/subcommands/get_app_container.js.map +1 -1
- package/build/lib/subcommands/getenv.d.ts +14 -0
- package/build/lib/subcommands/getenv.d.ts.map +1 -0
- package/build/lib/subcommands/getenv.js +17 -17
- package/build/lib/subcommands/getenv.js.map +1 -1
- package/build/lib/subcommands/index.d.ts +3 -0
- package/build/lib/subcommands/index.d.ts.map +1 -0
- package/build/lib/subcommands/index.js +33 -36
- package/build/lib/subcommands/index.js.map +1 -1
- package/build/lib/subcommands/install.d.ts +15 -0
- package/build/lib/subcommands/install.d.ts.map +1 -0
- package/build/lib/subcommands/install.js +16 -12
- package/build/lib/subcommands/install.js.map +1 -1
- package/build/lib/subcommands/io.d.ts +15 -0
- package/build/lib/subcommands/io.d.ts.map +1 -0
- package/build/lib/subcommands/io.js +32 -25
- package/build/lib/subcommands/io.js.map +1 -1
- package/build/lib/subcommands/keychain.d.ts +53 -0
- package/build/lib/subcommands/keychain.d.ts.map +1 -0
- package/build/lib/subcommands/keychain.js +85 -51
- package/build/lib/subcommands/keychain.js.map +1 -1
- package/build/lib/subcommands/launch.d.ts +19 -0
- package/build/lib/subcommands/launch.d.ts.map +1 -0
- package/build/lib/subcommands/launch.js +28 -19
- package/build/lib/subcommands/launch.js.map +1 -1
- package/build/lib/subcommands/list.d.ts +120 -0
- package/build/lib/subcommands/list.d.ts.map +1 -0
- package/build/lib/subcommands/list.js +296 -138
- package/build/lib/subcommands/list.js.map +1 -1
- package/build/lib/subcommands/location.d.ts +20 -0
- package/build/lib/subcommands/location.d.ts.map +1 -0
- package/build/lib/subcommands/location.js +37 -22
- package/build/lib/subcommands/location.js.map +1 -1
- package/build/lib/subcommands/openurl.d.ts +17 -0
- package/build/lib/subcommands/openurl.d.ts.map +1 -0
- package/build/lib/subcommands/openurl.js +18 -12
- package/build/lib/subcommands/openurl.js.map +1 -1
- package/build/lib/subcommands/pbcopy.d.ts +17 -0
- package/build/lib/subcommands/pbcopy.d.ts.map +1 -0
- package/build/lib/subcommands/pbcopy.js +26 -20
- package/build/lib/subcommands/pbcopy.js.map +1 -1
- package/build/lib/subcommands/pbpaste.d.ts +17 -0
- package/build/lib/subcommands/pbpaste.d.ts.map +1 -0
- package/build/lib/subcommands/pbpaste.js +20 -16
- package/build/lib/subcommands/pbpaste.js.map +1 -1
- package/build/lib/subcommands/privacy.d.ts +55 -0
- package/build/lib/subcommands/privacy.d.ts.map +1 -0
- package/build/lib/subcommands/privacy.js +60 -18
- package/build/lib/subcommands/privacy.js.map +1 -1
- package/build/lib/subcommands/push.d.ts +25 -0
- package/build/lib/subcommands/push.d.ts.map +1 -0
- package/build/lib/subcommands/push.js +41 -24
- package/build/lib/subcommands/push.js.map +1 -1
- package/build/lib/subcommands/shutdown.d.ts +12 -0
- package/build/lib/subcommands/shutdown.d.ts.map +1 -0
- package/build/lib/subcommands/shutdown.js +47 -22
- package/build/lib/subcommands/shutdown.js.map +1 -1
- package/build/lib/subcommands/spawn.d.ts +26 -0
- package/build/lib/subcommands/spawn.d.ts.map +1 -0
- package/build/lib/subcommands/spawn.js +42 -26
- package/build/lib/subcommands/spawn.js.map +1 -1
- package/build/lib/subcommands/terminate.d.ts +15 -0
- package/build/lib/subcommands/terminate.d.ts.map +1 -0
- package/build/lib/subcommands/terminate.js +16 -12
- package/build/lib/subcommands/terminate.js.map +1 -1
- package/build/lib/subcommands/ui.d.ts +24 -0
- package/build/lib/subcommands/ui.d.ts.map +1 -0
- package/build/lib/subcommands/ui.js +32 -20
- package/build/lib/subcommands/ui.js.map +1 -1
- package/build/lib/subcommands/uninstall.d.ts +16 -0
- package/build/lib/subcommands/uninstall.d.ts.map +1 -0
- package/build/lib/subcommands/uninstall.js +17 -12
- package/build/lib/subcommands/uninstall.js.map +1 -1
- package/lib/simctl.js +13 -3
- package/lib/subcommands/addmedia.js +1 -1
- package/lib/subcommands/bootstatus.js +2 -2
- package/lib/subcommands/create.js +2 -2
- package/lib/subcommands/erase.js +1 -1
- package/lib/subcommands/keychain.js +2 -2
- package/lib/subcommands/launch.js +1 -0
- package/lib/subcommands/list.js +6 -6
- package/lib/subcommands/location.js +1 -1
- package/lib/subcommands/openurl.js +1 -1
- package/lib/subcommands/spawn.js +2 -2
- package/package.json +29 -18
|
@@ -6,7 +6,7 @@ const commands = {};
|
|
|
6
6
|
*
|
|
7
7
|
* @param {string} filePath - Full path to a media file on the local
|
|
8
8
|
* file system.
|
|
9
|
-
* @return {Promise<
|
|
9
|
+
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
|
|
10
10
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
11
11
|
* returns non-zero return code.
|
|
12
12
|
* @throws {Error} If the `udid` instance property is unset
|
|
@@ -22,8 +22,8 @@ const commands = {};
|
|
|
22
22
|
* until Simulator booting is completed.
|
|
23
23
|
* The method is only available since Xcode8.
|
|
24
24
|
*
|
|
25
|
-
* @param {BootMonitorOptions} opts - Monitoring options.
|
|
26
|
-
* @returns {Promise<SubProcess>} The instance of the corresponding monitoring process.
|
|
25
|
+
* @param {Partial<BootMonitorOptions>} opts - Monitoring options.
|
|
26
|
+
* @returns {Promise<import('teen_process').SubProcess>} The instance of the corresponding monitoring process.
|
|
27
27
|
* @throws {Error} If the Simulator fails to finish booting within the given timeout and onFinished
|
|
28
28
|
* property is not set.
|
|
29
29
|
* @throws {Error} If the `udid` instance property is unset
|
|
@@ -23,7 +23,7 @@ const commands = {};
|
|
|
23
23
|
* @param {string} name - The device name to be created.
|
|
24
24
|
* @param {string} deviceTypeId - Device type, for example 'iPhone 6'.
|
|
25
25
|
* @param {string} platformVersion - Platform version, for example '10.3'.
|
|
26
|
-
* @param {SimCreationOpts} opts - Simulator options for creating devices.
|
|
26
|
+
* @param {Partial<SimCreationOpts>} opts - Simulator options for creating devices.
|
|
27
27
|
* @return {Promise<string>} The UDID of the newly created device.
|
|
28
28
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
29
29
|
* returns non-zero return code.
|
|
@@ -92,7 +92,7 @@ commands.createDevice = async function createDevice (name, deviceTypeId, platfor
|
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// make sure that it gets out of the "Creating" state
|
|
95
|
-
const retries = parseInt(timeout / 1000
|
|
95
|
+
const retries = parseInt(`${timeout / 1000}`, 10);
|
|
96
96
|
await retryInterval(retries, 1000, async () => {
|
|
97
97
|
const devices = _.values(await this.getDevices());
|
|
98
98
|
for (const deviceArr of _.values(devices)) {
|
package/lib/subcommands/erase.js
CHANGED
|
@@ -14,7 +14,7 @@ const commands = {};
|
|
|
14
14
|
*/
|
|
15
15
|
commands.eraseDevice = async function eraseDevice (timeout = 1000) {
|
|
16
16
|
// retry erase with a sleep in between because it's flakey
|
|
17
|
-
const retries = parseInt(timeout / 200
|
|
17
|
+
const retries = parseInt(`${timeout / 200}`, 10);
|
|
18
18
|
await retryInterval(retries, 200,
|
|
19
19
|
async () => await this.exec('erase', {
|
|
20
20
|
args: [this.requireUdid('erase')]
|
|
@@ -36,7 +36,7 @@ async function handleRawPayload (payload, onPayloadStored) {
|
|
|
36
36
|
* @param {string} cert the full path to a valid .cert file containing
|
|
37
37
|
* the certificate content or the certificate content itself, depending on
|
|
38
38
|
* options
|
|
39
|
-
* @param {CertOptions} opts
|
|
39
|
+
* @param {Partial<CertOptions>} opts
|
|
40
40
|
* @throws {Error} if the current SDK version does not support the command
|
|
41
41
|
* or there was an error while adding the certificate
|
|
42
42
|
* @throws {Error} If the `udid` instance property is unset
|
|
@@ -62,7 +62,7 @@ commands.addRootCertificate = async function addRootCertificate (cert, opts = {}
|
|
|
62
62
|
* @param {string} cert the full path to a valid .cert file containing
|
|
63
63
|
* the certificate content or the certificate content itself, depending on
|
|
64
64
|
* options
|
|
65
|
-
* @param {CertOptions} opts
|
|
65
|
+
* @param {Partial<CertOptions>} opts
|
|
66
66
|
* @throws {Error} if the current SDK version does not support the command
|
|
67
67
|
* or there was an error while adding the certificate
|
|
68
68
|
* @throws {Error} If the `udid` instance property is unset
|
|
@@ -18,6 +18,7 @@ const commands = {};
|
|
|
18
18
|
* @throws {Error} If the `udid` instance property is unset
|
|
19
19
|
*/
|
|
20
20
|
commands.launchApp = async function launchApp (bundleId, tries = 5) {
|
|
21
|
+
// @ts-ignore A string will always be returned
|
|
21
22
|
return await retryInterval(tries, 1000, async () => {
|
|
22
23
|
const {stdout} = await this.exec('launch', {
|
|
23
24
|
args: [this.requireUdid('launch'), bundleId],
|
package/lib/subcommands/list.js
CHANGED
|
@@ -17,8 +17,8 @@ const commands = {};
|
|
|
17
17
|
* Parse the list of existing Simulator devices to represent
|
|
18
18
|
* it as convenient mapping.
|
|
19
19
|
*
|
|
20
|
-
* @param {?
|
|
21
|
-
* @return {
|
|
20
|
+
* @param {string?} platform - The platform name, for example 'watchOS'.
|
|
21
|
+
* @return {Promise<Record<string, any>>} The resulting mapping. Each key is platform version,
|
|
22
22
|
* for example '10.3' and the corresponding value is an
|
|
23
23
|
* array of the matching {@link DeviceInfo} instances.
|
|
24
24
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
@@ -39,7 +39,7 @@ commands.getDevicesByParsing = async function getDevicesByParsing (platform) {
|
|
|
39
39
|
// ...
|
|
40
40
|
// so, get the `-- iOS X.X --` line to find the sdk (X.X)
|
|
41
41
|
// and the rest of the listing in order to later find the devices
|
|
42
|
-
const deviceSectionRe = _.isEmpty(platform)
|
|
42
|
+
const deviceSectionRe = _.isEmpty(platform) || !platform
|
|
43
43
|
? new RegExp(`\\-\\-\\s+(\\S+)\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi')
|
|
44
44
|
: new RegExp(`\\-\\-\\s+${_.escapeRegExp(platform)}\\s+(\\S+)\\s+\\-\\-(\\n\\s{4}.+)*`, 'mgi');
|
|
45
45
|
const matches = [];
|
|
@@ -124,7 +124,7 @@ commands.getDevices = async function getDevices (forSdk, platform) {
|
|
|
124
124
|
* }
|
|
125
125
|
* }
|
|
126
126
|
*/
|
|
127
|
-
const versionMatchRe = _.isEmpty(platform)
|
|
127
|
+
const versionMatchRe = _.isEmpty(platform) || !platform
|
|
128
128
|
? new RegExp(`^([^\\s-]+)[\\s-](\\S+)`, 'i')
|
|
129
129
|
: new RegExp(`^${_.escapeRegExp(platform)}[\\s-](\\S+)`, 'i');
|
|
130
130
|
for (let [sdkName, entries] of _.toPairs(JSON.parse(stdout).devices)) {
|
|
@@ -176,7 +176,7 @@ commands.getDevices = async function getDevices (forSdk, platform) {
|
|
|
176
176
|
*
|
|
177
177
|
* @param {string} platformVersion - The platform version name,
|
|
178
178
|
* for example '10.3'.
|
|
179
|
-
* @param {string
|
|
179
|
+
* @param {string} platform - The platform name, for example 'watchOS'.
|
|
180
180
|
* @return {Promise<string>} The corresponding runtime name for the given
|
|
181
181
|
* platform version.
|
|
182
182
|
*/
|
|
@@ -199,7 +199,7 @@ commands.getRuntimeForPlatformVersionViaJson = async function getRuntimeForPlatf
|
|
|
199
199
|
*
|
|
200
200
|
* @param {string} platformVersion - The platform version name,
|
|
201
201
|
* for example '10.3'.
|
|
202
|
-
* @param {string
|
|
202
|
+
* @param {string} platform - The platform name, for example 'watchOS'.
|
|
203
203
|
* @return {Promise<string>} The corresponding runtime name for the given
|
|
204
204
|
* platform version.
|
|
205
205
|
*/
|
|
@@ -8,7 +8,7 @@ const commands = {};
|
|
|
8
8
|
* @returns {string} Formatted value, for example -73.768254
|
|
9
9
|
*/
|
|
10
10
|
function formatArg (name, value) {
|
|
11
|
-
const flt = parseFloat(value);
|
|
11
|
+
const flt = parseFloat(`${value}`);
|
|
12
12
|
if (isNaN(flt)) {
|
|
13
13
|
throw new TypeError(`${name} must be a valid number, got '${value}' instead`);
|
|
14
14
|
}
|
|
@@ -7,7 +7,7 @@ const commands = {};
|
|
|
7
7
|
*
|
|
8
8
|
* @param {string} url - The URL scheme to open, for example http://appiom.io
|
|
9
9
|
* will be opened by the built-in mobile browser.
|
|
10
|
-
* @return {Promise<
|
|
10
|
+
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
|
|
11
11
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
12
12
|
* returns non-zero return code.
|
|
13
13
|
* @throws {Error} If the `udid` instance property is unset
|
package/lib/subcommands/spawn.js
CHANGED
|
@@ -9,7 +9,7 @@ const commands = {};
|
|
|
9
9
|
*
|
|
10
10
|
* @param {string|string[]} args - Spawn arguments
|
|
11
11
|
* @param {object} env [{}] - Additional environment variables mapping.
|
|
12
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<import('teen_process').TeenProcessExecResult>} Command execution result.
|
|
13
13
|
* @throws {Error} If the corresponding simctl subcommand command
|
|
14
14
|
* returns non-zero return code.
|
|
15
15
|
* @throws {Error} If the `udid` instance property is unset
|
|
@@ -31,7 +31,7 @@ commands.spawnProcess = async function spawnProcess (args, env = {}) {
|
|
|
31
31
|
*
|
|
32
32
|
* @param {string|string[]} args - Spawn arguments
|
|
33
33
|
* @param {object} env [{}] - Additional environment variables mapping.
|
|
34
|
-
* @return {Promise<SubProcess>} The instance of the process to be spawned.
|
|
34
|
+
* @return {Promise<import('teen_process').SubProcess>} The instance of the process to be spawned.
|
|
35
35
|
* @throws {Error} If the `udid` instance property is unset
|
|
36
36
|
*/
|
|
37
37
|
commands.spawnSubProcess = async function spawnSubProcess (args, env = {}) {
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"ios",
|
|
7
7
|
"simctl"
|
|
8
8
|
],
|
|
9
|
-
"version": "7.
|
|
9
|
+
"version": "7.3.0",
|
|
10
10
|
"author": "Appium Contributors",
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"repository": {
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"CHANGELOG.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@babel/runtime": "^7.0.0",
|
|
37
36
|
"asyncbox": "^2.3.1",
|
|
38
37
|
"bluebird": "^3.5.1",
|
|
39
38
|
"lodash": "^4.2.1",
|
|
@@ -46,7 +45,9 @@
|
|
|
46
45
|
"which": "^3.0.1"
|
|
47
46
|
},
|
|
48
47
|
"scripts": {
|
|
49
|
-
"build": "
|
|
48
|
+
"build": "tsc -b",
|
|
49
|
+
"clean": "npm run build -- --clean",
|
|
50
|
+
"rebuild": "npm run clean; npm run build",
|
|
50
51
|
"dev": "npm run build -- --watch",
|
|
51
52
|
"lint": "eslint .",
|
|
52
53
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -71,31 +72,41 @@
|
|
|
71
72
|
"singleQuote": true
|
|
72
73
|
},
|
|
73
74
|
"devDependencies": {
|
|
74
|
-
"@appium/eslint-config-appium": "^
|
|
75
|
-
"@
|
|
76
|
-
"@
|
|
77
|
-
"@
|
|
78
|
-
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
79
|
-
"@babel/preset-env": "^7.18.10",
|
|
80
|
-
"@babel/register": "^7.18.9",
|
|
75
|
+
"@appium/eslint-config-appium": "^8.0.4",
|
|
76
|
+
"@appium/eslint-config-appium-ts": "^0.3.1",
|
|
77
|
+
"@appium/tsconfig": "^0.3.0",
|
|
78
|
+
"@appium/types": "^0.13.2",
|
|
81
79
|
"@semantic-release/changelog": "^6.0.1",
|
|
82
80
|
"@semantic-release/git": "^10.0.1",
|
|
81
|
+
"@types/bluebird": "^3.5.38",
|
|
82
|
+
"@types/chai": "^4.3.5",
|
|
83
|
+
"@types/chai-as-promised": "^7.1.5",
|
|
84
|
+
"@types/lodash": "^4.14.196",
|
|
85
|
+
"@types/mocha": "^10.0.1",
|
|
86
|
+
"@types/node": "^20.4.7",
|
|
87
|
+
"@types/sinon": "^10.0.16",
|
|
88
|
+
"@types/sinon-chai": "^3.2.9",
|
|
89
|
+
"@types/teen_process": "2.0.0",
|
|
90
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
91
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
83
92
|
"appium-xcode": "^5.0.0",
|
|
84
|
-
"babel-plugin-source-map-support": "^2.2.0",
|
|
85
93
|
"chai": "^4.1.2",
|
|
86
94
|
"chai-as-promised": "^7.1.1",
|
|
87
95
|
"conventional-changelog-conventionalcommits": "^6.0.0",
|
|
88
|
-
"eslint": "^
|
|
89
|
-
"eslint-config-prettier": "^8.
|
|
90
|
-
"eslint-
|
|
91
|
-
"eslint-plugin-
|
|
92
|
-
"eslint-plugin-
|
|
93
|
-
"
|
|
96
|
+
"eslint": "^8.46.0",
|
|
97
|
+
"eslint-config-prettier": "^8.9.0",
|
|
98
|
+
"eslint-import-resolver-typescript": "^3.5.5",
|
|
99
|
+
"eslint-plugin-import": "^2.28.0",
|
|
100
|
+
"eslint-plugin-mocha": "^10.1.0",
|
|
101
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
102
|
+
"lint-staged": "^14.0.0",
|
|
94
103
|
"mocha": "^10.0.0",
|
|
95
104
|
"pre-commit": "^1.1.3",
|
|
96
105
|
"prettier": "^3.0.0",
|
|
97
106
|
"proxyquire": "^2.1.3",
|
|
98
107
|
"semantic-release": "^20.0.2",
|
|
99
|
-
"sinon": "^15.0.0"
|
|
108
|
+
"sinon": "^15.0.0",
|
|
109
|
+
"ts-node": "^10.9.1",
|
|
110
|
+
"typescript": "^5.1.6"
|
|
100
111
|
}
|
|
101
112
|
}
|