appium-mac2-driver 3.2.2 → 3.2.4
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/commands/app-management.d.ts +18 -21
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +14 -25
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/applescript.d.ts +8 -9
- package/build/lib/commands/applescript.d.ts.map +1 -1
- package/build/lib/commands/applescript.js +14 -13
- package/build/lib/commands/applescript.js.map +1 -1
- package/build/lib/commands/execute.d.ts +5 -8
- package/build/lib/commands/execute.d.ts.map +1 -1
- package/build/lib/commands/execute.js +5 -13
- package/build/lib/commands/execute.js.map +1 -1
- package/build/lib/commands/find.d.ts +6 -8
- package/build/lib/commands/find.d.ts.map +1 -1
- package/build/lib/commands/find.js +8 -13
- package/build/lib/commands/find.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +105 -118
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +141 -154
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +4 -6
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +2 -8
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/record-screen.d.ts +57 -98
- package/build/lib/commands/record-screen.d.ts.map +1 -1
- package/build/lib/commands/record-screen.js +81 -84
- package/build/lib/commands/record-screen.js.map +1 -1
- package/build/lib/commands/screenshots.d.ts +5 -5
- package/build/lib/commands/screenshots.d.ts.map +1 -1
- package/build/lib/commands/screenshots.js +3 -8
- package/build/lib/commands/screenshots.js.map +1 -1
- package/build/lib/commands/source.d.ts +4 -5
- package/build/lib/commands/source.d.ts.map +1 -1
- package/build/lib/commands/source.js +3 -8
- package/build/lib/commands/source.js.map +1 -1
- package/build/lib/doctor/optional-checks.d.ts +12 -10
- package/build/lib/doctor/optional-checks.d.ts.map +1 -1
- package/build/lib/doctor/optional-checks.js +9 -9
- package/build/lib/doctor/optional-checks.js.map +1 -1
- package/build/lib/doctor/required-checks.d.ts +12 -10
- package/build/lib/doctor/required-checks.d.ts.map +1 -1
- package/build/lib/doctor/required-checks.js +9 -9
- package/build/lib/doctor/required-checks.js.map +1 -1
- package/build/lib/doctor/utils.d.ts +3 -3
- package/build/lib/doctor/utils.d.ts.map +1 -1
- package/build/lib/doctor/utils.js +2 -2
- package/build/lib/doctor/utils.js.map +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js.map +1 -1
- package/build/lib/utils.d.ts +11 -11
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +6 -7
- package/build/lib/utils.js.map +1 -1
- package/lib/commands/app-management.ts +88 -0
- package/lib/commands/{applescript.js → applescript.ts} +28 -24
- package/lib/commands/execute.ts +32 -0
- package/lib/commands/find.ts +34 -0
- package/lib/commands/{gestures.js → gestures.ts} +333 -238
- package/lib/commands/navigation.ts +19 -0
- package/lib/commands/{record-screen.js → record-screen.ts} +165 -138
- package/lib/commands/screenshots.ts +18 -0
- package/lib/commands/{source.js → source.ts} +10 -11
- package/lib/doctor/optional-checks.ts +67 -0
- package/lib/doctor/required-checks.ts +75 -0
- package/lib/doctor/{utils.js → utils.ts} +4 -3
- package/lib/{logger.js → logger.ts} +1 -0
- package/lib/{utils.js → utils.ts} +8 -10
- package/npm-shrinkwrap.json +13 -13
- package/package.json +1 -1
- package/lib/commands/app-management.js +0 -83
- package/lib/commands/execute.js +0 -33
- package/lib/commands/find.js +0 -31
- package/lib/commands/navigation.js +0 -18
- package/lib/commands/screenshots.js +0 -18
- package/lib/doctor/optional-checks.js +0 -64
- package/lib/doctor/required-checks.js +0 -72
|
@@ -3,10 +3,10 @@ import {fs} from 'appium/support';
|
|
|
3
3
|
/**
|
|
4
4
|
* Return an executable path of cmd
|
|
5
5
|
*
|
|
6
|
-
* @param
|
|
7
|
-
* @return
|
|
6
|
+
* @param cmd Standard output by command
|
|
7
|
+
* @return The full path of cmd. `null` if the cmd is not found.
|
|
8
8
|
*/
|
|
9
|
-
export async function resolveExecutablePath(cmd) {
|
|
9
|
+
export async function resolveExecutablePath(cmd: string): Promise<string | null> {
|
|
10
10
|
try {
|
|
11
11
|
const executablePath = await fs.which(cmd);
|
|
12
12
|
if (executablePath && (await fs.exists(executablePath))) {
|
|
@@ -15,3 +15,4 @@ export async function resolveExecutablePath(cmd) {
|
|
|
15
15
|
} catch {}
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
+
|
|
@@ -7,10 +7,10 @@ const MODULE_NAME = 'appium-mac2-driver';
|
|
|
7
7
|
/**
|
|
8
8
|
* Calculates the path to the current module's root folder
|
|
9
9
|
*
|
|
10
|
-
* @returns
|
|
11
|
-
* @throws
|
|
10
|
+
* @returns The full path to module root
|
|
11
|
+
* @throws If the current module root folder cannot be determined
|
|
12
12
|
*/
|
|
13
|
-
const getModuleRoot = _.memoize(function getModuleRoot () {
|
|
13
|
+
export const getModuleRoot = _.memoize(function getModuleRoot (): string {
|
|
14
14
|
const root = node.getModuleRootSync(MODULE_NAME, __filename);
|
|
15
15
|
if (!root) {
|
|
16
16
|
throw new Error(`Cannot find the root folder of the ${MODULE_NAME} Node.js module`);
|
|
@@ -22,21 +22,19 @@ const getModuleRoot = _.memoize(function getModuleRoot () {
|
|
|
22
22
|
* Retrieves process ids of all the children processes created by the given
|
|
23
23
|
* parent process identifier
|
|
24
24
|
*
|
|
25
|
-
* @param
|
|
26
|
-
* @returns
|
|
25
|
+
* @param parentPid parent process ID
|
|
26
|
+
* @returns the list of matched children process ids
|
|
27
27
|
* or an empty list if none matched
|
|
28
28
|
*/
|
|
29
|
-
async function listChildrenProcessIds (parentPid) {
|
|
29
|
+
export async function listChildrenProcessIds (parentPid: number | string): Promise<string[]> {
|
|
30
30
|
const { stdout } = await exec('ps', ['axu', '-o', 'ppid']);
|
|
31
31
|
// USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND PPID
|
|
32
32
|
return stdout.split('\n')
|
|
33
33
|
.filter(_.trim)
|
|
34
|
-
.map((line) => {
|
|
34
|
+
.map((line: string) => {
|
|
35
35
|
const [, pid, ...rest] = line.split(/\s+/).filter(_.trim);
|
|
36
36
|
return [pid, _.last(rest)];
|
|
37
37
|
})
|
|
38
38
|
.filter(([, ppid]) => ppid === `${parentPid}`)
|
|
39
|
-
.map(([pid]) =>
|
|
39
|
+
.map(([pid]) => String(pid));
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
export { listChildrenProcessIds, getModuleRoot };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium-mac2-driver",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "appium-mac2-driver",
|
|
9
|
-
"version": "3.2.
|
|
9
|
+
"version": "3.2.4",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@appium/strongbox": "^1.0.0-rc.1",
|
|
@@ -1542,14 +1542,14 @@
|
|
|
1542
1542
|
}
|
|
1543
1543
|
},
|
|
1544
1544
|
"node_modules/color": {
|
|
1545
|
-
"version": "5.0.
|
|
1546
|
-
"resolved": "https://registry.npmjs.org/color/-/color-5.0.
|
|
1547
|
-
"integrity": "sha512-
|
|
1545
|
+
"version": "5.0.3",
|
|
1546
|
+
"resolved": "https://registry.npmjs.org/color/-/color-5.0.3.tgz",
|
|
1547
|
+
"integrity": "sha512-ezmVcLR3xAVp8kYOm4GS45ZLLgIE6SPAFoduLr6hTDajwb3KZ2F46gulK3XpcwRFb5KKGCSezCBAY4Dw4HsyXA==",
|
|
1548
1548
|
"extraneous": true,
|
|
1549
1549
|
"license": "MIT",
|
|
1550
1550
|
"dependencies": {
|
|
1551
|
-
"color-convert": "^3.
|
|
1552
|
-
"color-string": "^2.
|
|
1551
|
+
"color-convert": "^3.1.3",
|
|
1552
|
+
"color-string": "^2.1.3"
|
|
1553
1553
|
},
|
|
1554
1554
|
"engines": {
|
|
1555
1555
|
"node": ">=18"
|
|
@@ -1574,9 +1574,9 @@
|
|
|
1574
1574
|
"license": "MIT"
|
|
1575
1575
|
},
|
|
1576
1576
|
"node_modules/color-string": {
|
|
1577
|
-
"version": "2.1.
|
|
1578
|
-
"resolved": "https://registry.npmjs.org/color-string/-/color-string-2.1.
|
|
1579
|
-
"integrity": "sha512-
|
|
1577
|
+
"version": "2.1.4",
|
|
1578
|
+
"resolved": "https://registry.npmjs.org/color-string/-/color-string-2.1.4.tgz",
|
|
1579
|
+
"integrity": "sha512-Bb6Cq8oq0IjDOe8wJmi4JeNn763Xs9cfrBcaylK1tPypWzyoy2G3l90v9k64kjphl/ZJjPIShFztenRomi8WTg==",
|
|
1580
1580
|
"extraneous": true,
|
|
1581
1581
|
"license": "MIT",
|
|
1582
1582
|
"dependencies": {
|
|
@@ -1597,9 +1597,9 @@
|
|
|
1597
1597
|
}
|
|
1598
1598
|
},
|
|
1599
1599
|
"node_modules/color/node_modules/color-convert": {
|
|
1600
|
-
"version": "3.1.
|
|
1601
|
-
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-3.1.
|
|
1602
|
-
"integrity": "sha512-
|
|
1600
|
+
"version": "3.1.3",
|
|
1601
|
+
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-3.1.3.tgz",
|
|
1602
|
+
"integrity": "sha512-fasDH2ont2GqF5HpyO4w0+BcewlhHEZOFn9c1ckZdHpJ56Qb7MHhH/IcJZbBGgvdtwdwNbLvxiBEdg336iA9Sg==",
|
|
1603
1603
|
"extraneous": true,
|
|
1604
1604
|
"license": "MIT",
|
|
1605
1605
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Start an app with given bundle identifier or activates it
|
|
3
|
-
* if the app is already running. An exception is thrown if the
|
|
4
|
-
* app with the given identifier cannot be found.
|
|
5
|
-
*
|
|
6
|
-
* @this {Mac2Driver}
|
|
7
|
-
* @param {string} [bundleId] Bundle identifier of the app to be launched or activated.
|
|
8
|
-
* Either this property or `path` must be provided
|
|
9
|
-
* @param {string} [path] Full path to the app bundle. Either this property or
|
|
10
|
-
* `bundleId` must be provided
|
|
11
|
-
* @param {string[]} [args] The list of command line arguments for the app to be launched with.
|
|
12
|
-
* This parameter is ignored if the app is already running.
|
|
13
|
-
* @param {import('@appium/types').StringRecord} [environment] Environment variables mapping.
|
|
14
|
-
* Custom variables are added to the default process environment.
|
|
15
|
-
*/
|
|
16
|
-
export async function macosLaunchApp (
|
|
17
|
-
bundleId,
|
|
18
|
-
path,
|
|
19
|
-
args,
|
|
20
|
-
environment,
|
|
21
|
-
) {
|
|
22
|
-
return await this.wda.proxy.command('/wda/apps/launch', 'POST', {
|
|
23
|
-
arguments: args,
|
|
24
|
-
environment,
|
|
25
|
-
bundleId,
|
|
26
|
-
path,
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Activate an app with given bundle identifier. An exception is thrown if the
|
|
32
|
-
* app cannot be found or is not running.
|
|
33
|
-
*
|
|
34
|
-
* @this {Mac2Driver}
|
|
35
|
-
* @param {string} [bundleId] Bundle identifier of the app to be activated.
|
|
36
|
-
* Either this property or `path` must be provided
|
|
37
|
-
* @param {string} [path] Full path to the app bundle. Either this property
|
|
38
|
-
* or `bundleId` must be provided
|
|
39
|
-
*/
|
|
40
|
-
export async function macosActivateApp (bundleId, path) {
|
|
41
|
-
return await this.wda.proxy.command('/wda/apps/activate', 'POST', { bundleId, path });
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Terminate an app with given bundle identifier. An exception is thrown if the
|
|
46
|
-
* app cannot be found.
|
|
47
|
-
*
|
|
48
|
-
* @this {Mac2Driver}
|
|
49
|
-
* @param {string} [bundleId] Bundle identifier of the app to be terminated.
|
|
50
|
-
* Either this property or `path` must be provided
|
|
51
|
-
* @param {string} [path] Full path to the app bundle. Either this property
|
|
52
|
-
* or `bundleId` must be provided
|
|
53
|
-
* @returns {Promise<boolean>} `true` if the app was running and has been successfully terminated.
|
|
54
|
-
* `false` if the app was not running before.
|
|
55
|
-
*/
|
|
56
|
-
export async function macosTerminateApp (bundleId, path) {
|
|
57
|
-
return /** @type {boolean} */ (
|
|
58
|
-
await this.wda.proxy.command('/wda/apps/terminate', 'POST', { bundleId, path })
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Query an app state with given bundle identifier. An exception is thrown if the
|
|
64
|
-
* app cannot be found.
|
|
65
|
-
*
|
|
66
|
-
* @this {Mac2Driver}
|
|
67
|
-
* @param {string} [bundleId] Bundle identifier of the app whose state should be queried.
|
|
68
|
-
* Either this property or `path` must be provided
|
|
69
|
-
* @param {string} [path] Full path to the app bundle. Either this property
|
|
70
|
-
* or `bundleId` must be provided
|
|
71
|
-
* @returns {Promise<number>} The application state code. See
|
|
72
|
-
* https://developer.apple.com/documentation/xctest/xcuiapplicationstate?language=objc
|
|
73
|
-
* for more details
|
|
74
|
-
*/
|
|
75
|
-
export async function macosQueryAppState (bundleId, path) {
|
|
76
|
-
return /** @type {number} */ (
|
|
77
|
-
await this.wda.proxy.command('/wda/apps/state', 'POST', { bundleId, path })
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @typedef {import('../driver').Mac2Driver} Mac2Driver
|
|
83
|
-
*/
|
package/lib/commands/execute.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
|
|
3
|
-
const EXECUTE_SCRIPT_PREFIX = 'macos:';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* @this {Mac2Driver}
|
|
8
|
-
* @param {string} script
|
|
9
|
-
* @param {any[]|import('@appium/types').StringRecord} [args]
|
|
10
|
-
* @returns {Promise<any>}
|
|
11
|
-
*/
|
|
12
|
-
export async function execute (script, args) {
|
|
13
|
-
this.log.info(`Executing extension command '${script}'`);
|
|
14
|
-
const formattedScript = String(script).trim().replace(/^macos:\s*/, `${EXECUTE_SCRIPT_PREFIX} `);
|
|
15
|
-
const preprocessedArgs = preprocessExecuteMethodArgs(args);
|
|
16
|
-
return await this.executeMethod(formattedScript, [preprocessedArgs]);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Massages the arguments going into an execute method.
|
|
21
|
-
*
|
|
22
|
-
* @param {ExecuteMethodArgs} [args]
|
|
23
|
-
* @returns {StringRecord}
|
|
24
|
-
*/
|
|
25
|
-
function preprocessExecuteMethodArgs(args) {
|
|
26
|
-
return /** @type {StringRecord} */ ((_.isArray(args) ? _.first(args) : args) ?? {});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {import('../driver').Mac2Driver} Mac2Driver
|
|
31
|
-
* @typedef {import('@appium/types').StringRecord} StringRecord
|
|
32
|
-
* @typedef {readonly any[] | readonly [StringRecord] | Readonly<StringRecord>} ExecuteMethodArgs
|
|
33
|
-
*/
|
package/lib/commands/find.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { util } from 'appium/support';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* This is needed to make lookup by image working
|
|
5
|
-
*
|
|
6
|
-
* @this {Mac2Driver}
|
|
7
|
-
* @param {string} strategy
|
|
8
|
-
* @param {string} selector
|
|
9
|
-
* @param {boolean} mult
|
|
10
|
-
* @param {string} [context]
|
|
11
|
-
* @returns {Promise<any>}
|
|
12
|
-
*/
|
|
13
|
-
export async function findElOrEls (strategy, selector, mult, context) {
|
|
14
|
-
const contextId = context ? util.unwrapElement(context) : context;
|
|
15
|
-
const endpoint = `/element${contextId ? `/${contextId}/element` : ''}${mult ? 's' : ''}`;
|
|
16
|
-
|
|
17
|
-
if (strategy === '-ios predicate string') {
|
|
18
|
-
strategy = 'predicate string';
|
|
19
|
-
} else if (strategy === '-ios class chain') {
|
|
20
|
-
strategy = 'class chain';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return await this.wda.proxy.command(endpoint, 'POST', {
|
|
24
|
-
using: strategy,
|
|
25
|
-
value: selector,
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @typedef {import('../driver').Mac2Driver} Mac2Driver
|
|
31
|
-
*/
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Opens the given URL with the default or the given application.
|
|
3
|
-
* Xcode must be at version 14.3+.
|
|
4
|
-
*
|
|
5
|
-
* @this {Mac2Driver}
|
|
6
|
-
* @param {string} url The URL to be opened.
|
|
7
|
-
* @param {string} [bundleId] The bundle identifier of an application to open
|
|
8
|
-
* the given url with. If not provided then the default application
|
|
9
|
-
* for the given url scheme is going to be used.
|
|
10
|
-
* @returns {Promise<unknown>}
|
|
11
|
-
*/
|
|
12
|
-
export async function macosDeepLink (url, bundleId) {
|
|
13
|
-
return await this.wda.proxy.command('/url', 'POST', {url, bundleId});
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {import('../driver').Mac2Driver} Mac2Driver
|
|
18
|
-
*/
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves screenshots of each display available to macOS
|
|
3
|
-
*
|
|
4
|
-
* @this {Mac2Driver}
|
|
5
|
-
* @param {number} [displayId] macOS display identifier to take a screenshot for.
|
|
6
|
-
* If not provided then screenshots of all displays are going to be returned.
|
|
7
|
-
* If no matches were found then an error is thrown.
|
|
8
|
-
* @returns {Promise<import('../types').ScreenshotsInfo>}
|
|
9
|
-
*/
|
|
10
|
-
export async function macosScreenshots (displayId) {
|
|
11
|
-
return /** @type {import('../types').ScreenshotsInfo} */ (
|
|
12
|
-
await this.wda.proxy.command('/wda/screenshots', 'POST', {displayId})
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {import('../driver').Mac2Driver} Mac2Driver
|
|
18
|
-
*/
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import {resolveExecutablePath} from './utils';
|
|
2
|
-
import {doctor} from 'appium/support';
|
|
3
|
-
import {exec} from 'teen_process';
|
|
4
|
-
import '@colors/colors';
|
|
5
|
-
|
|
6
|
-
/** @satisfies {import('@appium/types').IDoctorCheck} */
|
|
7
|
-
export class OptionalFfmpegCheck {
|
|
8
|
-
FFMPEG_BINARY = 'ffmpeg';
|
|
9
|
-
FFMPEG_INSTALL_LINK = 'https://www.ffmpeg.org/download.html';
|
|
10
|
-
|
|
11
|
-
async diagnose() {
|
|
12
|
-
const ffmpegPath = await resolveExecutablePath(this.FFMPEG_BINARY);
|
|
13
|
-
|
|
14
|
-
return ffmpegPath
|
|
15
|
-
? doctor.okOptional(`${this.FFMPEG_BINARY} exists at '${ffmpegPath}'`)
|
|
16
|
-
: doctor.nokOptional(`${this.FFMPEG_BINARY} cannot be found`);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async fix() {
|
|
20
|
-
return (
|
|
21
|
-
`${`${this.FFMPEG_BINARY}`.bold} is used to capture screen recordings. ` +
|
|
22
|
-
`Please read ${this.FFMPEG_INSTALL_LINK}.`
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
hasAutofix() {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
isOptional() {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
export const optionalFfmpegCheck = new OptionalFfmpegCheck();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/** @satisfies {import('@appium/types').IDoctorCheck} */
|
|
38
|
-
export class OptionalAutomationModeCheck {
|
|
39
|
-
async diagnose() {
|
|
40
|
-
let stdout;
|
|
41
|
-
try {
|
|
42
|
-
({stdout} = await exec('automationmodetool'));
|
|
43
|
-
} catch (err) {
|
|
44
|
-
return doctor.nokOptional(`Cannot run 'automationmodetool': ${err.stderr || err.message}`);
|
|
45
|
-
}
|
|
46
|
-
if (stdout.includes('DOES NOT REQUIRE')) {
|
|
47
|
-
return doctor.okOptional(`Automation Mode does not require user authentication`);
|
|
48
|
-
}
|
|
49
|
-
return doctor.nokOptional(`Automation Mode requires user authentication`);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async fix() {
|
|
53
|
-
return `Run \`automationmodetool enable-automationmode-without-authentication\` to disable Automation Mode authentication`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
hasAutofix() {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
isOptional() {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export const optionalAutomationModeCheck = new OptionalAutomationModeCheck();
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import {doctor} from 'appium/support';
|
|
2
|
-
import {exec} from 'teen_process';
|
|
3
|
-
import { getPath as getXcodePath } from 'appium-xcode';
|
|
4
|
-
import '@colors/colors';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** @satisfies {import('@appium/types').IDoctorCheck} */
|
|
8
|
-
export class XcodeCheck {
|
|
9
|
-
async diagnose() {
|
|
10
|
-
try {
|
|
11
|
-
const xcodePath = await getXcodePath();
|
|
12
|
-
return doctor.ok(`xCode is installed at '${xcodePath}'`);
|
|
13
|
-
} catch (err) {
|
|
14
|
-
return doctor.nok(err.message);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async fix() {
|
|
19
|
-
return `Manually install ${'Xcode'.bold} and configure the active developer directory path using the xcode-select tool`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
hasAutofix() {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
isOptional() {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export const xcodeCheck = new XcodeCheck();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/** @satisfies {import('@appium/types').IDoctorCheck} */
|
|
34
|
-
export class XcodebuildCheck {
|
|
35
|
-
XCODE_VER_PATTERN = /^Xcode\s+([\d.]+)$/m;
|
|
36
|
-
MIN_XCODE_VERSION = 13;
|
|
37
|
-
|
|
38
|
-
async diagnose() {
|
|
39
|
-
let xcodeVerMatch;
|
|
40
|
-
let stdout;
|
|
41
|
-
let stderr;
|
|
42
|
-
try {
|
|
43
|
-
({stdout, stderr} = await exec('xcodebuild', ['-version']));
|
|
44
|
-
xcodeVerMatch = this.XCODE_VER_PATTERN.exec(stdout);
|
|
45
|
-
} catch (err) {
|
|
46
|
-
return doctor.nok(`Cannot run 'xcodebuild': ${err.stderr || err.message}`);
|
|
47
|
-
}
|
|
48
|
-
if (!xcodeVerMatch) {
|
|
49
|
-
return doctor.nok(`Cannot determine Xcode version. stdout: ${stdout}; stderr: ${stderr}`);
|
|
50
|
-
}
|
|
51
|
-
const xcodeMajorVer = parseInt(xcodeVerMatch[1], 10);
|
|
52
|
-
if (xcodeMajorVer < this.MIN_XCODE_VERSION) {
|
|
53
|
-
return doctor.nok(`The actual Xcode version (${xcodeVerMatch[0]}) is older than the expected ` +
|
|
54
|
-
`one (${this.MIN_XCODE_VERSION})`);
|
|
55
|
-
}
|
|
56
|
-
return doctor.ok(`xcodebuild is installed and has a matching version number ` +
|
|
57
|
-
`(${xcodeVerMatch[1]} >= ${this.MIN_XCODE_VERSION})`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async fix() {
|
|
61
|
-
return `Install ${'Xcode'.bold} ${this.MIN_XCODE_VERSION}+ or upgrade the existing setup`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
hasAutofix() {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
isOptional() {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export const xcodebuildCheck = new XcodebuildCheck();
|