appium 3.2.0 → 3.2.2
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/LICENSE +201 -0
- package/README.md +4 -4
- package/build/lib/appium.d.ts +2 -2
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +5 -7
- package/build/lib/appium.js.map +1 -1
- package/build/lib/bidi-commands.d.ts +1 -1
- package/build/lib/bidi-commands.d.ts.map +1 -1
- package/build/lib/bidi-commands.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +4 -7
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/parser.d.ts +10 -0
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +18 -0
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/inspector-commands.d.ts.map +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +9 -7
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +2 -0
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/cli-args.js +5 -0
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/types/cli.d.ts +3 -3
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/manifest/base.d.ts +3 -3
- package/build/types/manifest/base.d.ts.map +1 -1
- package/build/types/manifest/v3.d.ts +3 -3
- package/build/types/manifest/v3.d.ts.map +1 -1
- package/build/types/manifest/v4.d.ts +3 -3
- package/build/types/manifest/v4.d.ts.map +1 -1
- package/lib/appium.js +5 -7
- package/lib/bidi-commands.ts +2 -4
- package/lib/cli/extension-command.js +9 -7
- package/lib/cli/parser.js +20 -1
- package/lib/inspector-commands.ts +1 -1
- package/lib/logsink.js +11 -7
- package/lib/main.js +3 -1
- package/lib/schema/cli-args.js +6 -0
- package/package.json +20 -21
- package/tsconfig.json +5 -2
- package/types/cli.ts +3 -3
- package/types/index.ts +1 -1
- package/types/manifest/base.ts +3 -3
- package/types/manifest/v3.ts +3 -3
- package/types/manifest/v4.ts +3 -3
package/lib/appium.js
CHANGED
|
@@ -560,16 +560,14 @@ class AppiumDriver extends DriverCore {
|
|
|
560
560
|
/**
|
|
561
561
|
* Get the appropriate plugins for a session (or sessionless plugins)
|
|
562
562
|
*
|
|
563
|
-
* @param {
|
|
563
|
+
* @param {string|null} [sessionId=null] - the sessionId (or null) to use to find plugins
|
|
564
564
|
* @returns {Array<import('@appium/types').Plugin>} - array of plugin instances
|
|
565
565
|
*/
|
|
566
566
|
pluginsForSession(sessionId = null) {
|
|
567
567
|
if (sessionId) {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}
|
|
572
|
-
return this.sessionPlugins[sessionId];
|
|
568
|
+
const driver = this.sessions[sessionId];
|
|
569
|
+
return this.sessionPlugins[sessionId]
|
|
570
|
+
?? (driver ? this.createPluginInstances(generateDriverLogPrefix(driver)) : []);
|
|
573
571
|
}
|
|
574
572
|
|
|
575
573
|
if (_.isEmpty(this.sessionlessPlugins)) {
|
|
@@ -598,7 +596,7 @@ class AppiumDriver extends DriverCore {
|
|
|
598
596
|
|
|
599
597
|
/**
|
|
600
598
|
* Creates instances of all of the enabled Plugin classes
|
|
601
|
-
* @param {string|null} driverId - ID to use for linking a driver to a plugin in logs
|
|
599
|
+
* @param {string|null} [driverId=null] - ID to use for linking a driver to a plugin in logs
|
|
602
600
|
* @returns {Plugin[]}
|
|
603
601
|
*/
|
|
604
602
|
createPluginInstances(driverId = null) {
|
package/lib/bidi-commands.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import B from 'bluebird';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
ExtensionCore,
|
|
6
|
-
} from '@appium/base-driver';
|
|
3
|
+
import type {ExtensionCore} from '@appium/base-driver';
|
|
4
|
+
import {errors} from '@appium/base-driver';
|
|
7
5
|
import {BIDI_BASE_PATH, BIDI_EVENT_NAME} from './constants';
|
|
8
6
|
import WebSocket from 'ws';
|
|
9
7
|
import os from 'node:os';
|
|
@@ -601,20 +601,22 @@ class ExtensionCliCommand {
|
|
|
601
601
|
* @returns {Promise<ExtInstallReceipt<ExtType>>}
|
|
602
602
|
*/
|
|
603
603
|
async installViaNpm({installSpec, pkgName, pkgVer, installType}) {
|
|
604
|
-
const
|
|
604
|
+
const installMsg = `Installing '${installSpec}'`;
|
|
605
|
+
const validateMsg = `Validating '${installSpec}'`;
|
|
605
606
|
|
|
606
607
|
// the string used for installation is either <name>@<ver> in the case of a standard NPM
|
|
607
608
|
// package, or whatever the user sent in otherwise.
|
|
608
609
|
const installStr = installType === INSTALL_TYPE_NPM ? `${pkgName}${pkgVer ? `@${pkgVer}` : ''}` : installSpec;
|
|
609
610
|
const appiumHome = this.config.appiumHome;
|
|
610
611
|
try {
|
|
611
|
-
const {pkg, installPath} = await spinWith(
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
612
|
+
const {pkg, installPath} = await spinWith(
|
|
613
|
+
this.isJsonOutput,
|
|
614
|
+
installMsg,
|
|
615
|
+
async () => await npm.installPackage(appiumHome, installStr, {pkgName, installType})
|
|
616
|
+
);
|
|
617
|
+
|
|
618
|
+
await spinWith(this.isJsonOutput, validateMsg, async () => {
|
|
616
619
|
this.validatePackageJson(pkg, installSpec);
|
|
617
|
-
return {pkg, installPath};
|
|
618
620
|
});
|
|
619
621
|
|
|
620
622
|
return this.getInstallationReceipt({
|
package/lib/cli/parser.js
CHANGED
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
SERVER_SUBCOMMAND,
|
|
15
15
|
SETUP_SUBCOMMAND
|
|
16
16
|
} from '../constants';
|
|
17
|
-
import {finalizeSchema, getArgSpec, hasArgSpec} from '../schema';
|
|
17
|
+
import {finalizeSchema, getAllArgSpecs, getArgSpec, hasArgSpec} from '../schema';
|
|
18
18
|
import {rootDir} from '../config';
|
|
19
19
|
import {getExtensionArgs, getServerArgs} from './args';
|
|
20
20
|
import {
|
|
@@ -158,6 +158,25 @@ class ArgParser {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
/**
|
|
162
|
+
* Normalize hyphenated server arg keys (e.g. "log-level") to dest form (e.g. "loglevel").
|
|
163
|
+
* Use when server args come from programmatic init rather than the CLI, so they match
|
|
164
|
+
* the shape produced by parseArgs() / _transformParsedArgs().
|
|
165
|
+
* Mutates the given object.
|
|
166
|
+
*
|
|
167
|
+
* @param {object} obj - Object that may contain server args with schema property names
|
|
168
|
+
* @returns {object} The same object with keys normalized
|
|
169
|
+
*/
|
|
170
|
+
static normalizeServerArgs(obj) {
|
|
171
|
+
for (const spec of getAllArgSpecs().values()) {
|
|
172
|
+
if (!spec.extType && obj[spec.name] !== undefined && spec.rawDest !== spec.name) {
|
|
173
|
+
obj[spec.rawDest] = obj[spec.name] ?? obj[spec.rawDest];
|
|
174
|
+
delete obj[spec.name];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return obj;
|
|
178
|
+
}
|
|
179
|
+
|
|
161
180
|
/**
|
|
162
181
|
* Given an object full of arguments as returned by `argparser.parse_args`,
|
|
163
182
|
* expand the ones for extensions into a nested object structure and rename
|
|
@@ -19,7 +19,7 @@ import type {
|
|
|
19
19
|
BiDiCommandNamesToInfosMap,
|
|
20
20
|
ExecuteMethodMap,
|
|
21
21
|
} from '@appium/types';
|
|
22
|
-
import type {
|
|
22
|
+
import type {AppiumDriver} from './appium';
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
export async function listCommands(this: AppiumDriver, sessionId?: string): Promise<ListCommandsResponse> {
|
package/lib/logsink.js
CHANGED
|
@@ -5,10 +5,6 @@ import _ from 'lodash';
|
|
|
5
5
|
import { adler32 } from './utils';
|
|
6
6
|
import { LRUCache } from 'lru-cache';
|
|
7
7
|
|
|
8
|
-
// set up distributed logging before everything else
|
|
9
|
-
global._global_npmlog = globalLog;
|
|
10
|
-
// npmlog is used only for emitting, we use winston for output
|
|
11
|
-
globalLog.level = 'info';
|
|
12
8
|
const LEVELS_MAP = {
|
|
13
9
|
debug: 4,
|
|
14
10
|
info: 3,
|
|
@@ -42,6 +38,7 @@ const COLORS_CACHE = new LRUCache({
|
|
|
42
38
|
updateAgeOnGet: true,
|
|
43
39
|
});
|
|
44
40
|
|
|
41
|
+
// npmlog is used only for emitting, we use winston for output (global is set by support)
|
|
45
42
|
/** @type {import('winston').Logger?} */
|
|
46
43
|
let log = null;
|
|
47
44
|
|
|
@@ -102,6 +99,8 @@ export async function init(args) {
|
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
});
|
|
102
|
+
// Only Winston produces output; avoid duplicate lines from the logger's default stream
|
|
103
|
+
globalLog.stream = null;
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
/**
|
|
@@ -211,12 +210,17 @@ async function createTransports(args) {
|
|
|
211
210
|
let consoleLogLevel;
|
|
212
211
|
/** @type {string} */
|
|
213
212
|
let fileLogLevel;
|
|
214
|
-
|
|
213
|
+
|
|
214
|
+
// Server args are normalized in main so we only see dest form (`loglevel`).
|
|
215
|
+
// Fall back to schema default so Winston never sees undefined.
|
|
216
|
+
const rawLogLevel = args.loglevel ?? 'debug';
|
|
217
|
+
|
|
218
|
+
if (rawLogLevel && rawLogLevel.includes(':')) {
|
|
215
219
|
// --log-level arg can optionally provide diff logging levels for console and file, separated by a colon
|
|
216
|
-
const lvlPair =
|
|
220
|
+
const lvlPair = rawLogLevel.split(':');
|
|
217
221
|
[consoleLogLevel, fileLogLevel] = lvlPair;
|
|
218
222
|
} else {
|
|
219
|
-
consoleLogLevel = fileLogLevel =
|
|
223
|
+
consoleLogLevel = fileLogLevel = rawLogLevel;
|
|
220
224
|
}
|
|
221
225
|
|
|
222
226
|
transports.push(createConsoleTransport(args, consoleLogLevel));
|
package/lib/main.js
CHANGED
|
@@ -13,7 +13,7 @@ import _ from 'lodash';
|
|
|
13
13
|
import {AppiumDriver} from './appium';
|
|
14
14
|
import {runExtensionCommand} from './cli/extension';
|
|
15
15
|
import { runSetupCommand } from './cli/setup-command';
|
|
16
|
-
import {getParser} from './cli/parser';
|
|
16
|
+
import {getParser, ArgParser} from './cli/parser';
|
|
17
17
|
import {
|
|
18
18
|
APPIUM_VER,
|
|
19
19
|
checkNodeOk,
|
|
@@ -211,6 +211,8 @@ async function init(args) {
|
|
|
211
211
|
delete args.throwInsteadOfExit;
|
|
212
212
|
}
|
|
213
213
|
preConfigArgs = {...args, subcommand: args.subcommand ?? SERVER_SUBCOMMAND};
|
|
214
|
+
// Normalize hyphenated keys to dest form so programmatic args match CLI shape
|
|
215
|
+
ArgParser.normalizeServerArgs(preConfigArgs);
|
|
214
216
|
} else {
|
|
215
217
|
// otherwise parse from CLI
|
|
216
218
|
preConfigArgs = /** @type {Args<Cmd, SubCmd>} */ (parser.parseArgs());
|
package/lib/schema/cli-args.js
CHANGED
|
@@ -112,6 +112,12 @@ function subSchemaToArgDef(subSchema, argSpec) {
|
|
|
112
112
|
help: makeDescription(subSchema),
|
|
113
113
|
};
|
|
114
114
|
|
|
115
|
+
// argparse infers dest from the option string (e.g. --log-level → log_level).
|
|
116
|
+
// We need schema dest (e.g. loglevel) so merged server args and logsink use the right key.
|
|
117
|
+
if (!argSpec.extType) {
|
|
118
|
+
argOpts.dest = argSpec.rawDest;
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
/**
|
|
116
122
|
* Generally we will provide a `type` to `argparse` as a function which
|
|
117
123
|
* validates using ajv (which is much more full-featured than what `argparse`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "Automation for Apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -32,16 +32,15 @@
|
|
|
32
32
|
},
|
|
33
33
|
"files": [
|
|
34
34
|
"lib",
|
|
35
|
-
"build",
|
|
35
|
+
"build/lib",
|
|
36
|
+
"build/types",
|
|
36
37
|
"index.js",
|
|
37
38
|
"driver.*",
|
|
38
39
|
"support.*",
|
|
39
40
|
"plugin.*",
|
|
40
41
|
"scripts/autoinstall-extensions.js",
|
|
41
42
|
"types",
|
|
42
|
-
"tsconfig.json"
|
|
43
|
-
"!build/tsconfig.tsbuildinfo",
|
|
44
|
-
"!build/test"
|
|
43
|
+
"tsconfig.json"
|
|
45
44
|
],
|
|
46
45
|
"scripts": {
|
|
47
46
|
"build:docs": "node docs/scripts/build-docs.js",
|
|
@@ -56,34 +55,34 @@
|
|
|
56
55
|
"postinstall": "node ./scripts/autoinstall-extensions.js",
|
|
57
56
|
"publish:docs": "cross-env APPIUM_DOCS_PUBLISH=1 npm run build:docs",
|
|
58
57
|
"test": "npm run test:unit",
|
|
59
|
-
"test:e2e": "mocha --exit --timeout 1m --slow 30s \"./test/e2e/**/*.spec.
|
|
58
|
+
"test:e2e": "mocha --exit --timeout 1m --slow 30s \"./test/e2e/**/*.spec.ts\"",
|
|
60
59
|
"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
|
-
"test:unit": "mocha \"./test/unit/**/*.spec.
|
|
60
|
+
"test:unit": "mocha \"./test/unit/**/*.spec.ts\""
|
|
62
61
|
},
|
|
63
62
|
"dependencies": {
|
|
64
|
-
"@appium/base-driver": "^10.2.
|
|
65
|
-
"@appium/base-plugin": "^3.
|
|
66
|
-
"@appium/docutils": "^2.2.
|
|
67
|
-
"@appium/logger": "^2.0.
|
|
68
|
-
"@appium/schema": "^1.0
|
|
69
|
-
"@appium/support": "^7.0.
|
|
70
|
-
"@appium/types": "^1.2.
|
|
63
|
+
"@appium/base-driver": "^10.2.2",
|
|
64
|
+
"@appium/base-plugin": "^3.1.1",
|
|
65
|
+
"@appium/docutils": "^2.2.2",
|
|
66
|
+
"@appium/logger": "^2.0.5",
|
|
67
|
+
"@appium/schema": "^1.1.0",
|
|
68
|
+
"@appium/support": "^7.0.6",
|
|
69
|
+
"@appium/types": "^1.2.1",
|
|
71
70
|
"@sidvind/better-ajv-errors": "4.0.1",
|
|
72
|
-
"ajv": "8.
|
|
71
|
+
"ajv": "8.18.0",
|
|
73
72
|
"ajv-formats": "3.0.1",
|
|
74
73
|
"argparse": "2.0.1",
|
|
75
74
|
"async-lock": "1.4.1",
|
|
76
|
-
"axios": "1.13.
|
|
75
|
+
"axios": "1.13.6",
|
|
77
76
|
"bluebird": "3.7.2",
|
|
78
77
|
"lilconfig": "3.1.3",
|
|
79
78
|
"lodash": "4.17.23",
|
|
80
|
-
"lru-cache": "11.2.
|
|
79
|
+
"lru-cache": "11.2.6",
|
|
81
80
|
"ora": "5.4.1",
|
|
82
81
|
"package-changed": "3.0.0",
|
|
83
82
|
"resolve-from": "5.0.0",
|
|
84
|
-
"semver": "7.7.
|
|
85
|
-
"teen_process": "4.0.
|
|
86
|
-
"type-fest": "5.4.
|
|
83
|
+
"semver": "7.7.4",
|
|
84
|
+
"teen_process": "4.0.10",
|
|
85
|
+
"type-fest": "5.4.4",
|
|
87
86
|
"winston": "3.19.0",
|
|
88
87
|
"ws": "8.19.0",
|
|
89
88
|
"yaml": "2.8.2"
|
|
@@ -95,5 +94,5 @@
|
|
|
95
94
|
"publishConfig": {
|
|
96
95
|
"access": "public"
|
|
97
96
|
},
|
|
98
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "c745352c6500937a4590d1ef6ef19785143a8870"
|
|
99
98
|
}
|
package/tsconfig.json
CHANGED
|
@@ -7,19 +7,22 @@
|
|
|
7
7
|
"@appium/support": ["../support"],
|
|
8
8
|
"@appium/base-driver": ["../base-driver"],
|
|
9
9
|
"@appium/base-plugin": ["../base-plugin"],
|
|
10
|
+
"@appium/fake-driver": ["../fake-driver"],
|
|
10
11
|
"@appium/types": ["../types"],
|
|
11
12
|
"@appium/schema": ["../schema"],
|
|
12
13
|
"appium": ["."]
|
|
13
14
|
},
|
|
14
|
-
"checkJs": true
|
|
15
|
+
"checkJs": true,
|
|
16
|
+
"types": ["mocha", "chai", "chai-as-promised", "node"]
|
|
15
17
|
},
|
|
16
|
-
"include": ["lib", "types"],
|
|
18
|
+
"include": ["lib", "types", "test"],
|
|
17
19
|
"references": [
|
|
18
20
|
{"path": "../schema"},
|
|
19
21
|
{"path": "../types"},
|
|
20
22
|
{"path": "../support"},
|
|
21
23
|
{"path": "../base-driver"},
|
|
22
24
|
{"path": "../base-plugin"},
|
|
25
|
+
{"path": "../fake-driver"},
|
|
23
26
|
{"path": "../test-support"}
|
|
24
27
|
]
|
|
25
28
|
}
|
package/types/cli.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {DriverType, PluginType, ServerArgs} from '@appium/types';
|
|
2
|
-
import {SetOptional} from 'type-fest';
|
|
3
|
-
import {InstallType} from './manifest';
|
|
1
|
+
import type {DriverType, PluginType, ServerArgs} from '@appium/types';
|
|
2
|
+
import type {SetOptional} from 'type-fest';
|
|
3
|
+
import type {InstallType} from './manifest';
|
|
4
4
|
export type CliCommandServer = 'server';
|
|
5
5
|
export type CliCommandSetup = 'setup';
|
|
6
6
|
export type CliCommandDriver = DriverType;
|
package/types/index.ts
CHANGED
package/types/manifest/base.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {DriverType, ExtensionType, PluginType} from '@appium/types';
|
|
2
|
-
import {SchemaObject} from 'ajv';
|
|
3
|
-
import {PackageJson, SetRequired} from 'type-fest';
|
|
1
|
+
import type {DriverType, ExtensionType, PluginType} from '@appium/types';
|
|
2
|
+
import type {SchemaObject} from 'ajv';
|
|
3
|
+
import type {PackageJson, SetRequired} from 'type-fest';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* One of the possible extension installation stratgies
|
package/types/manifest/v3.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {DriverType, ExtensionType, PluginType} from '@appium/types';
|
|
2
|
-
import {SchemaObject} from 'ajv';
|
|
3
|
-
import {PackageJson, SetRequired} from 'type-fest';
|
|
1
|
+
import type {DriverType, ExtensionType, PluginType} from '@appium/types';
|
|
2
|
+
import type {SchemaObject} from 'ajv';
|
|
3
|
+
import type {PackageJson, SetRequired} from 'type-fest';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* One of the possible extension installation stratgies
|
package/types/manifest/v4.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {DriverType, ExtensionType, PluginType} from '@appium/types';
|
|
2
|
-
import {SchemaObject} from 'ajv';
|
|
3
|
-
import {PackageJson, SetRequired} from 'type-fest';
|
|
1
|
+
import type {DriverType, ExtensionType, PluginType} from '@appium/types';
|
|
2
|
+
import type {SchemaObject} from 'ajv';
|
|
3
|
+
import type {PackageJson, SetRequired} from 'type-fest';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* One of the possible extension installation stratgies
|