appium 3.3.0 → 3.3.1
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 +147 -205
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +169 -282
- package/build/lib/appium.js.map +1 -1
- package/build/lib/bidi-commands.d.ts.map +1 -1
- package/build/lib/bidi-commands.js +11 -11
- package/build/lib/bidi-commands.js.map +1 -1
- package/build/lib/bootstrap/appium-initializer.d.ts +21 -0
- package/build/lib/bootstrap/appium-initializer.d.ts.map +1 -0
- package/build/lib/bootstrap/appium-initializer.js +146 -0
- package/build/lib/bootstrap/appium-initializer.js.map +1 -0
- package/build/lib/bootstrap/appium-main-runner.d.ts +22 -0
- package/build/lib/bootstrap/appium-main-runner.d.ts.map +1 -0
- package/build/lib/bootstrap/appium-main-runner.js +109 -0
- package/build/lib/bootstrap/appium-main-runner.js.map +1 -0
- package/build/lib/bootstrap/config-file.d.ts +37 -0
- package/build/lib/bootstrap/config-file.d.ts.map +1 -0
- package/build/lib/{config-file.js → bootstrap/config-file.js} +9 -26
- package/build/lib/bootstrap/config-file.js.map +1 -0
- package/build/lib/bootstrap/grid-v3-register.d.ts +20 -0
- package/build/lib/bootstrap/grid-v3-register.d.ts.map +1 -0
- package/build/lib/{grid-register.js → bootstrap/grid-v3-register.js} +28 -13
- package/build/lib/bootstrap/grid-v3-register.js.map +1 -0
- package/build/lib/bootstrap/init-types.d.ts +16 -0
- package/build/lib/bootstrap/init-types.d.ts.map +1 -0
- package/build/lib/bootstrap/init-types.js +3 -0
- package/build/lib/bootstrap/init-types.js.map +1 -0
- package/build/lib/bootstrap/main-helpers.d.ts +55 -0
- package/build/lib/bootstrap/main-helpers.d.ts.map +1 -0
- package/build/lib/bootstrap/main-helpers.js +187 -0
- package/build/lib/bootstrap/main-helpers.js.map +1 -0
- package/build/lib/bootstrap/node-helpers.d.ts +32 -0
- package/build/lib/bootstrap/node-helpers.d.ts.map +1 -0
- package/build/lib/bootstrap/node-helpers.js +201 -0
- package/build/lib/bootstrap/node-helpers.js.map +1 -0
- package/build/lib/bootstrap/startup-config.d.ts +22 -0
- package/build/lib/bootstrap/startup-config.d.ts.map +1 -0
- package/build/lib/bootstrap/startup-config.js +111 -0
- package/build/lib/bootstrap/startup-config.js.map +1 -0
- package/build/lib/cli/args.d.ts.map +1 -1
- package/build/lib/cli/args.js +9 -9
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +95 -95
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +18 -18
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +1 -1
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +5 -5
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts +8 -8
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +49 -49
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/setup-command.js +6 -6
- package/build/lib/cli/setup-command.js.map +1 -1
- package/build/lib/cli/utils.d.ts +17 -17
- package/build/lib/cli/utils.d.ts.map +1 -1
- package/build/lib/cli/utils.js +29 -29
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/doctor/doctor.d.ts +2 -2
- package/build/lib/doctor/doctor.d.ts.map +1 -1
- package/build/lib/doctor/doctor.js +6 -6
- package/build/lib/doctor/doctor.js.map +1 -1
- package/build/lib/extension/driver-config.d.ts +18 -77
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +37 -125
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +103 -210
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +180 -342
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.d.ts +12 -29
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/index.js +33 -75
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts +3 -20
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
- package/build/lib/extension/manifest-migrations.js +20 -101
- package/build/lib/extension/manifest-migrations.js.map +1 -1
- package/build/lib/extension/manifest.d.ts +61 -107
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +181 -356
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/package-changed.d.ts +1 -3
- package/build/lib/extension/package-changed.d.ts.map +1 -1
- package/build/lib/extension/package-changed.js +8 -15
- package/build/lib/extension/package-changed.js.map +1 -1
- package/build/lib/extension/plugin-config.d.ts +10 -52
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +11 -63
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/helpers/build.d.ts +22 -0
- package/build/lib/helpers/build.d.ts.map +1 -0
- package/build/lib/helpers/build.js +109 -0
- package/build/lib/helpers/build.js.map +1 -0
- package/build/lib/helpers/capability.d.ts +38 -0
- package/build/lib/helpers/capability.d.ts.map +1 -0
- package/build/lib/helpers/capability.js +128 -0
- package/build/lib/helpers/capability.js.map +1 -0
- package/build/lib/helpers/network.d.ts +14 -0
- package/build/lib/helpers/network.d.ts.map +1 -0
- package/build/lib/helpers/network.js +35 -0
- package/build/lib/helpers/network.js.map +1 -0
- package/build/lib/insecure-features.js +6 -6
- package/build/lib/insecure-features.js.map +1 -1
- package/build/lib/inspector-commands.d.ts +6 -0
- package/build/lib/inspector-commands.d.ts.map +1 -1
- package/build/lib/inspector-commands.js +6 -0
- package/build/lib/inspector-commands.js.map +1 -1
- package/build/lib/logger.d.ts +2 -3
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +2 -3
- package/build/lib/logger.js.map +1 -1
- package/build/lib/main.d.ts +15 -58
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +25 -425
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/cli-args-guards.d.ts +34 -0
- package/build/lib/schema/cli-args-guards.d.ts.map +1 -0
- package/build/lib/schema/cli-args-guards.js +49 -0
- package/build/lib/schema/cli-args-guards.js.map +1 -0
- package/build/lib/schema/cli-args.js +2 -2
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/lib/schema/format-errors.d.ts +28 -0
- package/build/lib/schema/format-errors.d.ts.map +1 -0
- package/build/lib/schema/format-errors.js +29 -0
- package/build/lib/schema/format-errors.js.map +1 -0
- package/build/lib/schema/index.d.ts +2 -0
- package/build/lib/schema/index.d.ts.map +1 -1
- package/build/lib/schema/index.js +2 -0
- package/build/lib/schema/index.js.map +1 -1
- package/build/lib/schema/schema.d.ts +15 -15
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +37 -37
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +0 -81
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +1 -248
- package/build/lib/utils.js.map +1 -1
- package/lib/{appium.js → appium.ts} +297 -341
- package/lib/bidi-commands.ts +10 -14
- package/lib/bootstrap/appium-initializer.ts +212 -0
- package/lib/bootstrap/appium-main-runner.ts +172 -0
- package/lib/{config-file.ts → bootstrap/config-file.ts} +29 -63
- package/lib/{grid-register.ts → bootstrap/grid-v3-register.ts} +35 -35
- package/lib/bootstrap/init-types.ts +31 -0
- package/lib/bootstrap/main-helpers.ts +223 -0
- package/lib/bootstrap/node-helpers.ts +180 -0
- package/lib/bootstrap/startup-config.ts +143 -0
- package/lib/cli/args.ts +10 -10
- package/lib/cli/extension-command.ts +132 -132
- package/lib/cli/extension.ts +7 -7
- package/lib/cli/parser.ts +50 -50
- package/lib/cli/setup-command.ts +2 -2
- package/lib/cli/utils.ts +33 -33
- package/lib/doctor/doctor.ts +8 -8
- package/lib/extension/driver-config.ts +165 -0
- package/lib/extension/{extension-config.js → extension-config.ts} +291 -405
- package/lib/extension/index.ts +143 -0
- package/lib/extension/manifest-migrations.ts +57 -0
- package/lib/extension/manifest.ts +369 -0
- package/lib/extension/{package-changed.js → package-changed.ts} +9 -18
- package/lib/extension/plugin-config.ts +62 -0
- package/lib/helpers/build.ts +111 -0
- package/lib/helpers/capability.ts +171 -0
- package/lib/helpers/network.ts +30 -0
- package/lib/insecure-features.ts +1 -1
- package/lib/inspector-commands.ts +6 -1
- package/lib/{logger.js → logger.ts} +1 -2
- package/lib/main.ts +60 -0
- package/lib/schema/cli-args-guards.ts +67 -0
- package/lib/schema/cli-args.ts +1 -1
- package/lib/schema/format-errors.ts +43 -0
- package/lib/schema/index.ts +2 -0
- package/lib/schema/schema.ts +51 -52
- package/lib/utils.ts +0 -331
- package/package.json +12 -13
- package/scripts/autoinstall-extensions.js +3 -0
- package/build/lib/config-file.d.ts +0 -57
- package/build/lib/config-file.d.ts.map +0 -1
- package/build/lib/config-file.js.map +0 -1
- package/build/lib/config.d.ts +0 -68
- package/build/lib/config.d.ts.map +0 -1
- package/build/lib/config.js +0 -358
- package/build/lib/config.js.map +0 -1
- package/build/lib/grid-register.d.ts +0 -35
- package/build/lib/grid-register.d.ts.map +0 -1
- package/build/lib/grid-register.js.map +0 -1
- package/lib/config.ts +0 -377
- package/lib/extension/driver-config.js +0 -245
- package/lib/extension/index.js +0 -169
- package/lib/extension/manifest-migrations.js +0 -136
- package/lib/extension/manifest.js +0 -550
- package/lib/extension/plugin-config.js +0 -112
- package/lib/main.js +0 -545
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import type {DriverClass, DriverType, StringRecord} from '@appium/types';
|
|
3
|
+
import type {ExtManifest, ExtName, ExtRecord} from 'appium/types';
|
|
4
|
+
import {DRIVER_TYPE} from '../constants';
|
|
5
|
+
import {log} from '../logger';
|
|
6
|
+
import type {ExtManifestProblem} from './extension-config';
|
|
7
|
+
import {ExtensionConfig} from './extension-config';
|
|
8
|
+
import type {Manifest} from './manifest';
|
|
9
|
+
|
|
10
|
+
export type MatchedDriver = {
|
|
11
|
+
driver: DriverClass;
|
|
12
|
+
version: string;
|
|
13
|
+
driverName: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export class DriverConfig extends ExtensionConfig<DriverType> {
|
|
17
|
+
private static readonly _instances = new WeakMap<Manifest, DriverConfig>();
|
|
18
|
+
private knownAutomationNames = new Set<string>();
|
|
19
|
+
|
|
20
|
+
private constructor(manifest: Manifest) {
|
|
21
|
+
super(DRIVER_TYPE, manifest);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static create(manifest: Manifest): DriverConfig {
|
|
25
|
+
const instance = new DriverConfig(manifest);
|
|
26
|
+
if (DriverConfig.getInstance(manifest)) {
|
|
27
|
+
throw new Error(
|
|
28
|
+
`Manifest with APPIUM_HOME ${manifest.appiumHome} already has a DriverConfig; use DriverConfig.getInstance() to retrieve it.`
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
DriverConfig._instances.set(manifest, instance);
|
|
32
|
+
return instance;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static getInstance(manifest: Manifest): DriverConfig | undefined {
|
|
36
|
+
return DriverConfig._instances.get(manifest);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async validate(): Promise<ExtRecord<DriverType>> {
|
|
40
|
+
this.knownAutomationNames.clear();
|
|
41
|
+
return await super._validate(this.manifest.getExtensionData(DRIVER_TYPE));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public override extensionDesc(
|
|
45
|
+
driverName: ExtName<DriverType>,
|
|
46
|
+
{version, automationName}: ExtManifest<DriverType>
|
|
47
|
+
): string {
|
|
48
|
+
return `${String(driverName)}@${version} (automationName '${automationName}')`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async findMatchingDriver<C extends StringRecord>({
|
|
52
|
+
automationName,
|
|
53
|
+
platformName,
|
|
54
|
+
}: C): Promise<MatchedDriver> {
|
|
55
|
+
if (!_.isString(platformName)) {
|
|
56
|
+
throw new Error('You must include a platformName capability');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (!_.isString(automationName)) {
|
|
60
|
+
throw new Error('You must include an automationName capability');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
log.info(
|
|
64
|
+
`Attempting to find matching driver for automationName ` +
|
|
65
|
+
`'${automationName}' and platformName '${platformName}'`
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
const {driverName, mainClass, version} = this._getDriverBySupport(automationName, platformName);
|
|
70
|
+
log.info(`The '${driverName}' driver was installed and matched caps.`);
|
|
71
|
+
log.info(`Will require it at ${this.getInstallPath(driverName)}`);
|
|
72
|
+
const driver = await this.requireAsync(driverName as ExtName<DriverType>);
|
|
73
|
+
if (!driver) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
`Driver '${driverName}' did not export a class with name '${mainClass}'. Contact the author of the driver!`
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return {driver, version, driverName};
|
|
79
|
+
} catch (err: any) {
|
|
80
|
+
const msg =
|
|
81
|
+
`Could not find a driver for automationName ` +
|
|
82
|
+
`'${automationName}' and platformName '${platformName}'. ` +
|
|
83
|
+
`Have you installed a driver that supports those ` +
|
|
84
|
+
`capabilities? Run 'appium driver list --installed' to see. ` +
|
|
85
|
+
`(Lower-level error: ${err.message})`;
|
|
86
|
+
throw new Error(msg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected override getConfigProblems(
|
|
91
|
+
extManifest: ExtManifest<DriverType>,
|
|
92
|
+
extName: string
|
|
93
|
+
): ExtManifestProblem[] {
|
|
94
|
+
void extName;
|
|
95
|
+
const problems: ExtManifestProblem[] = [];
|
|
96
|
+
const {platformNames, automationName} = extManifest;
|
|
97
|
+
|
|
98
|
+
if (!_.isArray(platformNames)) {
|
|
99
|
+
problems.push({
|
|
100
|
+
err: 'Missing or incorrect supported platformNames list.',
|
|
101
|
+
val: platformNames,
|
|
102
|
+
});
|
|
103
|
+
} else if (_.isEmpty(platformNames)) {
|
|
104
|
+
problems.push({
|
|
105
|
+
err: 'Empty platformNames list.',
|
|
106
|
+
val: platformNames,
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
for (const pName of platformNames) {
|
|
110
|
+
if (!_.isString(pName)) {
|
|
111
|
+
problems.push({
|
|
112
|
+
err: 'Incorrectly formatted platformName.',
|
|
113
|
+
val: pName,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!_.isString(automationName)) {
|
|
120
|
+
problems.push({
|
|
121
|
+
err: 'Missing or incorrect automationName',
|
|
122
|
+
val: automationName,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (this.knownAutomationNames.has(automationName as string)) {
|
|
127
|
+
problems.push({
|
|
128
|
+
err: 'Multiple drivers claim support for the same automationName',
|
|
129
|
+
val: automationName,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.knownAutomationNames.add(automationName as string);
|
|
134
|
+
|
|
135
|
+
return problems;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private _getDriverBySupport(
|
|
139
|
+
matchAutomationName: string,
|
|
140
|
+
matchPlatformName: string
|
|
141
|
+
): ExtManifest<DriverType> & {driverName: string} {
|
|
142
|
+
const drivers = this.installedExtensions;
|
|
143
|
+
for (const [driverName, driverData] of _.toPairs(drivers)) {
|
|
144
|
+
const {automationName, platformNames} = driverData;
|
|
145
|
+
const aNameMatches = automationName.toLowerCase() === matchAutomationName.toLowerCase();
|
|
146
|
+
const pNameMatches = _.includes(platformNames.map((p) => _.toLower(p)), matchPlatformName.toLowerCase());
|
|
147
|
+
|
|
148
|
+
if (aNameMatches && pNameMatches) {
|
|
149
|
+
return {driverName, ...driverData};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (aNameMatches) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Driver '${driverName}' supports automationName ` +
|
|
155
|
+
`'${automationName}', but Appium could not find ` +
|
|
156
|
+
`support for platformName '${matchPlatformName}'. Supported ` +
|
|
157
|
+
`platformNames are: ` +
|
|
158
|
+
JSON.stringify(platformNames)
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
throw new Error(`Could not find installed driver to support given caps`);
|
|
164
|
+
}
|
|
165
|
+
}
|