appium 2.12.1 → 2.13.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/build/lib/appium.d.ts +1 -1
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +2 -2
- 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 +8 -7
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/parser.d.ts +4 -4
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/setup-command.d.ts +2 -2
- package/build/lib/cli/setup-command.d.ts.map +1 -1
- package/build/lib/cli/setup-command.js +57 -4
- package/build/lib/cli/setup-command.js.map +1 -1
- package/build/lib/cli/utils.d.ts.map +1 -1
- package/build/lib/config-file.d.ts +2 -2
- package/build/lib/config-file.d.ts.map +1 -1
- package/build/lib/config.d.ts +3 -3
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/doctor/doctor.d.ts +1 -1
- package/build/lib/doctor/doctor.d.ts.map +1 -1
- package/build/lib/extension/extension-config.d.ts +2 -2
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/index.d.ts +1 -1
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/manifest.d.ts +3 -1
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/grid-register.d.ts +1 -1
- package/build/lib/grid-register.d.ts.map +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logsink.js +1 -1
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts +3 -3
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +10 -1
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/arg-spec.d.ts +4 -4
- package/build/lib/schema/arg-spec.d.ts.map +1 -1
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/schema.d.ts +4 -4
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/utils.d.ts +9 -2
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +30 -0
- package/build/lib/utils.js.map +1 -1
- package/build/types/cli.d.ts +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/manifest/index.js +17 -7
- package/build/types/manifest/index.js.map +1 -1
- package/lib/appium.js +3 -2
- package/lib/cli/extension-command.js +9 -7
- package/lib/cli/setup-command.js +64 -4
- package/lib/logsink.js +1 -1
- package/lib/main.js +10 -1
- package/lib/utils.js +39 -2
- package/package.json +11 -11
- package/types/cli.ts +1 -1
package/build/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../types/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AACxC,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAC1C,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEtE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,mBAAmB,GAAG,eAAe,CAAC;AAElF;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../types/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,UAAU,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|
o["default"] = v;
|
|
21
21
|
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
29
39
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
30
40
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
31
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../types/manifest/index.ts"],"names":[],"mappings":";AAAA;;;GAGG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../types/manifest/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAQ7B,gCAAU;AAPlB,iDAAmC;AAOf,gCAAU;AAN9B,iDAAmC;AAMH,gCAAU;AAL1C,0EAA0E;AAE1E,uCAAqB"}
|
package/lib/appium.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
isBroadcastIp,
|
|
23
23
|
fetchInterfaces,
|
|
24
24
|
V4_BROADCAST_IP,
|
|
25
|
+
validateFeatures,
|
|
25
26
|
} from './utils';
|
|
26
27
|
import {util, node, logger} from '@appium/support';
|
|
27
28
|
import {getDefaultsForExtension} from './schema';
|
|
@@ -697,13 +698,13 @@ class AppiumDriver extends DriverCore {
|
|
|
697
698
|
if (!_.isEmpty(this.args.denyInsecure)) {
|
|
698
699
|
this.log.info('Explicitly preventing use of insecure features:');
|
|
699
700
|
this.args.denyInsecure.map((a) => this.log.info(` ${a}`));
|
|
700
|
-
driverInstance.denyInsecure = this.args.denyInsecure;
|
|
701
|
+
driverInstance.denyInsecure = validateFeatures(this.args.denyInsecure);
|
|
701
702
|
}
|
|
702
703
|
|
|
703
704
|
if (!_.isEmpty(this.args.allowInsecure)) {
|
|
704
705
|
this.log.info('Explicitly enabling use of insecure features:');
|
|
705
706
|
this.args.allowInsecure.map((a) => this.log.info(` ${a}`));
|
|
706
|
-
driverInstance.allowInsecure = this.args.allowInsecure;
|
|
707
|
+
driverInstance.allowInsecure = validateFeatures(this.args.allowInsecure);
|
|
707
708
|
}
|
|
708
709
|
|
|
709
710
|
// Likewise, any driver-specific CLI args that were passed in should be assigned directly to
|
|
@@ -311,7 +311,7 @@ class ExtensionCliCommand {
|
|
|
311
311
|
installType,
|
|
312
312
|
pkgName: /** @type {string} */ (packageName),
|
|
313
313
|
};
|
|
314
|
-
probableExtName =
|
|
314
|
+
probableExtName = /** @type {string} */ (packageName);
|
|
315
315
|
} else if (installType === INSTALL_TYPE_GIT) {
|
|
316
316
|
// git urls can have '.git' at the end, but this is not necessary and would complicate the
|
|
317
317
|
// way we download and name directories, so we can just remove it
|
|
@@ -321,7 +321,7 @@ class ExtensionCliCommand {
|
|
|
321
321
|
installType,
|
|
322
322
|
pkgName: /** @type {string} */ (packageName),
|
|
323
323
|
};
|
|
324
|
-
probableExtName =
|
|
324
|
+
probableExtName = /** @type {string} */ (packageName);
|
|
325
325
|
} else {
|
|
326
326
|
let pkgName, pkgVer;
|
|
327
327
|
if (installType === INSTALL_TYPE_LOCAL) {
|
|
@@ -439,13 +439,15 @@ class ExtensionCliCommand {
|
|
|
439
439
|
* @returns {Promise<ExtInstallReceipt<ExtType>>}
|
|
440
440
|
*/
|
|
441
441
|
async installViaNpm({installSpec, pkgName, pkgVer, installType}) {
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
442
|
+
const msg = `Installing '${installSpec}'`;
|
|
443
|
+
|
|
444
|
+
// the string used for installation is either <name>@<ver> in the case of a standard NPM
|
|
445
|
+
// package, or whatever the user sent in otherwise.
|
|
446
|
+
const installStr = installType === INSTALL_TYPE_NPM ? `${pkgName}${pkgVer ? `@${pkgVer}` : ''}` : installSpec;
|
|
445
447
|
try {
|
|
446
448
|
const {pkg, path} = await spinWith(this.isJsonOutput, msg, async () => {
|
|
447
|
-
const {pkg, installPath: path} = await npm.installPackage(this.config.appiumHome,
|
|
448
|
-
|
|
449
|
+
const {pkg, installPath: path} = await npm.installPackage(this.config.appiumHome, installStr, {
|
|
450
|
+
pkgName,
|
|
449
451
|
installType,
|
|
450
452
|
});
|
|
451
453
|
this.validatePackageJson(pkg, installSpec);
|
package/lib/cli/setup-command.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
MOBILE_DRIVERS
|
|
6
6
|
} from '../constants';
|
|
7
7
|
import {runExtensionCommand} from './extension';
|
|
8
|
-
import { system } from '@appium/support';
|
|
8
|
+
import { system, fs } from '@appium/support';
|
|
9
9
|
import log from '../logger';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -14,6 +14,7 @@ import log from '../logger';
|
|
|
14
14
|
export const SUBCOMMAND_MOBILE = 'mobile';
|
|
15
15
|
export const SUBCOMMAND_DESKTOP = 'desktop';
|
|
16
16
|
export const SUBCOMMAND_BROWSER = 'browser';
|
|
17
|
+
export const SUBCOMMAND_RESET = 'reset';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Pairs of preset subcommand and driver candidates.
|
|
@@ -72,12 +73,11 @@ export function determinePlatformName() {
|
|
|
72
73
|
* Run 'setup' command to install drivers/plugins into the given appium home.
|
|
73
74
|
* @template {import('appium/types').CliCommandSetup} SetupCmd
|
|
74
75
|
* @param {import('appium/types').Args<SetupCmd>} preConfigArgs
|
|
75
|
-
* @param {string} appiumHome
|
|
76
76
|
* @param {DriverConfig} driverConfig
|
|
77
77
|
* @param {PluginConfig} pluginConfig
|
|
78
78
|
* @returns {Promise<void>}
|
|
79
79
|
*/
|
|
80
|
-
export async function runSetupCommand(
|
|
80
|
+
export async function runSetupCommand(preConfigArgs, driverConfig, pluginConfig) {
|
|
81
81
|
switch (preConfigArgs.setupCommand) {
|
|
82
82
|
case SUBCOMMAND_DESKTOP:
|
|
83
83
|
await setupDesktopAppDrivers(driverConfig);
|
|
@@ -87,6 +87,9 @@ export async function runSetupCommand(appiumHome, preConfigArgs, driverConfig, p
|
|
|
87
87
|
await setupBrowserDrivers(driverConfig);
|
|
88
88
|
await setupDefaultPlugins(pluginConfig);
|
|
89
89
|
break;
|
|
90
|
+
case SUBCOMMAND_RESET:
|
|
91
|
+
await resetAllExtensions(driverConfig, pluginConfig);
|
|
92
|
+
break;
|
|
90
93
|
default:
|
|
91
94
|
await setupMobileDrivers(driverConfig);
|
|
92
95
|
await setupDefaultPlugins(pluginConfig);
|
|
@@ -94,6 +97,47 @@ export async function runSetupCommand(appiumHome, preConfigArgs, driverConfig, p
|
|
|
94
97
|
}
|
|
95
98
|
};
|
|
96
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Resets all installed drivers and extensions
|
|
102
|
+
*
|
|
103
|
+
* @param {DriverConfig} driverConfig
|
|
104
|
+
* @param {PluginConfig} pluginConfig
|
|
105
|
+
* @returns {Promise<void>}
|
|
106
|
+
*/
|
|
107
|
+
async function resetAllExtensions(driverConfig, pluginConfig) {
|
|
108
|
+
for (const [command, config] of [
|
|
109
|
+
['driver', driverConfig],
|
|
110
|
+
['plugin', pluginConfig],
|
|
111
|
+
]) {
|
|
112
|
+
for (const extensionName of _.keys(/** @type {DriverConfig|PluginConfig} */ (config).installedExtensions)) {
|
|
113
|
+
try {
|
|
114
|
+
await uninstallExtension(
|
|
115
|
+
extensionName,
|
|
116
|
+
extensionCommandArgs(/** @type {CliExtensionCommand} */ (command), extensionName, 'uninstall'),
|
|
117
|
+
/** @type {DriverConfig|PluginConfig} */ (config)
|
|
118
|
+
);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
log.warn(
|
|
121
|
+
`${extensionName} ${command} cannot be uninstalled. Will delete the manifest anyway. ` +
|
|
122
|
+
`Original error: ${e.stack}`
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const manifestPath = /** @type {DriverConfig|PluginConfig} */ (config).manifestPath;
|
|
128
|
+
if (!await fs.exists(manifestPath)) {
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
await fs.rimraf(manifestPath);
|
|
133
|
+
if (await fs.exists(manifestPath)) {
|
|
134
|
+
throw new Error(`${command} manifest at '${manifestPath}' cannot be deleted. Is it accessible?`);
|
|
135
|
+
} else {
|
|
136
|
+
log.info(`Successfully deleted ${command} manifest at '${manifestPath}'`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
97
141
|
/**
|
|
98
142
|
* Install drivers listed in DEFAULT_DRIVERS.
|
|
99
143
|
* @param {DriverConfig} driverConfig
|
|
@@ -149,7 +193,7 @@ async function setupDefaultPlugins(pluginConfig) {
|
|
|
149
193
|
* @param {string} extensionName
|
|
150
194
|
* @param {Args} extensionConfigArgs
|
|
151
195
|
* @param {DriverConfig|PluginConfig} extensionConfig
|
|
152
|
-
* @returns
|
|
196
|
+
* @returns {Promise<void>}
|
|
153
197
|
*/
|
|
154
198
|
async function installExtension(extensionName, extensionConfigArgs, extensionConfig) {
|
|
155
199
|
if (_.keys(extensionConfig.installedExtensions).includes(extensionName)) {
|
|
@@ -160,6 +204,22 @@ async function installExtension(extensionName, extensionConfigArgs, extensionCon
|
|
|
160
204
|
await runExtensionCommand(extensionConfigArgs, extensionConfig);
|
|
161
205
|
}
|
|
162
206
|
|
|
207
|
+
/**
|
|
208
|
+
* Run the given extensionConfigArgs command after checking if the given extensionName was already installed.
|
|
209
|
+
* @param {string} extensionName
|
|
210
|
+
* @param {Args} extensionConfigArgs
|
|
211
|
+
* @param {DriverConfig|PluginConfig} extensionConfig
|
|
212
|
+
* @returns {Promise<void>}
|
|
213
|
+
*/
|
|
214
|
+
async function uninstallExtension(extensionName, extensionConfigArgs, extensionConfig) {
|
|
215
|
+
if (!_.keys(extensionConfig.installedExtensions).includes(extensionName)) {
|
|
216
|
+
log.info(`${extensionName} (${extensionConfig.installedExtensions[extensionName].version}) is not installed. ` +
|
|
217
|
+
`Skipping its uninstall.`);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
await runExtensionCommand(extensionConfigArgs, extensionConfig);
|
|
221
|
+
}
|
|
222
|
+
|
|
163
223
|
/**
|
|
164
224
|
* Return the command config for driver or plugin.
|
|
165
225
|
* @param {CliExtensionCommand} extensionCommand
|
package/lib/logsink.js
CHANGED
|
@@ -120,7 +120,7 @@ const stripColorFormat = format(function stripColor(info) {
|
|
|
120
120
|
return {
|
|
121
121
|
...info,
|
|
122
122
|
level: stripColorCodes(info.level),
|
|
123
|
-
message: stripColorCodes(info.message),
|
|
123
|
+
message: _.isString(info.message) ? stripColorCodes(info.message) : info.message,
|
|
124
124
|
};
|
|
125
125
|
})();
|
|
126
126
|
|
package/lib/main.js
CHANGED
|
@@ -45,6 +45,14 @@ import {
|
|
|
45
45
|
import net from 'node:net';
|
|
46
46
|
|
|
47
47
|
const {resolveAppiumHome} = env;
|
|
48
|
+
/*
|
|
49
|
+
* By default Node.js shows a warning
|
|
50
|
+
* if the actual amount of listeners exceeds the maximum amount,
|
|
51
|
+
* which equals to 10 by default. It is known that multiple drivers/plugins
|
|
52
|
+
* may assign custom listeners to the server process to handle, for example,
|
|
53
|
+
* the graceful shutdown scenario.
|
|
54
|
+
*/
|
|
55
|
+
const MAX_SERVER_PROCESS_LISTENERS = 100;
|
|
48
56
|
|
|
49
57
|
/**
|
|
50
58
|
*
|
|
@@ -293,7 +301,7 @@ async function init(args) {
|
|
|
293
301
|
appiumHome,
|
|
294
302
|
});
|
|
295
303
|
} else if (isSetupCommandArgs(preConfigArgs)) {
|
|
296
|
-
await runSetupCommand(
|
|
304
|
+
await runSetupCommand(preConfigArgs, driverConfig, pluginConfig);
|
|
297
305
|
return /** @type {InitResult<Cmd>} */ ({});
|
|
298
306
|
} else {
|
|
299
307
|
await requireDir(appiumHome, true, appiumHomeSourceName);
|
|
@@ -433,6 +441,7 @@ async function main(args) {
|
|
|
433
441
|
throw err;
|
|
434
442
|
}
|
|
435
443
|
|
|
444
|
+
process.setMaxListeners(MAX_SERVER_PROCESS_LISTENERS);
|
|
436
445
|
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
437
446
|
process.once(signal, async function onSignal() {
|
|
438
447
|
logger.info(`Received ${signal} - shutting down`);
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import logger from './logger';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
processCapabilities,
|
|
5
|
+
PROTOCOLS,
|
|
6
|
+
STANDARD_CAPS,
|
|
7
|
+
errors,
|
|
8
|
+
} from '@appium/base-driver';
|
|
4
9
|
import {inspect as dump} from 'util';
|
|
5
10
|
import {node, fs} from '@appium/support';
|
|
6
11
|
import path from 'path';
|
|
@@ -12,7 +17,8 @@ const STANDARD_CAPS_LOWERCASE = new Set([...STANDARD_CAPS].map((cap) => cap.toLo
|
|
|
12
17
|
export const V4_BROADCAST_IP = '0.0.0.0';
|
|
13
18
|
export const V6_BROADCAST_IP = '::';
|
|
14
19
|
export const npmPackage = fs.readPackageJsonFrom(__dirname);
|
|
15
|
-
|
|
20
|
+
const ALL_DRIVERS_MATCH = '*';
|
|
21
|
+
const FEATURE_NAME_SEPARATOR = ':';
|
|
16
22
|
|
|
17
23
|
/**
|
|
18
24
|
*
|
|
@@ -457,6 +463,37 @@ export function isBroadcastIp(address) {
|
|
|
457
463
|
return [V4_BROADCAST_IP, V6_BROADCAST_IP, `[${V6_BROADCAST_IP}]`].includes(address);
|
|
458
464
|
}
|
|
459
465
|
|
|
466
|
+
/**
|
|
467
|
+
* Validates the list of allowed/denied server features
|
|
468
|
+
*
|
|
469
|
+
* @param {string[]} features
|
|
470
|
+
* @returns {string[]}
|
|
471
|
+
*/
|
|
472
|
+
export function validateFeatures(features) {
|
|
473
|
+
const validator = (/** @type {string} */ fullName) => {
|
|
474
|
+
const separatorPos = fullName.indexOf(FEATURE_NAME_SEPARATOR);
|
|
475
|
+
// TODO: This is for the backward compatibility with Appium2
|
|
476
|
+
// TODO: In Appium3 the separator will be mandatory
|
|
477
|
+
if (separatorPos < 0) {
|
|
478
|
+
return `${ALL_DRIVERS_MATCH}${FEATURE_NAME_SEPARATOR}${fullName}`;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const [automationName, featureName] = [
|
|
482
|
+
fullName.substring(0, separatorPos),
|
|
483
|
+
fullName.substring(separatorPos + 1)
|
|
484
|
+
];
|
|
485
|
+
if (!automationName || !featureName) {
|
|
486
|
+
throw new Error(
|
|
487
|
+
`The full feature name must include both the destination automation name or the ` +
|
|
488
|
+
`'${ALL_DRIVERS_MATCH}' wildcard to apply the feature to all installed drivers, and ` +
|
|
489
|
+
`the feature name split by a colon, got '${fullName}' instead`
|
|
490
|
+
);
|
|
491
|
+
}
|
|
492
|
+
return fullName;
|
|
493
|
+
};
|
|
494
|
+
return features.map(validator);
|
|
495
|
+
}
|
|
496
|
+
|
|
460
497
|
/**
|
|
461
498
|
* @typedef {import('@appium/types').StringRecord} StringRecord
|
|
462
499
|
* @typedef {import('@appium/types').BaseDriverCapConstraints} BaseDriverCapConstraints
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"description": "Automation for Apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@appium/base-driver": "^9.
|
|
64
|
-
"@appium/base-plugin": "^2.2.
|
|
65
|
-
"@appium/docutils": "^1.0.
|
|
63
|
+
"@appium/base-driver": "^9.13.0",
|
|
64
|
+
"@appium/base-plugin": "^2.2.49",
|
|
65
|
+
"@appium/docutils": "^1.0.25",
|
|
66
66
|
"@appium/logger": "^1.6.1",
|
|
67
67
|
"@appium/schema": "^0.7.0",
|
|
68
|
-
"@appium/support": "^5.1.
|
|
69
|
-
"@appium/types": "^0.22.
|
|
68
|
+
"@appium/support": "^5.1.8",
|
|
69
|
+
"@appium/types": "^0.22.2",
|
|
70
70
|
"@sidvind/better-ajv-errors": "3.0.1",
|
|
71
71
|
"@types/argparse": "2.0.17",
|
|
72
72
|
"@types/bluebird": "3.5.42",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"argparse": "2.0.1",
|
|
79
79
|
"async-lock": "1.4.1",
|
|
80
80
|
"asyncbox": "3.0.0",
|
|
81
|
-
"axios": "1.7.
|
|
81
|
+
"axios": "1.7.8",
|
|
82
82
|
"bluebird": "3.7.2",
|
|
83
83
|
"cross-env": "7.0.3",
|
|
84
84
|
"lilconfig": "3.1.2",
|
|
@@ -90,11 +90,11 @@
|
|
|
90
90
|
"semver": "7.6.3",
|
|
91
91
|
"source-map-support": "0.5.21",
|
|
92
92
|
"teen_process": "2.2.0",
|
|
93
|
-
"type-fest": "4.
|
|
94
|
-
"winston": "3.
|
|
93
|
+
"type-fest": "4.29.1",
|
|
94
|
+
"winston": "3.17.0",
|
|
95
95
|
"wrap-ansi": "7.0.0",
|
|
96
96
|
"ws": "8.18.0",
|
|
97
|
-
"yaml": "2.6.
|
|
97
|
+
"yaml": "2.6.1"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"publishConfig": {
|
|
104
104
|
"access": "public"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "8daf5e123ac14c8325acf504fb33eb28e1a3dd78"
|
|
107
107
|
}
|
package/types/cli.ts
CHANGED
|
@@ -20,7 +20,7 @@ export type CliCommand = CliCommandServer | CliExtensionCommand | CliCommandSetu
|
|
|
20
20
|
* Possible subcommands of {@linkcode CliCommandSetup}.
|
|
21
21
|
* The command name will be preset name to get drivers/plugins to be installed.
|
|
22
22
|
*/
|
|
23
|
-
export type CliCommandSetupSubcommand = 'mobile' | 'browser' | 'desktop';
|
|
23
|
+
export type CliCommandSetupSubcommand = 'mobile' | 'browser' | 'desktop' | 'reset';
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Possible subcommands of {@linkcode CliCommandDriver} or
|