appium 2.0.0-beta.30 → 2.0.0-beta.35
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 +5 -2
- package/build/lib/cli/args.js +1 -1
- package/build/lib/cli/driver-command.d.ts +3 -3
- package/build/lib/cli/driver-command.d.ts.map +1 -1
- package/build/lib/cli/driver-command.js +8 -8
- package/build/lib/cli/extension-command.d.ts +22 -17
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +35 -36
- package/build/lib/cli/extension.js +1 -1
- package/build/lib/cli/parser.d.ts +3 -2
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +1 -1
- package/build/lib/cli/plugin-command.d.ts +9 -15
- package/build/lib/cli/plugin-command.d.ts.map +1 -1
- package/build/lib/cli/plugin-command.js +8 -8
- package/build/lib/cli/utils.js +1 -1
- package/build/lib/config-file.js +1 -1
- package/build/lib/config.d.ts +5 -4
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +1 -1
- package/build/lib/constants.js +1 -1
- package/build/lib/extension/driver-config.js +1 -1
- package/build/lib/extension/extension-config.js +1 -1
- package/build/lib/extension/index.js +1 -1
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +1 -1
- package/build/lib/extension/package-changed.js +1 -1
- package/build/lib/extension/plugin-config.js +1 -1
- package/build/lib/grid-register.js +1 -1
- package/build/lib/logger.js +1 -1
- package/build/lib/logsink.js +1 -1
- package/build/lib/main.d.ts +13 -10
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +57 -50
- package/build/lib/schema/arg-spec.js +1 -1
- package/build/lib/schema/cli-args.js +1 -1
- package/build/lib/schema/cli-transformers.js +1 -1
- package/build/lib/schema/index.js +1 -1
- package/build/lib/schema/keywords.js +1 -1
- package/build/lib/schema/schema.js +1 -1
- package/build/lib/utils.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/appium-manifest.d.ts +40 -0
- package/build/types/appium-manifest.d.ts.map +1 -0
- package/build/types/cli.d.ts +112 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/extension.d.ts +43 -0
- package/build/types/extension.d.ts.map +1 -0
- package/build/types/external-manifest.d.ts +47 -0
- package/build/types/external-manifest.d.ts.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- package/lib/appium.js +7 -3
- package/lib/cli/driver-command.js +45 -20
- package/lib/cli/extension-command.js +229 -123
- package/lib/cli/parser.js +2 -1
- package/lib/cli/plugin-command.js +33 -18
- package/lib/config.js +6 -5
- package/lib/extension/manifest.js +0 -2
- package/lib/main.js +78 -63
- package/package.json +20 -14
- package/types/{appium-manifest.d.ts → appium-manifest.ts} +1 -1
- package/types/{cli.d.ts → cli.ts} +48 -29
- package/types/{extension.d.ts → extension.ts} +4 -4
- package/types/{external-manifest.d.ts → external-manifest.ts} +2 -2
- package/types/{index.d.ts → index.ts} +7 -0
- package/lib/appium-config.schema.json +0 -278
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import ExtensionCommand from './extension-command';
|
|
3
|
-
import {
|
|
3
|
+
import {KNOWN_PLUGINS} from '../constants';
|
|
4
4
|
|
|
5
5
|
const REQ_PLUGIN_FIELDS = ['pluginName', 'mainClass'];
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* @extends {ExtensionCommand<PluginType>}
|
|
9
|
+
*/
|
|
7
10
|
export default class PluginCommand extends ExtensionCommand {
|
|
8
|
-
|
|
9
11
|
/**
|
|
10
12
|
*
|
|
11
|
-
* @param {
|
|
13
|
+
* @param {import('./extension-command').ExtensionCommandOptions<PluginType>} opts
|
|
12
14
|
*/
|
|
13
15
|
constructor ({config, json}) {
|
|
14
16
|
super({config, json});
|
|
@@ -16,41 +18,54 @@ export default class PluginCommand extends ExtensionCommand {
|
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
async install ({plugin, installType, packageName}) {
|
|
19
|
-
return await super._install({
|
|
21
|
+
return await super._install({
|
|
22
|
+
installSpec: plugin,
|
|
23
|
+
installType,
|
|
24
|
+
packageName,
|
|
25
|
+
});
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
async uninstall ({plugin}) {
|
|
23
|
-
return await super._uninstall({
|
|
29
|
+
return await super._uninstall({installSpec: plugin});
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
async update ({plugin, unsafe}) {
|
|
27
|
-
return await super._update({
|
|
33
|
+
return await super._update({installSpec: plugin, unsafe});
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
async run ({plugin, scriptName}) {
|
|
31
|
-
return await super._run({
|
|
37
|
+
return await super._run({installSpec: plugin, scriptName});
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
getPostInstallText ({extName, extData}) {
|
|
35
41
|
return `Plugin ${extName}@${extData.version} successfully installed`.green;
|
|
36
42
|
}
|
|
37
43
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Validates fields in `appium` field of `driverMetadata`
|
|
46
|
+
*
|
|
47
|
+
* For any `package.json` fields which a driver requires, validate the type of
|
|
48
|
+
* those fields on the `package.json` data, throwing an error if anything is
|
|
49
|
+
* amiss.
|
|
50
|
+
* @param {import('appium/types').ExtMetadata<PluginType>} pluginMetadata
|
|
51
|
+
* @param {string} installSpec
|
|
52
|
+
* @returns {void}
|
|
53
|
+
*/
|
|
54
|
+
validateExtensionFields (pluginMetadata, installSpec) {
|
|
55
|
+
const missingFields = REQ_PLUGIN_FIELDS.reduce(
|
|
56
|
+
(acc, field) => (pluginMetadata[field] ? acc : [...acc, field]),
|
|
57
|
+
[]
|
|
58
|
+
);
|
|
42
59
|
|
|
43
60
|
if (!_.isEmpty(missingFields)) {
|
|
44
|
-
throw new Error(
|
|
45
|
-
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Installed plugin "${installSpec}" did not expose correct fields for compability ` +
|
|
63
|
+
`with Appium. Missing fields: ${JSON.stringify(missingFields)}`
|
|
64
|
+
);
|
|
46
65
|
}
|
|
47
|
-
|
|
48
66
|
}
|
|
49
|
-
|
|
50
67
|
}
|
|
51
68
|
|
|
52
69
|
/**
|
|
53
|
-
* @typedef
|
|
54
|
-
* @property {import('../extension/extension-config').ExtensionConfig<import('../extension/manifest').PluginType>} config
|
|
55
|
-
* @property {boolean} json
|
|
70
|
+
* @typedef {import('appium/types').PluginType} PluginType
|
|
56
71
|
*/
|
package/lib/config.js
CHANGED
|
@@ -160,14 +160,14 @@ async function showBuildInfo () {
|
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Returns k/v pairs of server arguments which are _not_ the defaults.
|
|
163
|
-
* @param {
|
|
164
|
-
* @returns {
|
|
163
|
+
* @param {Args} parsedArgs
|
|
164
|
+
* @returns {Args}
|
|
165
165
|
*/
|
|
166
166
|
function getNonDefaultServerArgs (parsedArgs) {
|
|
167
167
|
/**
|
|
168
168
|
* Flattens parsed args into a single level object for comparison with
|
|
169
169
|
* flattened defaults across server args and extension args.
|
|
170
|
-
* @param {
|
|
170
|
+
* @param {Args} args
|
|
171
171
|
* @returns {Record<string, { value: any, argSpec: ArgSpec }>}
|
|
172
172
|
*/
|
|
173
173
|
const flatten = (args) => {
|
|
@@ -237,7 +237,7 @@ function getNonDefaultServerArgs (parsedArgs) {
|
|
|
237
237
|
return _.reduce(
|
|
238
238
|
_.pickBy(args, (__, key) => isNotDefault(key)),
|
|
239
239
|
// explodes the flattened object back into nested one
|
|
240
|
-
(acc, {value, argSpec}) => _.set(acc, argSpec.dest, value), /** @type {
|
|
240
|
+
(acc, {value, argSpec}) => _.set(acc, argSpec.dest, value), /** @type {Args} */({})
|
|
241
241
|
);
|
|
242
242
|
}
|
|
243
243
|
|
|
@@ -306,7 +306,8 @@ export {
|
|
|
306
306
|
};
|
|
307
307
|
|
|
308
308
|
/**
|
|
309
|
-
* @typedef {import('../types
|
|
309
|
+
* @typedef {import('../types').ParsedArgs} ParsedArgs
|
|
310
|
+
* @typedef {import('../types').Args} Args
|
|
310
311
|
* @typedef {import('./schema/arg-spec').ArgSpec} ArgSpec
|
|
311
312
|
*/
|
|
312
313
|
|
package/lib/main.js
CHANGED
|
@@ -54,13 +54,16 @@ async function preflightChecks (args, throwInsteadOfExit = false) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
* @param {
|
|
57
|
+
* @param {Args} args
|
|
58
58
|
*/
|
|
59
59
|
function logNonDefaultArgsWarning (args) {
|
|
60
60
|
logger.info('Non-default server args:');
|
|
61
61
|
inspect(args);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @param {Args['defaultCapabilities']} caps
|
|
66
|
+
*/
|
|
64
67
|
function logDefaultCapabilitiesWarning (caps) {
|
|
65
68
|
logger.info('Default capabilities, which will be added to each request ' +
|
|
66
69
|
'unless overridden by desired capabilities:');
|
|
@@ -122,11 +125,20 @@ function getServerUpdaters (driverClasses, pluginClasses) {
|
|
|
122
125
|
*/
|
|
123
126
|
function getExtraMethodMap (driverClasses, pluginClasses) {
|
|
124
127
|
return [...driverClasses, ...pluginClasses].reduce(
|
|
125
|
-
(map, klass) => ({...map,
|
|
128
|
+
(map, klass) => ({...map, .../** @type {DriverClass} */(klass).newMethodMap ?? {}}),
|
|
126
129
|
{}
|
|
127
130
|
);
|
|
128
131
|
}
|
|
129
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @template [T=WithServerSubcommand]
|
|
135
|
+
* @param {Args<T>} args
|
|
136
|
+
* @returns {args is Args<WithServerSubcommand>}
|
|
137
|
+
*/
|
|
138
|
+
function areServerCommandArgs (args) {
|
|
139
|
+
return args.subcommand === SERVER_SUBCOMMAND;
|
|
140
|
+
}
|
|
141
|
+
|
|
130
142
|
/**
|
|
131
143
|
* Initializes Appium, but does not start the server.
|
|
132
144
|
*
|
|
@@ -134,7 +146,8 @@ function getExtraMethodMap (driverClasses, pluginClasses) {
|
|
|
134
146
|
*
|
|
135
147
|
* If `args` contains a non-empty `subcommand` which is not `server`, this function will return an empty object.
|
|
136
148
|
*
|
|
137
|
-
* @
|
|
149
|
+
* @template [T=WithServerSubcommand]
|
|
150
|
+
* @param {Args<T>} [args] - Partial args (progammatic usage only)
|
|
138
151
|
* @returns {Promise<ServerInitResult | ExtCommandInitResult>}
|
|
139
152
|
* @example
|
|
140
153
|
* import {init, getSchema} from 'appium';
|
|
@@ -149,16 +162,9 @@ async function init (args) {
|
|
|
149
162
|
|
|
150
163
|
const parser = getParser();
|
|
151
164
|
let throwInsteadOfExit = false;
|
|
152
|
-
/** @type {
|
|
153
|
-
let
|
|
154
|
-
|
|
155
|
-
let parsedArgs;
|
|
156
|
-
/**
|
|
157
|
-
* This is a definition (instead of declaration) because TS can't figure out
|
|
158
|
-
* the value will be defined when it's used.
|
|
159
|
-
* @type {ReturnType<getDefaultsForSchema>}
|
|
160
|
-
*/
|
|
161
|
-
let defaults = {};
|
|
165
|
+
/** @type {Args<T>} */
|
|
166
|
+
let preConfigArgs;
|
|
167
|
+
|
|
162
168
|
if (args) {
|
|
163
169
|
// if we have a containing package instead of running as a CLI process,
|
|
164
170
|
// that package might not appreciate us calling 'process.exit' willy-
|
|
@@ -168,13 +174,13 @@ async function init (args) {
|
|
|
168
174
|
// but remove it since it's not a real server arg per se
|
|
169
175
|
delete args.throwInsteadOfExit;
|
|
170
176
|
}
|
|
171
|
-
|
|
177
|
+
preConfigArgs = {...args, subcommand: args.subcommand ?? SERVER_SUBCOMMAND};
|
|
172
178
|
} else {
|
|
173
179
|
// otherwise parse from CLI
|
|
174
|
-
|
|
180
|
+
preConfigArgs = /** @type {Args<T>} */(parser.parseArgs());
|
|
175
181
|
}
|
|
176
182
|
|
|
177
|
-
const configResult = await readConfigFile(
|
|
183
|
+
const configResult = await readConfigFile(preConfigArgs.configFile);
|
|
178
184
|
|
|
179
185
|
if (!_.isEmpty(configResult.errors)) {
|
|
180
186
|
throw new Error(`Errors in config file ${configResult.filepath}:\n ${configResult.reason ?? configResult.errors}`);
|
|
@@ -185,63 +191,65 @@ async function init (args) {
|
|
|
185
191
|
// 1. command line args
|
|
186
192
|
// 2. config file
|
|
187
193
|
// 3. defaults from config file.
|
|
188
|
-
if (
|
|
189
|
-
defaults = getDefaultsForSchema(false);
|
|
194
|
+
if (!areServerCommandArgs(preConfigArgs)) {
|
|
190
195
|
|
|
191
|
-
|
|
192
|
-
|
|
196
|
+
// if the user has requested the 'driver' CLI, don't run the normal server,
|
|
197
|
+
// but instead pass control to the driver CLI
|
|
198
|
+
if (preConfigArgs.subcommand === DRIVER_TYPE) {
|
|
199
|
+
await runExtensionCommand(preConfigArgs, driverConfig);
|
|
200
|
+
return {};
|
|
201
|
+
}
|
|
202
|
+
if (preConfigArgs.subcommand === PLUGIN_TYPE) {
|
|
203
|
+
await runExtensionCommand(preConfigArgs, pluginConfig);
|
|
204
|
+
return {};
|
|
205
|
+
}
|
|
206
|
+
/* istanbul ignore next */
|
|
207
|
+
return {}; // should never happen
|
|
208
|
+
} else {
|
|
209
|
+
const defaults = getDefaultsForSchema(false);
|
|
210
|
+
|
|
211
|
+
/** @type {ParsedArgs} */
|
|
212
|
+
const serverArgs = _.defaultsDeep(
|
|
213
|
+
preConfigArgs,
|
|
193
214
|
configResult.config?.server,
|
|
194
215
|
defaults
|
|
195
216
|
);
|
|
196
217
|
|
|
197
|
-
if (
|
|
198
|
-
showConfig(getNonDefaultServerArgs(
|
|
218
|
+
if (preConfigArgs.showConfig) {
|
|
219
|
+
showConfig(getNonDefaultServerArgs(preConfigArgs), configResult, defaults, serverArgs);
|
|
199
220
|
return {};
|
|
200
221
|
}
|
|
201
222
|
|
|
202
|
-
|
|
203
|
-
parsedArgs = preConfigParsedArgs;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
await logsinkInit(parsedArgs);
|
|
207
|
-
|
|
208
|
-
// if the user has requested the 'driver' CLI, don't run the normal server,
|
|
209
|
-
// but instead pass control to the driver CLI
|
|
210
|
-
if (parsedArgs.subcommand === DRIVER_TYPE) {
|
|
211
|
-
await runExtensionCommand(parsedArgs, driverConfig);
|
|
212
|
-
return {};
|
|
213
|
-
}
|
|
214
|
-
if (parsedArgs.subcommand === PLUGIN_TYPE) {
|
|
215
|
-
await runExtensionCommand(parsedArgs, pluginConfig);
|
|
216
|
-
return {};
|
|
217
|
-
}
|
|
223
|
+
await logsinkInit(serverArgs);
|
|
218
224
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
225
|
+
if (serverArgs.logFilters) {
|
|
226
|
+
const {issues, rules} = await logFactory.loadSecureValuesPreprocessingRules(serverArgs.logFilters);
|
|
227
|
+
if (!_.isEmpty(issues)) {
|
|
228
|
+
throw new Error(`The log filtering rules config '${serverArgs.logFilters}' has issues: ` +
|
|
223
229
|
JSON.stringify(issues, null, 2));
|
|
230
|
+
}
|
|
231
|
+
if (_.isEmpty(rules)) {
|
|
232
|
+
logger.warn(`Found no log filtering rules in '${serverArgs.logFilters}'. Is that expected?`);
|
|
233
|
+
} else {
|
|
234
|
+
logger.info(`Loaded ${util.pluralize('filtering rule', rules.length, true)} from '${serverArgs.logFilters}'`);
|
|
235
|
+
}
|
|
224
236
|
}
|
|
225
|
-
if (_.isEmpty(rules)) {
|
|
226
|
-
logger.warn(`Found no log filtering rules in '${parsedArgs.logFilters}'. Is that expected?`);
|
|
227
|
-
} else {
|
|
228
|
-
logger.info(`Loaded ${util.pluralize('filtering rule', rules.length, true)} from '${parsedArgs.logFilters}'`);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
237
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
238
|
+
const appiumDriver = new AppiumDriver(serverArgs);
|
|
239
|
+
// set the config on the umbrella driver so it can match drivers to caps
|
|
240
|
+
appiumDriver.driverConfig = driverConfig;
|
|
241
|
+
await preflightChecks(serverArgs, throwInsteadOfExit);
|
|
236
242
|
|
|
237
|
-
|
|
243
|
+
return /** @type {ServerInitResult} */({appiumDriver, parsedArgs: serverArgs, driverConfig, pluginConfig});
|
|
244
|
+
}
|
|
238
245
|
}
|
|
239
246
|
|
|
240
247
|
/**
|
|
241
248
|
* Initializes Appium's config. Starts server if appropriate and resolves the
|
|
242
249
|
* server instance if so; otherwise resolves w/ `undefined`.
|
|
243
|
-
* @
|
|
244
|
-
* @
|
|
250
|
+
* @template [T=WithServerSubcommand]
|
|
251
|
+
* @param {Args<T>} [args] - Arguments from CLI or otherwise
|
|
252
|
+
* @returns {Promise<import('@appium/types').AppiumServer|undefined>}
|
|
245
253
|
*/
|
|
246
254
|
async function main (args) {
|
|
247
255
|
const {appiumDriver, parsedArgs, pluginConfig, driverConfig} = /** @type {ServerInitResult} */(await init(args));
|
|
@@ -339,15 +347,11 @@ export { finalizeSchema, getSchema, validate } from './schema/schema';
|
|
|
339
347
|
export { main, init, resolveAppiumHome };
|
|
340
348
|
|
|
341
349
|
/**
|
|
342
|
-
* @typedef {import('../types/cli').ParsedArgs} ParsedArgs
|
|
343
|
-
*/
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* @typedef {import('../types/cli').PartialArgs} PartialArgs
|
|
347
350
|
* @typedef {import('../types').DriverType} DriverType
|
|
348
351
|
* @typedef {import('../types').PluginType} PluginType
|
|
349
|
-
* @typedef {import('../types
|
|
350
|
-
* @typedef {import('../types
|
|
352
|
+
* @typedef {import('../types').DriverClass} DriverClass
|
|
353
|
+
* @typedef {import('../types').PluginClass} PluginClass
|
|
354
|
+
* @typedef {import('../types').WithServerSubcommand} WithServerSubcommand
|
|
351
355
|
*/
|
|
352
356
|
|
|
353
357
|
/**
|
|
@@ -358,9 +362,20 @@ export { main, init, resolveAppiumHome };
|
|
|
358
362
|
/**
|
|
359
363
|
* @typedef ServerInitData
|
|
360
364
|
* @property {AppiumDriver} appiumDriver - The Appium driver
|
|
361
|
-
* @property {ParsedArgs} parsedArgs - The parsed arguments
|
|
365
|
+
* @property {import('../types').ParsedArgs} parsedArgs - The parsed arguments
|
|
362
366
|
*/
|
|
363
367
|
|
|
364
368
|
/**
|
|
365
369
|
* @typedef {ServerInitData & import('./extension').ExtensionConfigs} ServerInitResult
|
|
366
370
|
*/
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* @template [T=WithServerSubcommand]
|
|
374
|
+
* @typedef {import('../types').Args<T>} Args
|
|
375
|
+
*/
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @template [T=WithServerSubcommand]
|
|
379
|
+
* @typedef {import('../types').ParsedArgs<T>} ParsedArgs
|
|
380
|
+
*/
|
|
381
|
+
|
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.35",
|
|
4
4
|
"description": "Automation for Apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -40,18 +40,24 @@
|
|
|
40
40
|
"build": "babel lib --root-mode=upward --out-dir=build/lib",
|
|
41
41
|
"dev": "npm run build -- --watch",
|
|
42
42
|
"fix": "npm run lint -- --fix",
|
|
43
|
-
"
|
|
43
|
+
"build:docs": "node docs/scripts/build-docs.js",
|
|
44
|
+
"build:docs:assets": "node docs/scripts/copy-assets.js",
|
|
45
|
+
"dev:docs": "npm run build:docs:assets && npm run dev:docs:en",
|
|
46
|
+
"dev:docs:en": "mkdocs serve -f ./docs/mkdocs-en.yml",
|
|
47
|
+
"dev:docs:ja": "mkdocs serve -f ./docs/mkdocs-ja.yml",
|
|
48
|
+
"publish:docs": "APPIUM_DOCS_PUBLISH=1 npm run build:docs",
|
|
44
49
|
"postinstall": "node ./scripts/postinstall.js",
|
|
45
50
|
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
46
51
|
"test": "npm run test:unit",
|
|
47
|
-
"test:e2e": "mocha --
|
|
48
|
-
"test:unit": "mocha
|
|
52
|
+
"test:e2e": "mocha --timeout 30s --slow 15s \"./test/e2e/**/*.spec.js\"",
|
|
53
|
+
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
49
54
|
},
|
|
50
55
|
"dependencies": {
|
|
51
|
-
"@appium/base-driver": "^8.
|
|
52
|
-
"@appium/base-plugin": "1.8.
|
|
53
|
-
"@appium/
|
|
54
|
-
"@appium/
|
|
56
|
+
"@appium/base-driver": "^8.5.3",
|
|
57
|
+
"@appium/base-plugin": "^1.8.5",
|
|
58
|
+
"@appium/docutils": "^0.0.4",
|
|
59
|
+
"@appium/schema": "^0.0.5",
|
|
60
|
+
"@appium/support": "^2.58.0",
|
|
55
61
|
"@babel/runtime": "7.17.9",
|
|
56
62
|
"@sidvind/better-ajv-errors": "1.1.1",
|
|
57
63
|
"ajv": "8.11.0",
|
|
@@ -59,22 +65,22 @@
|
|
|
59
65
|
"argparse": "2.0.1",
|
|
60
66
|
"async-lock": "1.3.1",
|
|
61
67
|
"asyncbox": "2.9.2",
|
|
62
|
-
"axios": "0.
|
|
68
|
+
"axios": "0.27.2",
|
|
63
69
|
"bluebird": "3.7.2",
|
|
64
70
|
"find-up": "5.0.0",
|
|
65
71
|
"lilconfig": "2.0.5",
|
|
66
72
|
"lodash": "4.17.21",
|
|
67
73
|
"longjohn": "0.2.12",
|
|
68
|
-
"npmlog": "6.0.
|
|
74
|
+
"npmlog": "6.0.2",
|
|
69
75
|
"ora": "5.4.1",
|
|
70
76
|
"package-changed": "1.9.0",
|
|
71
77
|
"resolve-from": "5.0.0",
|
|
72
|
-
"semver": "7.3.
|
|
78
|
+
"semver": "7.3.7",
|
|
73
79
|
"source-map-support": "0.5.21",
|
|
74
80
|
"teen_process": "1.16.0",
|
|
75
81
|
"winston": "3.7.2",
|
|
76
82
|
"word-wrap": "1.2.3",
|
|
77
|
-
"yaml": "
|
|
83
|
+
"yaml": "2.0.1"
|
|
78
84
|
},
|
|
79
85
|
"engines": {
|
|
80
86
|
"node": ">=12",
|
|
@@ -84,6 +90,6 @@
|
|
|
84
90
|
"access": "public",
|
|
85
91
|
"tag": "next"
|
|
86
92
|
},
|
|
87
|
-
"types": "./build/lib/
|
|
88
|
-
"gitHead": "
|
|
93
|
+
"types": "./build/lib/main.d.ts",
|
|
94
|
+
"gitHead": "59dd30ba20d04a068d7b710671f273bc3a2298b7"
|
|
89
95
|
}
|
|
@@ -28,7 +28,7 @@ export type ExtManifest<ExtType extends ExtensionType> = Omit<
|
|
|
28
28
|
InternalMetadata &
|
|
29
29
|
CommonMetadata; // XXX: ExtMetadata should be a union with CommonMetadata. why is this needed?
|
|
30
30
|
|
|
31
|
-
type WithSchemaManifest = {
|
|
31
|
+
export type WithSchemaManifest = {
|
|
32
32
|
schema: SchemaMetadata;
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {ServerArgs} from '@appium/types';
|
|
2
|
+
import type {
|
|
3
3
|
DRIVER_TYPE as DRIVER_SUBCOMMAND,
|
|
4
4
|
EXT_SUBCOMMAND_INSTALL,
|
|
5
5
|
EXT_SUBCOMMAND_LIST,
|
|
@@ -10,17 +10,21 @@ import {
|
|
|
10
10
|
SERVER_SUBCOMMAND,
|
|
11
11
|
} from '../lib/constants';
|
|
12
12
|
|
|
13
|
+
export type ServerSubcommand = typeof SERVER_SUBCOMMAND;
|
|
14
|
+
export type DriverSubcommand = typeof DRIVER_SUBCOMMAND;
|
|
15
|
+
export type PluginSubcommand = typeof PLUGIN_SUBCOMMAND;
|
|
16
|
+
|
|
13
17
|
/**
|
|
14
18
|
* Possible subcommands for the `appium` CLI.
|
|
15
19
|
*/
|
|
16
|
-
type CliSubcommand =
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
+
export type CliSubcommand =
|
|
21
|
+
| ServerSubcommand
|
|
22
|
+
| DriverSubcommand
|
|
23
|
+
| PluginSubcommand;
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
|
-
* Possible subcommands of {@
|
|
23
|
-
* {@
|
|
26
|
+
* Possible subcommands of {@linkcode DriverSubcommand} or
|
|
27
|
+
* {@linkcode PluginSubcommand}.
|
|
24
28
|
*/
|
|
25
29
|
export type CliExtensionSubcommand =
|
|
26
30
|
| typeof EXT_SUBCOMMAND_INSTALL
|
|
@@ -33,7 +37,12 @@ export type CliExtensionSubcommand =
|
|
|
33
37
|
* Random stuff that may appear in the parsed args which has no equivalent in a
|
|
34
38
|
* config file.
|
|
35
39
|
*/
|
|
36
|
-
interface MoreArgs {
|
|
40
|
+
export interface MoreArgs {
|
|
41
|
+
/**
|
|
42
|
+
* Possible subcommands. If empty, defaults to {@linkcode ServerSubcommand}.
|
|
43
|
+
*/
|
|
44
|
+
subcommand?: CliSubcommand;
|
|
45
|
+
|
|
37
46
|
/**
|
|
38
47
|
* Path to config file, if any. Does not make sense for this to be allowed in a config file!
|
|
39
48
|
*/
|
|
@@ -53,7 +62,7 @@ interface MoreArgs {
|
|
|
53
62
|
/**
|
|
54
63
|
* These arguments are _not_ supported by the CLI, but only via programmatic usage / tests.
|
|
55
64
|
*/
|
|
56
|
-
interface ProgrammaticArgs {
|
|
65
|
+
export interface ProgrammaticArgs {
|
|
57
66
|
/**
|
|
58
67
|
* If `true`, throw on error instead of exit.
|
|
59
68
|
*/
|
|
@@ -85,9 +94,9 @@ interface ProgrammaticArgs {
|
|
|
85
94
|
}
|
|
86
95
|
|
|
87
96
|
/**
|
|
88
|
-
* These are args
|
|
97
|
+
* These are args which the user will specify if using an extension command
|
|
89
98
|
*/
|
|
90
|
-
interface
|
|
99
|
+
export interface ExtArgs extends WithExtSubcommand {
|
|
91
100
|
/**
|
|
92
101
|
* Subcommands of `driver` subcommand
|
|
93
102
|
*/
|
|
@@ -97,32 +106,42 @@ interface InternalArgs {
|
|
|
97
106
|
* Subcommands of `plugin` subcommand
|
|
98
107
|
*/
|
|
99
108
|
pluginCommand?: CliExtensionSubcommand;
|
|
109
|
+
}
|
|
100
110
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Args having the `server` subcommand
|
|
113
|
+
*/
|
|
114
|
+
export interface WithServerSubcommand {
|
|
115
|
+
subcommand?: ServerSubcommand;
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
/**
|
|
108
|
-
*
|
|
109
|
-
* This is _not_ the same as `Partial<ParsedArgs>`.
|
|
119
|
+
* Args having the `driver` or `plugin` subcommand
|
|
110
120
|
*/
|
|
111
|
-
export
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
Partial<InternalArgs>;
|
|
121
|
+
export interface WithExtSubcommand {
|
|
122
|
+
subcommand: DriverSubcommand | PluginSubcommand;
|
|
123
|
+
}
|
|
115
124
|
|
|
116
125
|
/**
|
|
117
|
-
*
|
|
118
|
-
* CLI args unsupported by the config file.
|
|
119
|
-
* @todo Does not make any assumptions about property names derived from
|
|
120
|
-
* extensions.
|
|
126
|
+
* Some generic bits of arguments; should not be used outside this declaration
|
|
121
127
|
*/
|
|
122
|
-
|
|
123
|
-
MoreArgs &
|
|
128
|
+
type CommonArgs<SArgs, T = WithServerSubcommand> = MoreArgs &
|
|
124
129
|
ProgrammaticArgs &
|
|
125
|
-
|
|
130
|
+
(T extends WithServerSubcommand
|
|
131
|
+
? SArgs
|
|
132
|
+
: T extends WithExtSubcommand
|
|
133
|
+
? ExtArgs
|
|
134
|
+
: never);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Fully-parsed arguments, containing defaults, computed args, and config file values.
|
|
138
|
+
*/
|
|
139
|
+
export type ParsedArgs<T = WithServerSubcommand> = CommonArgs<ServerArgs, T>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Partial arguments, as supplied by a user. _May_ have defaults applied; _may_ contain config values; _may_ contain computed args.
|
|
143
|
+
*/
|
|
144
|
+
export type Args<T = WithServerSubcommand> = CommonArgs<Partial<ServerArgs>, T>;
|
|
126
145
|
|
|
127
146
|
/**
|
|
128
147
|
* Shown by `appium --build-info`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseDriverBase } from '@appium/base-driver/lib/basedriver/driver';
|
|
1
|
+
import type { BaseDriverBase } from '@appium/base-driver/lib/basedriver/driver';
|
|
2
2
|
import { Class, Driver, ExternalDriver } from '@appium/types';
|
|
3
3
|
import { DriverType, ExtensionType, PluginType } from '.';
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ export type DriverClass = BaseDriverBase<ExternalDriver,
|
|
|
8
8
|
/**
|
|
9
9
|
* Additional static props for external driver classes
|
|
10
10
|
*/
|
|
11
|
-
interface ExternalDriverStatic {
|
|
11
|
+
export interface ExternalDriverStatic {
|
|
12
12
|
driverName: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ export type PluginClass = Class<PluginProto, ExternalPluginStatic>;
|
|
|
20
20
|
/**
|
|
21
21
|
* Static props for plugin classes
|
|
22
22
|
*/
|
|
23
|
-
interface ExternalPluginStatic {
|
|
23
|
+
export interface ExternalPluginStatic {
|
|
24
24
|
pluginName: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -28,7 +28,7 @@ interface ExternalPluginStatic {
|
|
|
28
28
|
* A plugin must have this shape.
|
|
29
29
|
* @todo Use base plugin instead of this
|
|
30
30
|
*/
|
|
31
|
-
interface PluginProto {
|
|
31
|
+
export interface PluginProto {
|
|
32
32
|
/**
|
|
33
33
|
* I'm not sure why `plugin.name` is required, but it is.
|
|
34
34
|
*/
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* These types describe information about external extensions and the contents of their `package.json` files
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { SchemaObject } from 'ajv';
|
|
6
|
-
import { PackageJson, SetRequired } from 'type-fest';
|
|
5
|
+
import type { SchemaObject } from 'ajv';
|
|
6
|
+
import type { PackageJson, SetRequired } from 'type-fest';
|
|
7
7
|
import { DriverType, ExtensionType, PluginType } from './index';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -5,3 +5,10 @@ export * from './cli';
|
|
|
5
5
|
export type DriverType = 'driver';
|
|
6
6
|
export type PluginType = 'plugin';
|
|
7
7
|
export type ExtensionType = DriverType | PluginType;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Known environment variables concerning Appium
|
|
11
|
+
*/
|
|
12
|
+
export interface AppiumEnv extends NodeJS.ProcessEnv {
|
|
13
|
+
APPIUM_HOME?: string;
|
|
14
|
+
}
|