appium 2.0.0-beta.46 → 2.0.0-beta.48
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 +145 -44
- package/build/lib/appium.d.ts +3 -103
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +679 -549
- package/build/lib/appium.js.map +1 -1
- package/build/lib/cli/args.js +247 -127
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/driver-command.d.ts +24 -5
- package/build/lib/cli/driver-command.d.ts.map +1 -1
- package/build/lib/cli/driver-command.js +78 -88
- package/build/lib/cli/driver-command.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +33 -24
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +729 -512
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +7 -6
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +68 -65
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts +3 -3
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +234 -192
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/plugin-command.js +58 -87
- package/build/lib/cli/plugin-command.js.map +1 -1
- package/build/lib/cli/utils.js +66 -69
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/config-file.d.ts.map +1 -1
- package/build/lib/config-file.js +189 -120
- package/build/lib/config-file.js.map +1 -1
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +254 -213
- package/build/lib/config.js.map +1 -1
- package/build/lib/constants.d.ts +6 -5
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +65 -59
- package/build/lib/constants.js.map +1 -1
- package/build/lib/extension/driver-config.js +199 -164
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +33 -26
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +541 -396
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.js +98 -68
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts +27 -0
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -0
- package/build/lib/extension/manifest-migrations.js +118 -0
- package/build/lib/extension/manifest-migrations.js.map +1 -0
- package/build/lib/extension/manifest.d.ts +35 -63
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +500 -240
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/package-changed.js +57 -61
- package/build/lib/extension/package-changed.js.map +1 -1
- package/build/lib/extension/plugin-config.d.ts +2 -3
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +94 -70
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/grid-register.js +119 -137
- package/build/lib/grid-register.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 +5 -15
- package/build/lib/logger.js.map +1 -1
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +189 -183
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts +19 -12
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +330 -304
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/arg-spec.js +153 -108
- package/build/lib/schema/arg-spec.js.map +1 -1
- package/build/lib/schema/cli-args.js +203 -164
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/lib/schema/cli-transformers.js +117 -72
- package/build/lib/schema/cli-transformers.js.map +1 -1
- package/build/lib/schema/index.js +17 -32
- package/build/lib/schema/index.js.map +1 -1
- package/build/lib/schema/keywords.js +125 -67
- package/build/lib/schema/keywords.js.map +1 -1
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +582 -417
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +41 -255
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +342 -193
- package/build/lib/utils.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/cli.d.ts +45 -34
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/cli.js +3 -0
- package/build/types/cli.js.map +1 -0
- package/build/types/index.d.ts +1 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/index.js +19 -0
- package/build/types/index.js.map +1 -0
- package/build/types/manifest/base.d.ts +135 -0
- package/build/types/manifest/base.d.ts.map +1 -0
- package/build/types/manifest/base.js +3 -0
- package/build/types/manifest/base.js.map +1 -0
- package/build/types/manifest/index.d.ts +19 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +40 -0
- package/build/types/manifest/index.js.map +1 -0
- package/build/types/manifest/v3.d.ts +139 -0
- package/build/types/manifest/v3.d.ts.map +1 -0
- package/build/types/manifest/v3.js +3 -0
- package/build/types/manifest/v3.js.map +1 -0
- package/lib/appium.js +1 -1
- package/lib/cli/args.js +1 -1
- package/lib/cli/driver-command.js +17 -0
- package/lib/cli/extension-command.js +119 -65
- package/lib/cli/extension.js +9 -8
- package/lib/cli/parser.js +2 -2
- package/lib/config-file.js +2 -3
- package/lib/config.js +3 -2
- package/lib/constants.js +7 -5
- package/lib/extension/extension-config.js +52 -47
- package/lib/extension/manifest-migrations.js +120 -0
- package/lib/extension/manifest.js +184 -103
- package/lib/extension/plugin-config.js +1 -2
- package/lib/logsink.js +26 -5
- package/lib/main.js +58 -50
- package/lib/schema/schema.js +6 -1
- package/lib/utils.js +62 -0
- package/package.json +24 -25
- package/scripts/autoinstall-extensions.js +78 -26
- package/types/cli.ts +81 -42
- package/types/index.ts +1 -2
- package/types/manifest/README.md +30 -0
- package/types/manifest/base.ts +158 -0
- package/types/manifest/index.ts +27 -0
- package/types/manifest/v3.ts +161 -0
- package/build/types/appium-manifest.d.ts +0 -59
- package/build/types/appium-manifest.d.ts.map +0 -1
- package/build/types/extension-manifest.d.ts +0 -55
- package/build/types/extension-manifest.d.ts.map +0 -1
- package/types/appium-manifest.ts +0 -73
- package/types/extension-manifest.ts +0 -64
package/lib/main.js
CHANGED
|
@@ -23,10 +23,17 @@ import {
|
|
|
23
23
|
} from './config';
|
|
24
24
|
import {readConfigFile} from './config-file';
|
|
25
25
|
import {loadExtensions, getActivePlugins, getActiveDrivers} from './extension';
|
|
26
|
-
import {
|
|
26
|
+
import {SERVER_SUBCOMMAND} from './constants';
|
|
27
27
|
import registerNode from './grid-register';
|
|
28
28
|
import {getDefaultsForSchema, validate} from './schema/schema';
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
inspect,
|
|
31
|
+
adjustNodePath,
|
|
32
|
+
isDriverCommandArgs,
|
|
33
|
+
isExtensionCommandArgs,
|
|
34
|
+
isPluginCommandArgs,
|
|
35
|
+
isServerCommandArgs,
|
|
36
|
+
} from './utils';
|
|
30
37
|
|
|
31
38
|
const {resolveAppiumHome} = env;
|
|
32
39
|
|
|
@@ -143,16 +150,6 @@ function getExtraMethodMap(driverClasses, pluginClasses) {
|
|
|
143
150
|
{}
|
|
144
151
|
);
|
|
145
152
|
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* @template [T=WithServerSubcommand]
|
|
149
|
-
* @param {Args<T>} args
|
|
150
|
-
* @returns {args is Args<WithServerSubcommand>}
|
|
151
|
-
*/
|
|
152
|
-
function areServerCommandArgs(args) {
|
|
153
|
-
return args.subcommand === SERVER_SUBCOMMAND;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
153
|
/**
|
|
157
154
|
* Initializes Appium, but does not start the server.
|
|
158
155
|
*
|
|
@@ -160,9 +157,10 @@ function areServerCommandArgs(args) {
|
|
|
160
157
|
*
|
|
161
158
|
* If `args` contains a non-empty `subcommand` which is not `server`, this function will return an empty object.
|
|
162
159
|
*
|
|
163
|
-
* @template [
|
|
164
|
-
* @
|
|
165
|
-
* @
|
|
160
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
161
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
162
|
+
* @param {Args<Cmd, SubCmd>} [args] - Partial args (progammatic usage only)
|
|
163
|
+
* @returns {Promise<InitResult<Cmd>>}
|
|
166
164
|
* @example
|
|
167
165
|
* import {init, getSchema} from 'appium';
|
|
168
166
|
* const options = {}; // config object
|
|
@@ -178,7 +176,7 @@ async function init(args) {
|
|
|
178
176
|
|
|
179
177
|
const parser = getParser();
|
|
180
178
|
let throwInsteadOfExit = false;
|
|
181
|
-
/** @type {Args<
|
|
179
|
+
/** @type {Args<Cmd, SubCmd>} */
|
|
182
180
|
let preConfigArgs;
|
|
183
181
|
|
|
184
182
|
if (args) {
|
|
@@ -193,7 +191,7 @@ async function init(args) {
|
|
|
193
191
|
preConfigArgs = {...args, subcommand: args.subcommand ?? SERVER_SUBCOMMAND};
|
|
194
192
|
} else {
|
|
195
193
|
// otherwise parse from CLI
|
|
196
|
-
preConfigArgs = /** @type {Args<
|
|
194
|
+
preConfigArgs = /** @type {Args<Cmd, SubCmd>} */ (parser.parseArgs());
|
|
197
195
|
}
|
|
198
196
|
|
|
199
197
|
const configResult = await readConfigFile(preConfigArgs.configFile);
|
|
@@ -211,15 +209,15 @@ async function init(args) {
|
|
|
211
209
|
// 1. command line args
|
|
212
210
|
// 2. config file
|
|
213
211
|
// 3. defaults from config file.
|
|
214
|
-
if (
|
|
212
|
+
if (isServerCommandArgs(preConfigArgs)) {
|
|
215
213
|
const defaults = getDefaultsForSchema(false);
|
|
216
214
|
|
|
217
215
|
/** @type {ParsedArgs} */
|
|
218
|
-
const serverArgs = _.defaultsDeep(preConfigArgs, configResult.config?.server, defaults);
|
|
216
|
+
const serverArgs = _.defaultsDeep({}, preConfigArgs, configResult.config?.server, defaults);
|
|
219
217
|
|
|
220
218
|
if (preConfigArgs.showConfig) {
|
|
221
219
|
showConfig(getNonDefaultServerArgs(preConfigArgs), configResult, defaults, serverArgs);
|
|
222
|
-
return {};
|
|
220
|
+
return /** @type {InitResult<Cmd>} */ ({});
|
|
223
221
|
}
|
|
224
222
|
|
|
225
223
|
await logsinkInit(serverArgs);
|
|
@@ -252,49 +250,49 @@ async function init(args) {
|
|
|
252
250
|
appiumDriver.driverConfig = driverConfig;
|
|
253
251
|
await preflightChecks(serverArgs, throwInsteadOfExit);
|
|
254
252
|
|
|
255
|
-
return /** @type {
|
|
253
|
+
return /** @type {InitResult<Cmd>} */ ({
|
|
256
254
|
appiumDriver,
|
|
257
255
|
parsedArgs: serverArgs,
|
|
258
256
|
driverConfig,
|
|
259
257
|
pluginConfig,
|
|
260
258
|
});
|
|
261
259
|
} else {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (preConfigArgs.subcommand === PLUGIN_TYPE) {
|
|
272
|
-
await runExtensionCommand(extensionCommandArgs, pluginConfig);
|
|
273
|
-
return {};
|
|
260
|
+
if (isExtensionCommandArgs(preConfigArgs)) {
|
|
261
|
+
// if the user has requested the 'driver' CLI, don't run the normal server,
|
|
262
|
+
// but instead pass control to the driver CLI
|
|
263
|
+
if (isDriverCommandArgs(preConfigArgs)) {
|
|
264
|
+
await runExtensionCommand(preConfigArgs, driverConfig);
|
|
265
|
+
}
|
|
266
|
+
if (isPluginCommandArgs(preConfigArgs)) {
|
|
267
|
+
await runExtensionCommand(preConfigArgs, pluginConfig);
|
|
268
|
+
}
|
|
274
269
|
}
|
|
275
|
-
|
|
276
|
-
return {}; // should never happen
|
|
270
|
+
return /** @type {InitResult<Cmd>} */ ({});
|
|
277
271
|
}
|
|
278
272
|
}
|
|
279
273
|
|
|
280
274
|
/**
|
|
281
275
|
* Initializes Appium's config. Starts server if appropriate and resolves the
|
|
282
276
|
* server instance if so; otherwise resolves w/ `undefined`.
|
|
283
|
-
* @template [
|
|
284
|
-
* @
|
|
285
|
-
* @
|
|
277
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
278
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
279
|
+
* @param {Args<Cmd, SubCmd>} [args] - Arguments from CLI or otherwise
|
|
280
|
+
* @returns {Promise<Cmd extends ServerCommand ? import('@appium/types').AppiumServer : void>}
|
|
286
281
|
*/
|
|
287
282
|
async function main(args) {
|
|
288
|
-
const
|
|
289
|
-
await init(args)
|
|
290
|
-
);
|
|
283
|
+
const initResult = await init(args);
|
|
291
284
|
|
|
292
|
-
if (
|
|
285
|
+
if (_.isEmpty(initResult)) {
|
|
293
286
|
// if this branch is taken, we've run a different subcommand, so there's nothing
|
|
294
287
|
// left to do here.
|
|
295
|
-
return
|
|
288
|
+
return /** @type {Cmd extends ServerCommand ? import('@appium/types').AppiumServer : void} */ (
|
|
289
|
+
undefined
|
|
290
|
+
);
|
|
296
291
|
}
|
|
297
292
|
|
|
293
|
+
const {appiumDriver, pluginConfig, driverConfig, parsedArgs} =
|
|
294
|
+
/** @type {InitResult<ServerCommand>} */ (initResult);
|
|
295
|
+
|
|
298
296
|
const pluginClasses = getActivePlugins(pluginConfig, parsedArgs.usePlugins);
|
|
299
297
|
// set the active plugins on the umbrella driver so it can use them for commands
|
|
300
298
|
appiumDriver.pluginClasses = pluginClasses;
|
|
@@ -377,7 +375,9 @@ async function main(args) {
|
|
|
377
375
|
driverConfig.print();
|
|
378
376
|
pluginConfig.print([...pluginClasses.values()]);
|
|
379
377
|
|
|
380
|
-
return
|
|
378
|
+
return /** @type {Cmd extends ServerCommand ? import('@appium/types').AppiumServer : void} */ (
|
|
379
|
+
server
|
|
380
|
+
);
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
// NOTE: this is here for backwards compat for any scripts referencing `main.js` directly
|
|
@@ -397,7 +397,12 @@ export {main, init, resolveAppiumHome};
|
|
|
397
397
|
* @typedef {import('@appium/types').PluginType} PluginType
|
|
398
398
|
* @typedef {import('@appium/types').DriverClass} DriverClass
|
|
399
399
|
* @typedef {import('@appium/types').PluginClass} PluginClass
|
|
400
|
-
* @typedef {import('appium/types').
|
|
400
|
+
* @typedef {import('appium/types').CliCommand} CliCommand
|
|
401
|
+
* @typedef {import('appium/types').CliExtensionSubcommand} CliExtensionSubcommand
|
|
402
|
+
* @typedef {import('appium/types').CliExtensionCommand} CliExtensionCommand
|
|
403
|
+
* @typedef {import('appium/types').ServerCommand} ServerCommand
|
|
404
|
+
* @typedef {import('appium/types').DriverCommand} DriverCommand
|
|
405
|
+
* @typedef {import('appium/types').PluginCommand} PluginCommand
|
|
401
406
|
* @typedef {import('./extension').DriverNameMap} DriverNameMap
|
|
402
407
|
* @typedef {import('./extension').PluginNameMap} PluginNameMap
|
|
403
408
|
*/
|
|
@@ -414,15 +419,18 @@ export {main, init, resolveAppiumHome};
|
|
|
414
419
|
*/
|
|
415
420
|
|
|
416
421
|
/**
|
|
417
|
-
* @
|
|
422
|
+
* @template {CliCommand} Cmd
|
|
423
|
+
* @typedef {Cmd extends ServerCommand ? ServerInitData & import('./extension').ExtensionConfigs : ExtCommandInitResult} InitResult
|
|
418
424
|
*/
|
|
419
425
|
|
|
420
426
|
/**
|
|
421
|
-
* @template [
|
|
422
|
-
* @
|
|
427
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
428
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
429
|
+
* @typedef {import('appium/types').Args<Cmd, SubCmd>} Args
|
|
423
430
|
*/
|
|
424
431
|
|
|
425
432
|
/**
|
|
426
|
-
* @template [
|
|
427
|
-
* @
|
|
433
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
434
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
435
|
+
* @typedef {import('appium/types').ParsedArgs<Cmd, SubCmd>} ParsedArgs
|
|
428
436
|
*/
|
package/lib/schema/schema.js
CHANGED
|
@@ -43,6 +43,8 @@ export class RoachHotelMap extends Map {
|
|
|
43
43
|
*/
|
|
44
44
|
export const ALLOWED_SCHEMA_EXTENSIONS = new Set(['.json', '.js', '.cjs']);
|
|
45
45
|
|
|
46
|
+
const SCHEMA_KEY = '$schema';
|
|
47
|
+
|
|
46
48
|
/**
|
|
47
49
|
* A wrapper around Ajv and schema-related functions.
|
|
48
50
|
*
|
|
@@ -316,7 +318,7 @@ class AppiumSchema {
|
|
|
316
318
|
}
|
|
317
319
|
const normalizedExtName = _.kebabCase(extName);
|
|
318
320
|
if (this.hasRegisteredSchema(extType, normalizedExtName)) {
|
|
319
|
-
if (this._registeredSchemas[extType].get(normalizedExtName)
|
|
321
|
+
if (_.isEqual(this._registeredSchemas[extType].get(normalizedExtName), schema)) {
|
|
320
322
|
return;
|
|
321
323
|
}
|
|
322
324
|
throw new SchemaNameConflictError(extType, extName);
|
|
@@ -441,6 +443,9 @@ class AppiumSchema {
|
|
|
441
443
|
for (const {properties, prefix} of stack) {
|
|
442
444
|
const pairs = _.toPairs(properties);
|
|
443
445
|
for (const [key, value] of pairs) {
|
|
446
|
+
if (key === SCHEMA_KEY) {
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
444
449
|
const {properties, $ref} = value;
|
|
445
450
|
if (properties) {
|
|
446
451
|
stack.push({
|
package/lib/utils.js
CHANGED
|
@@ -4,6 +4,7 @@ import {processCapabilities, PROTOCOLS, STANDARD_CAPS} from '@appium/base-driver
|
|
|
4
4
|
import {inspect as dump} from 'util';
|
|
5
5
|
import {node} from '@appium/support';
|
|
6
6
|
import path from 'path';
|
|
7
|
+
import {SERVER_SUBCOMMAND, DRIVER_TYPE, PLUGIN_TYPE} from './constants';
|
|
7
8
|
|
|
8
9
|
const W3C_APPIUM_PREFIX = 'appium';
|
|
9
10
|
const STANDARD_CAPS_LOWERCASE = new Set([...STANDARD_CAPS].map((cap) => cap.toLowerCase()));
|
|
@@ -289,6 +290,46 @@ function pullSettings(caps) {
|
|
|
289
290
|
return result;
|
|
290
291
|
}
|
|
291
292
|
|
|
293
|
+
/**
|
|
294
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
295
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
296
|
+
* @param {Args<Cmd, SubCmd>} args
|
|
297
|
+
* @returns {args is Args<ServerCommand>}
|
|
298
|
+
*/
|
|
299
|
+
export function isServerCommandArgs(args) {
|
|
300
|
+
return args.subcommand === SERVER_SUBCOMMAND;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
305
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
306
|
+
* @param {Args<Cmd, SubCmd>} args
|
|
307
|
+
* @returns {args is Args<CliExtensionCommand, SubCmd>}
|
|
308
|
+
*/
|
|
309
|
+
export function isExtensionCommandArgs(args) {
|
|
310
|
+
return args.subcommand === DRIVER_TYPE || args.subcommand === PLUGIN_TYPE;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @template {CliCommand} Cmd
|
|
315
|
+
* @template {CliExtensionSubcommand} SubCmd
|
|
316
|
+
* @param {Args<Cmd, SubCmd>} args
|
|
317
|
+
* @returns {args is Args<DriverCommand, SubCmd>}
|
|
318
|
+
*/
|
|
319
|
+
export function isDriverCommandArgs(args) {
|
|
320
|
+
return args.subcommand === DRIVER_TYPE;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @template {CliCommand} Cmd
|
|
325
|
+
* @template {CliExtensionSubcommand} SubCmd
|
|
326
|
+
* @param {Args<Cmd, SubCmd>} args
|
|
327
|
+
* @returns {args is Args<PluginCommand, SubCmd>}
|
|
328
|
+
*/
|
|
329
|
+
export function isPluginCommandArgs(args) {
|
|
330
|
+
return args.subcommand === PLUGIN_TYPE;
|
|
331
|
+
}
|
|
332
|
+
|
|
292
333
|
export {
|
|
293
334
|
inspect,
|
|
294
335
|
parseCapsForInnerDriver,
|
|
@@ -357,3 +398,24 @@ export {
|
|
|
357
398
|
/**
|
|
358
399
|
* @typedef {import('@appium/types').Constraints} Constraints
|
|
359
400
|
*/
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* @typedef {import('appium/types').CliCommand} CliCommand
|
|
404
|
+
* @typedef {import('appium/types').CliExtensionSubcommand} CliExtensionSubcommand
|
|
405
|
+
* @typedef {import('appium/types').CliExtensionCommand} CliExtensionCommand
|
|
406
|
+
* @typedef {import('appium/types').ServerCommand} ServerCommand
|
|
407
|
+
* @typedef {import('appium/types').DriverCommand} DriverCommand
|
|
408
|
+
* @typedef {import('appium/types').PluginCommand} PluginCommand
|
|
409
|
+
*/
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
413
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
414
|
+
* @typedef {import('appium/types').Args<Cmd, SubCmd>} Args
|
|
415
|
+
*/
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @template {CliCommand} [Cmd=ServerCommand]
|
|
419
|
+
* @template {CliExtensionSubcommand|void} [SubCmd=void]
|
|
420
|
+
* @typedef {import('appium/types').ParsedArgs<Cmd, SubCmd>} ParsedArgs
|
|
421
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.48",
|
|
4
4
|
"description": "Automation for Apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -41,45 +41,41 @@
|
|
|
41
41
|
"types"
|
|
42
42
|
],
|
|
43
43
|
"scripts": {
|
|
44
|
-
"build": "babel lib --root-mode=upward --out-dir=build/lib",
|
|
45
44
|
"build:docs": "node docs/scripts/build-docs.js",
|
|
46
|
-
"build:docs:cli": "node docs/scripts/gen-cli-args-docs.js",
|
|
47
45
|
"build:docs:assets": "node docs/scripts/copy-assets.js",
|
|
48
|
-
"
|
|
46
|
+
"build:docs:cli": "node docs/scripts/gen-cli-args-docs.js",
|
|
47
|
+
"build:docs:reference": "node docs/scripts/build-reference.js",
|
|
49
48
|
"dev:docs": "npm run build:docs:assets && npm run dev:docs:en",
|
|
50
49
|
"dev:docs:en": "mkdocs serve -f ./docs/mkdocs-en.yml",
|
|
51
50
|
"dev:docs:ja": "mkdocs serve -f ./docs/mkdocs-ja.yml",
|
|
52
51
|
"dev:docs:zh": "mkdocs serve -f ./docs/mkdocs-zh.yml",
|
|
53
|
-
"fix": "npm run lint -- --fix",
|
|
54
52
|
"postinstall": "node ./scripts/autoinstall-extensions.js",
|
|
55
|
-
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
56
|
-
"prepare": "npm run build",
|
|
57
53
|
"publish:docs": "cross-env APPIUM_DOCS_PUBLISH=1 npm run build:docs",
|
|
58
54
|
"test": "npm run test:unit",
|
|
59
|
-
"test:e2e": "mocha --timeout 1m --slow 30s \"./test/e2e/**/*.spec.js\"",
|
|
55
|
+
"test:e2e": "mocha -p --timeout 1m --slow 30s \"./test/e2e/**/*.spec.js\"",
|
|
60
56
|
"test:smoke": "cross-env APPIUM_HOME=./local_appium_home node ./index.js driver install uiautomator2 && cross-env APPIUM_HOME=./local_appium_home node ./index.js driver list",
|
|
61
57
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
62
58
|
},
|
|
63
59
|
"dependencies": {
|
|
64
|
-
"@appium/base-driver": "^
|
|
65
|
-
"@appium/base-plugin": "^
|
|
66
|
-
"@appium/docutils": "^0.
|
|
67
|
-
"@appium/schema": "^0.0
|
|
68
|
-
"@appium/support": "^
|
|
69
|
-
"@appium/types": "^0.
|
|
60
|
+
"@appium/base-driver": "^9.1.0",
|
|
61
|
+
"@appium/base-plugin": "^2.0.1",
|
|
62
|
+
"@appium/docutils": "^0.1.1",
|
|
63
|
+
"@appium/schema": "^0.1.0",
|
|
64
|
+
"@appium/support": "^3.0.1",
|
|
65
|
+
"@appium/types": "^0.7.0",
|
|
70
66
|
"@sidvind/better-ajv-errors": "2.1.0",
|
|
71
67
|
"@types/argparse": "2.0.10",
|
|
72
|
-
"@types/bluebird": "3.5.
|
|
68
|
+
"@types/bluebird": "3.5.38",
|
|
73
69
|
"@types/fancy-log": "2.0.0",
|
|
74
|
-
"@types/semver": "7.3.
|
|
75
|
-
"@types/teen_process": "
|
|
70
|
+
"@types/semver": "7.3.13",
|
|
71
|
+
"@types/teen_process": "2.0.0",
|
|
76
72
|
"@types/wrap-ansi": "3.0.0",
|
|
77
|
-
"ajv": "8.11.
|
|
73
|
+
"ajv": "8.11.2",
|
|
78
74
|
"ajv-formats": "2.1.1",
|
|
79
75
|
"argparse": "2.0.1",
|
|
80
|
-
"async-lock": "1.
|
|
81
|
-
"asyncbox": "2.9.
|
|
82
|
-
"axios": "
|
|
76
|
+
"async-lock": "1.4.0",
|
|
77
|
+
"asyncbox": "2.9.4",
|
|
78
|
+
"axios": "1.2.1",
|
|
83
79
|
"bluebird": "3.7.2",
|
|
84
80
|
"cross-env": "7.0.3",
|
|
85
81
|
"find-up": "5.0.0",
|
|
@@ -87,25 +83,28 @@
|
|
|
87
83
|
"lilconfig": "2.0.6",
|
|
88
84
|
"lodash": "4.17.21",
|
|
89
85
|
"longjohn": "0.2.12",
|
|
90
|
-
"npmlog": "
|
|
86
|
+
"npmlog": "7.0.1",
|
|
91
87
|
"ora": "5.4.1",
|
|
92
88
|
"package-changed": "1.9.0",
|
|
93
89
|
"resolve-from": "5.0.0",
|
|
94
90
|
"semver": "7.3.8",
|
|
95
91
|
"source-map-support": "0.5.21",
|
|
96
92
|
"teen_process": "2.0.2",
|
|
97
|
-
"type-fest": "3.
|
|
93
|
+
"type-fest": "3.4.0",
|
|
98
94
|
"winston": "3.8.2",
|
|
99
95
|
"wrap-ansi": "7.0.0",
|
|
100
96
|
"yaml": "2.1.3"
|
|
101
97
|
},
|
|
102
98
|
"engines": {
|
|
103
|
-
"node": ">=
|
|
99
|
+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
|
104
100
|
"npm": ">=8"
|
|
105
101
|
},
|
|
106
102
|
"publishConfig": {
|
|
107
103
|
"access": "public",
|
|
108
104
|
"tag": "next"
|
|
109
105
|
},
|
|
110
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "2e76ba9607729f59ca967e47c2cba738e90a57b8",
|
|
107
|
+
"typedoc": {
|
|
108
|
+
"entryPoint": "./build/lib/main.js"
|
|
109
|
+
}
|
|
111
110
|
}
|
|
@@ -14,10 +14,24 @@
|
|
|
14
14
|
* code upon failure (which will typically break a build). Otherwise, it
|
|
15
15
|
* will always exit with code 0, even if errors occur.
|
|
16
16
|
*
|
|
17
|
+
* @module
|
|
17
18
|
* @example
|
|
18
19
|
* `npm install -g appium --drivers=uiautomator2,xcuitest --plugins=images`
|
|
19
20
|
*/
|
|
20
21
|
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const {exec} = require('teen_process');
|
|
24
|
+
const B = require('bluebird');
|
|
25
|
+
|
|
26
|
+
B.config({
|
|
27
|
+
cancellation: true,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This is only used if we're actually in the monorepo
|
|
32
|
+
*/
|
|
33
|
+
const MONOREPO_ROOT = path.join(__dirname, '..', '..', '..');
|
|
34
|
+
|
|
21
35
|
/** @type {import('../lib/cli/extension').runExtensionCommand} */
|
|
22
36
|
let runExtensionCommand;
|
|
23
37
|
/** @type {import('../lib/constants').DRIVER_TYPE} */
|
|
@@ -27,44 +41,82 @@ let PLUGIN_TYPE;
|
|
|
27
41
|
/** @type {import('../lib/extension').loadExtensions} */
|
|
28
42
|
let loadExtensions;
|
|
29
43
|
|
|
30
|
-
const {env, util, logger} = require('@appium/support');
|
|
31
44
|
const _ = require('lodash');
|
|
32
45
|
const wrap = _.partial(
|
|
33
46
|
require('wrap-ansi'),
|
|
34
47
|
_,
|
|
35
|
-
process.stderr.columns ?? process.stdout.columns ??
|
|
48
|
+
process.stderr.columns ?? process.stdout.columns ?? 80
|
|
36
49
|
);
|
|
37
|
-
|
|
38
50
|
const ora = require('ora');
|
|
39
51
|
|
|
40
|
-
|
|
52
|
+
let env, util, logger;
|
|
53
|
+
|
|
54
|
+
function log(message) {
|
|
41
55
|
console.error(wrap(`[Appium] ${message}`));
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function init() {
|
|
59
|
+
/** @type {import('ora').Ora} */
|
|
60
|
+
let spinner;
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
({env, util, logger} = require('@appium/support'));
|
|
64
|
+
require('..');
|
|
65
|
+
} catch {
|
|
66
|
+
spinner = ora({
|
|
67
|
+
text: 'Building Appium dev environment...',
|
|
68
|
+
prefixText: '[Appium]',
|
|
69
|
+
}).start();
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const {stderr, code} = await exec('npm', ['run', 'build'], {
|
|
73
|
+
cwd: MONOREPO_ROOT,
|
|
74
|
+
encoding: 'utf8',
|
|
75
|
+
});
|
|
76
|
+
if (!code) {
|
|
77
|
+
spinner.succeed('Appium build successfully.');
|
|
78
|
+
} else {
|
|
79
|
+
spinner.fail(`Building Appium failed!`);
|
|
80
|
+
log(stderr);
|
|
81
|
+
}
|
|
82
|
+
} catch (err) {
|
|
83
|
+
spinner.fail(`Building Appium failed!`);
|
|
84
|
+
log(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
spinner = ora({
|
|
89
|
+
text: 'Checking Appium installation...',
|
|
90
|
+
prefixText: '[Appium]',
|
|
91
|
+
}).start();
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
({env, util, logger} = require('@appium/support'));
|
|
95
|
+
({runExtensionCommand} = require('../build/lib/cli/extension'));
|
|
96
|
+
({DRIVER_TYPE, PLUGIN_TYPE} = require('../build/lib/constants'));
|
|
97
|
+
({loadExtensions} = require('../build/lib/extension'));
|
|
98
|
+
spinner.succeed('Appium installation OK');
|
|
99
|
+
// suppress logs from Appium, which mess up the script output
|
|
100
|
+
logger.getLogger('Appium').level = 'error';
|
|
101
|
+
} catch (e) {
|
|
102
|
+
spinner.fail(`Could not load required module(s); has Appium been built? (${e.message})`);
|
|
103
|
+
if (process.env.CI) {
|
|
104
|
+
log('Detected CI environment, exiting with code 1');
|
|
105
|
+
process.exitCode = 1;
|
|
106
|
+
} else {
|
|
107
|
+
process.exitCode = 0;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
63
110
|
}
|
|
64
|
-
|
|
111
|
+
|
|
112
|
+
return true;
|
|
65
113
|
}
|
|
66
114
|
|
|
67
115
|
async function main() {
|
|
116
|
+
if (!(await init())) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
68
120
|
// if we're doing `npm install -g appium` then we will assume we don't have a local appium.
|
|
69
121
|
if (!process.env.npm_config_global && (await env.hasAppiumDependency())) {
|
|
70
122
|
log(`Found local Appium installation; skipping automatic installation of extensions.`);
|