appium 2.2.2 → 2.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/README.md +7 -5
- package/build/lib/appium.d.ts +4 -4
- package/build/lib/appium.js +1 -1
- package/build/lib/appium.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +9 -3
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/config-file.d.ts +1 -1
- package/build/lib/config.d.ts +7 -6
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +30 -36
- package/build/lib/config.js.map +1 -1
- package/build/lib/extension/driver-config.d.ts +2 -2
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +4 -4
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +10 -3
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +32 -14
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.d.ts +6 -4
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/index.js +66 -30
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest.js +1 -1
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/plugin-config.js +1 -1
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/main.d.ts +4 -0
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +25 -52
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/schema.d.ts +5 -0
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +7 -7
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +2 -0
- package/build/lib/utils.d.ts.map +1 -1
- package/lib/appium.js +1 -1
- package/lib/cli/extension-command.js +12 -7
- package/lib/config.js +28 -41
- package/lib/extension/driver-config.js +3 -3
- package/lib/extension/extension-config.js +33 -15
- package/lib/extension/index.js +72 -41
- package/lib/main.js +36 -61
- package/package.json +15 -18
package/lib/main.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
server as baseServer,
|
|
8
8
|
normalizeBasePath,
|
|
9
9
|
} from '@appium/base-driver';
|
|
10
|
-
import {logger as logFactory, util, env
|
|
10
|
+
import {logger as logFactory, util, env} from '@appium/support';
|
|
11
11
|
import {asyncify} from 'asyncbox';
|
|
12
12
|
import _ from 'lodash';
|
|
13
13
|
import {AppiumDriver} from './appium';
|
|
@@ -20,15 +20,13 @@ import {
|
|
|
20
20
|
getNonDefaultServerArgs,
|
|
21
21
|
showConfig,
|
|
22
22
|
showBuildInfo,
|
|
23
|
-
|
|
24
|
-
warnNodeDeprecations,
|
|
25
|
-
checkNpmOk,
|
|
23
|
+
requireDir,
|
|
26
24
|
} from './config';
|
|
27
25
|
import {readConfigFile} from './config-file';
|
|
28
26
|
import {loadExtensions, getActivePlugins, getActiveDrivers} from './extension';
|
|
29
27
|
import {SERVER_SUBCOMMAND, LONG_STACKTRACE_LIMIT} from './constants';
|
|
30
28
|
import registerNode from './grid-register';
|
|
31
|
-
import {getDefaultsForSchema, validate} from './schema/schema';
|
|
29
|
+
import {getDefaultsForSchema, validate as validateSchema} from './schema/schema';
|
|
32
30
|
import {
|
|
33
31
|
inspect,
|
|
34
32
|
adjustNodePath,
|
|
@@ -40,7 +38,6 @@ import {
|
|
|
40
38
|
V4_BROADCAST_IP,
|
|
41
39
|
V6_BROADCAST_IP,
|
|
42
40
|
} from './utils';
|
|
43
|
-
import os from 'node:os';
|
|
44
41
|
import net from 'node:net';
|
|
45
42
|
|
|
46
43
|
const {resolveAppiumHome} = env;
|
|
@@ -53,7 +50,6 @@ const {resolveAppiumHome} = env;
|
|
|
53
50
|
async function preflightChecks(args, throwInsteadOfExit = false) {
|
|
54
51
|
try {
|
|
55
52
|
checkNodeOk();
|
|
56
|
-
await checkNpmOk();
|
|
57
53
|
if (args.longStacktrace) {
|
|
58
54
|
Error.stackTraceLimit = LONG_STACKTRACE_LIMIT;
|
|
59
55
|
}
|
|
@@ -61,12 +57,11 @@ async function preflightChecks(args, throwInsteadOfExit = false) {
|
|
|
61
57
|
await showBuildInfo();
|
|
62
58
|
process.exit(0);
|
|
63
59
|
}
|
|
64
|
-
warnNodeDeprecations();
|
|
65
60
|
|
|
66
|
-
|
|
61
|
+
validateSchema(args);
|
|
67
62
|
|
|
68
63
|
if (args.tmpDir) {
|
|
69
|
-
await
|
|
64
|
+
await requireDir(args.tmpDir, !args.noPermsCheck, 'tmpDir argument value');
|
|
70
65
|
}
|
|
71
66
|
} catch (err) {
|
|
72
67
|
logger.error(err.message.red);
|
|
@@ -149,48 +144,16 @@ function getExtraMethodMap(driverClasses, pluginClasses) {
|
|
|
149
144
|
}
|
|
150
145
|
|
|
151
146
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
* @param {string} name The name of the appium home source (needed for error messages)
|
|
155
|
-
* @param {string} appiumHome The actual value to be verified
|
|
156
|
-
* @returns {Promise<string>} Same appiumHome value
|
|
157
|
-
* @throws {Error} If the validation has failed
|
|
147
|
+
* @param {string?} [appiumHomeFromArgs] - Appium home value retrieved from progrmmatic server args
|
|
148
|
+
* @returns {string}
|
|
158
149
|
*/
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
let err = e;
|
|
165
|
-
if (e.code === 'ENOENT') {
|
|
166
|
-
try {
|
|
167
|
-
await fs.mkdir(appiumHome, {recursive: true});
|
|
168
|
-
return appiumHome;
|
|
169
|
-
} catch (e1) {
|
|
170
|
-
err = e1;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
throw new Error(
|
|
174
|
-
`The path '${appiumHome}' provided in the ${name} must point ` +
|
|
175
|
-
`to a valid folder writeable for the current user account '${os.userInfo().username}'. ` +
|
|
176
|
-
`Original error: ${err.message}`,
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
if (!stat.isDirectory()) {
|
|
180
|
-
throw new Error(
|
|
181
|
-
`The path '${appiumHome}' provided in the ${name} must point to a valid folder`,
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
try {
|
|
185
|
-
await fs.access(appiumHome, fs.constants.W_OK);
|
|
186
|
-
} catch (e) {
|
|
187
|
-
throw new Error(
|
|
188
|
-
`The folder path '${appiumHome}' provided in the ${name} must be ` +
|
|
189
|
-
`writeable for the current user account '${os.userInfo().username}. ` +
|
|
190
|
-
`Original error: ${e.message}`,
|
|
191
|
-
);
|
|
150
|
+
function determineAppiumHomeSource(appiumHomeFromArgs) {
|
|
151
|
+
if (!_.isNil(appiumHomeFromArgs)) {
|
|
152
|
+
return 'appiumHome config value';
|
|
153
|
+
} else if (process.env.APPIUM_HOME) {
|
|
154
|
+
return 'APPIUM_HOME environment variable';
|
|
192
155
|
}
|
|
193
|
-
return
|
|
156
|
+
return 'autodetected Appium home path';
|
|
194
157
|
}
|
|
195
158
|
|
|
196
159
|
/**
|
|
@@ -212,13 +175,10 @@ async function prepareAppiumHome(name, appiumHome) {
|
|
|
212
175
|
*/
|
|
213
176
|
async function init(args) {
|
|
214
177
|
const appiumHome = args?.appiumHome ?? (await resolveAppiumHome());
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
appiumHomeSourceName = 'APPIUM_HOME environment variable';
|
|
220
|
-
}
|
|
221
|
-
await prepareAppiumHome(appiumHomeSourceName, appiumHome);
|
|
178
|
+
const appiumHomeSourceName = determineAppiumHomeSource(args?.appiumHome);
|
|
179
|
+
// We verify the writeability later based on requested server arguments
|
|
180
|
+
// Here we just need to make sure the path exists and is a folder
|
|
181
|
+
await requireDir(appiumHome, false, appiumHomeSourceName);
|
|
222
182
|
|
|
223
183
|
adjustNodePath();
|
|
224
184
|
|
|
@@ -295,6 +255,10 @@ async function init(args) {
|
|
|
295
255
|
}
|
|
296
256
|
}
|
|
297
257
|
|
|
258
|
+
if (!serverArgs.noPermsCheck) {
|
|
259
|
+
await requireDir(appiumHome, true, appiumHomeSourceName);
|
|
260
|
+
}
|
|
261
|
+
|
|
298
262
|
const appiumDriver = new AppiumDriver(
|
|
299
263
|
/** @type {import('@appium/types').DriverOpts<import('./appium').AppiumDriverConstraints>} */ (
|
|
300
264
|
serverArgs
|
|
@@ -309,8 +273,10 @@ async function init(args) {
|
|
|
309
273
|
parsedArgs: serverArgs,
|
|
310
274
|
driverConfig,
|
|
311
275
|
pluginConfig,
|
|
276
|
+
appiumHome,
|
|
312
277
|
});
|
|
313
278
|
} else {
|
|
279
|
+
await requireDir(appiumHome, true, appiumHomeSourceName);
|
|
314
280
|
if (isExtensionCommandArgs(preConfigArgs)) {
|
|
315
281
|
// if the user has requested the 'driver' CLI, don't run the normal server,
|
|
316
282
|
// but instead pass control to the driver CLI
|
|
@@ -340,7 +306,7 @@ function logServerAddress(url) {
|
|
|
340
306
|
}
|
|
341
307
|
|
|
342
308
|
const interfaces = fetchInterfaces(urlObj.hostname === V4_BROADCAST_IP ? 4 : 6);
|
|
343
|
-
const toLabel = (/** @type {os.NetworkInterfaceInfo} */ iface) => {
|
|
309
|
+
const toLabel = (/** @type {import('node:os').NetworkInterfaceInfo} */ iface) => {
|
|
344
310
|
const href = urlObj.href.replace(urlObj.hostname, iface.address);
|
|
345
311
|
return iface.internal ? `${href} (only accessible from the same host)` : href;
|
|
346
312
|
};
|
|
@@ -370,17 +336,25 @@ async function main(args) {
|
|
|
370
336
|
);
|
|
371
337
|
}
|
|
372
338
|
|
|
373
|
-
const {appiumDriver, pluginConfig, driverConfig, parsedArgs} =
|
|
339
|
+
const {appiumDriver, pluginConfig, driverConfig, parsedArgs, appiumHome} =
|
|
374
340
|
/** @type {InitResult<ServerCommand>} */ (initResult);
|
|
375
341
|
|
|
376
|
-
const pluginClasses = getActivePlugins(
|
|
342
|
+
const pluginClasses = await getActivePlugins(
|
|
343
|
+
pluginConfig, parsedArgs.pluginsImportChunkSize, parsedArgs.usePlugins
|
|
344
|
+
);
|
|
377
345
|
// set the active plugins on the umbrella driver so it can use them for commands
|
|
378
346
|
appiumDriver.pluginClasses = pluginClasses;
|
|
379
347
|
|
|
380
348
|
await logStartupInfo(parsedArgs);
|
|
349
|
+
|
|
350
|
+
const appiumHomeSourceName = determineAppiumHomeSource(args?.appiumHome);
|
|
351
|
+
logger.debug(`The ${appiumHomeSourceName}: ${appiumHome}`);
|
|
352
|
+
|
|
381
353
|
let routeConfiguringFunction = makeRouter(appiumDriver);
|
|
382
354
|
|
|
383
|
-
const driverClasses = getActiveDrivers(
|
|
355
|
+
const driverClasses = await getActiveDrivers(
|
|
356
|
+
driverConfig, parsedArgs.driversImportChunkSize, parsedArgs.useDrivers
|
|
357
|
+
);
|
|
384
358
|
const serverUpdaters = getServerUpdaters(driverClasses, pluginClasses);
|
|
385
359
|
const extraMethodMap = getExtraMethodMap(driverClasses, pluginClasses);
|
|
386
360
|
|
|
@@ -498,6 +472,7 @@ export {main, init, resolveAppiumHome};
|
|
|
498
472
|
* @typedef ServerInitData
|
|
499
473
|
* @property {import('./appium').AppiumDriver} appiumDriver - The Appium driver
|
|
500
474
|
* @property {import('appium/types').ParsedArgs} parsedArgs - The parsed arguments
|
|
475
|
+
* @property {string} appiumHome - The full path to the Appium home folder
|
|
501
476
|
*/
|
|
502
477
|
|
|
503
478
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Automation for Apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -60,25 +60,25 @@
|
|
|
60
60
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@appium/base-driver": "^9.4.
|
|
64
|
-
"@appium/base-plugin": "^2.2.
|
|
65
|
-
"@appium/docutils": "^0.
|
|
66
|
-
"@appium/schema": "^0.
|
|
67
|
-
"@appium/support": "^4.1.
|
|
68
|
-
"@appium/types": "^0.
|
|
69
|
-
"@sidvind/better-ajv-errors": "2.1.
|
|
70
|
-
"@types/argparse": "2.0.
|
|
63
|
+
"@appium/base-driver": "^9.4.4",
|
|
64
|
+
"@appium/base-plugin": "^2.2.25",
|
|
65
|
+
"@appium/docutils": "^1.0.1",
|
|
66
|
+
"@appium/schema": "^0.5.0",
|
|
67
|
+
"@appium/support": "^4.1.11",
|
|
68
|
+
"@appium/types": "^0.15.0",
|
|
69
|
+
"@sidvind/better-ajv-errors": "2.1.3",
|
|
70
|
+
"@types/argparse": "2.0.14",
|
|
71
71
|
"@types/bluebird": "3.5.42",
|
|
72
72
|
"@types/fancy-log": "2.0.2",
|
|
73
|
-
"@types/semver": "7.5.
|
|
74
|
-
"@types/teen_process": "2.0.
|
|
73
|
+
"@types/semver": "7.5.6",
|
|
74
|
+
"@types/teen_process": "2.0.4",
|
|
75
75
|
"@types/wrap-ansi": "3.0.0",
|
|
76
76
|
"ajv": "8.12.0",
|
|
77
77
|
"ajv-formats": "2.1.1",
|
|
78
78
|
"argparse": "2.0.1",
|
|
79
79
|
"async-lock": "1.4.0",
|
|
80
80
|
"asyncbox": "3.0.0",
|
|
81
|
-
"axios": "1.6.
|
|
81
|
+
"axios": "1.6.2",
|
|
82
82
|
"bluebird": "3.7.2",
|
|
83
83
|
"cross-env": "7.0.3",
|
|
84
84
|
"find-up": "5.0.0",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"resolve-from": "5.0.0",
|
|
91
91
|
"semver": "7.5.4",
|
|
92
92
|
"source-map-support": "0.5.21",
|
|
93
|
-
"teen_process": "2.
|
|
94
|
-
"type-fest": "
|
|
93
|
+
"teen_process": "2.1.1",
|
|
94
|
+
"type-fest": "4.8.3",
|
|
95
95
|
"winston": "3.11.0",
|
|
96
96
|
"wrap-ansi": "7.0.0",
|
|
97
97
|
"yaml": "2.3.4"
|
|
@@ -103,8 +103,5 @@
|
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
107
|
-
"typedoc": {
|
|
108
|
-
"entryPoint": "./lib/main.js"
|
|
109
|
-
}
|
|
106
|
+
"gitHead": "5c1d20517cfc8773cd5ffb0f8bb996668d71116b"
|
|
110
107
|
}
|