appium 2.0.0-beta.9 → 2.0.0-rc.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 +1 -1
- package/README.md +149 -58
- package/build/lib/appium.d.ts +229 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +677 -449
- package/build/lib/appium.js.map +1 -0
- package/build/lib/cli/args.d.ts +17 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +263 -300
- package/build/lib/cli/args.js.map +1 -0
- package/build/lib/cli/driver-command.d.ts +102 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +131 -81
- package/build/lib/cli/driver-command.js.map +1 -0
- package/build/lib/cli/extension-command.d.ts +402 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +799 -383
- package/build/lib/cli/extension-command.js.map +1 -0
- package/build/lib/cli/extension.d.ts +23 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +70 -68
- package/build/lib/cli/extension.js.map +1 -0
- package/build/lib/cli/parser.d.ts +84 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +252 -148
- package/build/lib/cli/parser.js.map +1 -0
- package/build/lib/cli/plugin-command.d.ts +99 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +125 -81
- package/build/lib/cli/plugin-command.js.map +1 -0
- package/build/lib/cli/utils.d.ts +29 -0
- package/build/lib/cli/utils.d.ts.map +1 -0
- package/build/lib/cli/utils.js +72 -51
- package/build/lib/cli/utils.js.map +1 -0
- package/build/lib/config-file.d.ts +100 -0
- package/build/lib/config-file.d.ts.map +1 -0
- package/build/lib/config-file.js +207 -0
- package/build/lib/config-file.js.map +1 -0
- package/build/lib/config.d.ts +49 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +262 -223
- package/build/lib/config.js.map +1 -0
- package/build/lib/constants.d.ts +56 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +73 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/extension/driver-config.d.ts +82 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +210 -0
- package/build/lib/extension/driver-config.js.map +1 -0
- package/build/lib/extension/extension-config.d.ts +270 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +601 -0
- package/build/lib/extension/extension-config.js.map +1 -0
- package/build/lib/extension/index.d.ts +48 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +105 -0
- package/build/lib/extension/index.js.map +1 -0
- 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 +134 -0
- package/build/lib/extension/manifest-migrations.js.map +1 -0
- package/build/lib/extension/manifest.d.ts +145 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +528 -0
- package/build/lib/extension/manifest.js.map +1 -0
- package/build/lib/extension/package-changed.d.ts +11 -0
- package/build/lib/extension/package-changed.d.ts.map +1 -0
- package/build/lib/extension/package-changed.js +62 -0
- package/build/lib/extension/package-changed.js.map +1 -0
- package/build/lib/extension/plugin-config.d.ts +56 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +102 -0
- package/build/lib/extension/plugin-config.js.map +1 -0
- package/build/lib/grid-register.d.ts +10 -0
- package/build/lib/grid-register.d.ts.map +1 -0
- package/build/lib/grid-register.js +122 -144
- package/build/lib/grid-register.js.map +1 -0
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +5 -17
- package/build/lib/logger.js.map +1 -0
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +189 -184
- package/build/lib/logsink.js.map +1 -0
- package/build/lib/main.d.ts +62 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +406 -234
- package/build/lib/main.js.map +1 -0
- package/build/lib/schema/arg-spec.d.ts +143 -0
- package/build/lib/schema/arg-spec.d.ts.map +1 -0
- package/build/lib/schema/arg-spec.js +164 -0
- package/build/lib/schema/arg-spec.js.map +1 -0
- package/build/lib/schema/cli-args.d.ts +19 -0
- package/build/lib/schema/cli-args.d.ts.map +1 -0
- package/build/lib/schema/cli-args.js +220 -0
- package/build/lib/schema/cli-args.js.map +1 -0
- package/build/lib/schema/cli-transformers.d.ts +5 -0
- package/build/lib/schema/cli-transformers.d.ts.map +1 -0
- package/build/lib/schema/cli-transformers.js +124 -0
- package/build/lib/schema/cli-transformers.js.map +1 -0
- package/build/lib/schema/index.d.ts +3 -0
- package/build/lib/schema/index.d.ts.map +1 -0
- package/build/lib/schema/index.js +19 -0
- package/build/lib/schema/index.js.map +1 -0
- package/build/lib/schema/keywords.d.ts +24 -0
- package/build/lib/schema/keywords.d.ts.map +1 -0
- package/build/lib/schema/keywords.js +128 -0
- package/build/lib/schema/keywords.js.map +1 -0
- package/build/lib/schema/schema.d.ts +260 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +640 -0
- package/build/lib/schema/schema.js.map +1 -0
- package/build/lib/utils.d.ts +276 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +372 -192
- package/build/lib/utils.js.map +1 -0
- package/build/types/cli.d.ts +134 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/cli.js +3 -0
- package/build/types/cli.js.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- 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 +21 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +42 -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/build/types/manifest/v4.d.ts +139 -0
- package/build/types/manifest/v4.d.ts.map +1 -0
- package/build/types/manifest/v4.js +3 -0
- package/build/types/manifest/v4.js.map +1 -0
- package/driver.d.ts +1 -0
- package/driver.js +14 -0
- package/index.js +11 -0
- package/lib/appium.js +545 -188
- package/lib/cli/args.js +275 -407
- package/lib/cli/driver-command.js +132 -24
- package/lib/cli/extension-command.js +751 -272
- package/lib/cli/extension.js +38 -19
- package/lib/cli/parser.js +267 -95
- package/lib/cli/plugin-command.js +122 -22
- package/lib/cli/utils.js +24 -10
- package/lib/config-file.js +220 -0
- package/lib/config.js +243 -132
- package/lib/constants.js +79 -0
- package/lib/extension/driver-config.js +247 -0
- package/lib/extension/extension-config.js +709 -0
- package/lib/extension/index.js +116 -0
- package/lib/extension/manifest-migrations.js +136 -0
- package/lib/extension/manifest.js +580 -0
- package/lib/extension/package-changed.js +64 -0
- package/lib/extension/plugin-config.js +112 -0
- package/lib/grid-register.js +49 -35
- package/lib/logger.js +1 -2
- package/lib/logsink.js +59 -36
- package/lib/main.js +392 -104
- package/lib/schema/arg-spec.js +229 -0
- package/lib/schema/cli-args.js +241 -0
- package/lib/schema/cli-transformers.js +119 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +136 -0
- package/lib/schema/schema.js +725 -0
- package/lib/utils.js +310 -89
- package/package.json +84 -84
- package/plugin.d.ts +1 -0
- package/plugin.js +13 -0
- package/scripts/autoinstall-extensions.js +243 -0
- package/support.d.ts +1 -0
- package/support.js +13 -0
- package/tsconfig.json +25 -0
- package/types/cli.ts +193 -0
- package/types/index.ts +20 -0
- package/types/manifest/README.md +30 -0
- package/types/manifest/base.ts +158 -0
- package/types/manifest/index.ts +28 -0
- package/types/manifest/v3.ts +161 -0
- package/types/manifest/v4.ts +161 -0
- package/CHANGELOG.md +0 -3669
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/argparse-actions.js +0 -104
- package/build/lib/cli/npm.js +0 -207
- package/build/lib/cli/parser-helpers.js +0 -93
- package/build/lib/driver-config.js +0 -77
- package/build/lib/drivers.js +0 -99
- package/build/lib/extension-config.js +0 -253
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -16
- package/build/postinstall.js +0 -90
- package/lib/cli/argparse-actions.js +0 -77
- package/lib/cli/npm.js +0 -183
- package/lib/cli/parser-helpers.js +0 -91
- package/lib/driver-config.js +0 -46
- package/lib/drivers.js +0 -84
- package/lib/extension-config.js +0 -209
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -11
- package/postinstall.js +0 -71
|
@@ -1,45 +1,153 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import ExtensionCliCommand from './extension-command';
|
|
3
|
+
import {KNOWN_DRIVERS} from '../constants';
|
|
4
|
+
import '@colors/colors';
|
|
5
5
|
|
|
6
6
|
const REQ_DRIVER_FIELDS = ['driverName', 'automationName', 'platformNames', 'mainClass'];
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @extends {ExtensionCliCommand<DriverType>}
|
|
10
|
+
*/
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
export default class DriverCliCommand extends ExtensionCliCommand {
|
|
13
|
+
/**
|
|
14
|
+
* @param {import('./extension-command').ExtensionCommandOptions<DriverType>} opts
|
|
15
|
+
*/
|
|
16
|
+
constructor({config, json}) {
|
|
17
|
+
super({config, json});
|
|
12
18
|
this.knownExtensions = KNOWN_DRIVERS;
|
|
13
19
|
}
|
|
14
20
|
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Install a driver
|
|
23
|
+
*
|
|
24
|
+
* @param {DriverInstallOpts} opts
|
|
25
|
+
* @return {Promise<ExtRecord<DriverType>>}
|
|
26
|
+
*/
|
|
27
|
+
async install({driver, installType, packageName}) {
|
|
28
|
+
return await super._install({
|
|
29
|
+
installSpec: driver,
|
|
30
|
+
installType,
|
|
31
|
+
packageName,
|
|
32
|
+
});
|
|
17
33
|
}
|
|
18
34
|
|
|
19
|
-
|
|
20
|
-
|
|
35
|
+
/**
|
|
36
|
+
* Uninstall a driver
|
|
37
|
+
*
|
|
38
|
+
* @param {DriverUninstallOpts} opts
|
|
39
|
+
* @return {Promise<ExtRecord<DriverType>>}
|
|
40
|
+
*/
|
|
41
|
+
async uninstall({driver}) {
|
|
42
|
+
return await super._uninstall({installSpec: driver});
|
|
21
43
|
}
|
|
22
44
|
|
|
23
|
-
|
|
24
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Update a driver
|
|
47
|
+
*
|
|
48
|
+
* @param {DriverUpdateOpts} opts
|
|
49
|
+
* @return {Promise<import('./extension-command').ExtensionUpdateResult>}
|
|
50
|
+
*/
|
|
51
|
+
async update({driver, unsafe}) {
|
|
52
|
+
return await super._update({installSpec: driver, unsafe});
|
|
25
53
|
}
|
|
26
54
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {DriverRunOptions} opts
|
|
58
|
+
* @return {Promise<import('./extension-command').RunOutput>}
|
|
59
|
+
*/
|
|
60
|
+
async run({driver, scriptName, extraArgs}) {
|
|
61
|
+
return await super._run({
|
|
62
|
+
installSpec: driver,
|
|
63
|
+
scriptName,
|
|
64
|
+
extraArgs,
|
|
65
|
+
bufferOutput: this.isJsonOutput,
|
|
66
|
+
});
|
|
31
67
|
}
|
|
32
68
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param {import('./extension-command').ExtensionArgs} opts
|
|
72
|
+
* @returns {string}
|
|
73
|
+
*/
|
|
74
|
+
getPostInstallText({extName, extData}) {
|
|
75
|
+
return (
|
|
76
|
+
`Driver ${extName}@${extData.version} successfully installed\n`.green +
|
|
77
|
+
`- automationName: ${extData.automationName.green}\n` +
|
|
78
|
+
`- platformNames: ${JSON.stringify(extData.platformNames).green}`
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Validates fields in `appium` field of `driverMetadata`
|
|
84
|
+
*
|
|
85
|
+
* For any `package.json` fields which a driver requires, validate the type of
|
|
86
|
+
* those fields on the `package.json` data, throwing an error if anything is
|
|
87
|
+
* amiss.
|
|
88
|
+
* @param {import('appium/types').ExtMetadata<DriverType>} driverMetadata
|
|
89
|
+
* @param {string} installSpec
|
|
90
|
+
*/
|
|
91
|
+
validateExtensionFields(driverMetadata, installSpec) {
|
|
92
|
+
const missingFields = REQ_DRIVER_FIELDS.reduce(
|
|
93
|
+
(acc, field) => (driverMetadata[field] ? acc : [...acc, field]),
|
|
94
|
+
[]
|
|
95
|
+
);
|
|
37
96
|
|
|
38
97
|
if (!_.isEmpty(missingFields)) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
|
|
98
|
+
throw new Error(
|
|
99
|
+
`Driver "${installSpec}" did not expose correct fields for compability ` +
|
|
100
|
+
`with Appium. Missing fields: ${JSON.stringify(missingFields)}`
|
|
101
|
+
);
|
|
41
102
|
}
|
|
42
|
-
|
|
43
103
|
}
|
|
44
|
-
|
|
45
104
|
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @typedef {import('@appium/types').ExtensionType} ExtensionType
|
|
108
|
+
* @typedef {import('@appium/types').DriverType} DriverType
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @template {ExtensionType} ExtType
|
|
113
|
+
* @typedef {import('appium/types').ExtRecord<ExtType>} ExtRecord
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @typedef DriverCommandOptions
|
|
118
|
+
* @property {import('../extension/extension-config').ExtensionConfig<DriverType>} config
|
|
119
|
+
* @property {boolean} json
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Options for {@linkcode DriverCliCommand.install}
|
|
124
|
+
* @typedef DriverInstallOpts
|
|
125
|
+
* @property {string} driver - the name or spec of a driver to install
|
|
126
|
+
* @property {InstallType} installType - how to install this driver. One of the INSTALL_TYPES
|
|
127
|
+
* @property {string} [packageName] - for git/github installs, the driver node package name
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @typedef {import('appium/types').InstallType} InstallType
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Options for {@linkcode DriverCliCommand.uninstall}
|
|
136
|
+
* @typedef DriverUninstallOpts
|
|
137
|
+
* @property {string} driver - the name or spec of a driver to uninstall
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Options for {@linkcode DriverCliCommand.update}
|
|
142
|
+
* @typedef DriverUpdateOpts
|
|
143
|
+
* @property {string} driver - the name of the driver to update
|
|
144
|
+
* @property {boolean} unsafe - if true, will perform unsafe updates past major revision boundaries
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Options for {@linkcode DriverCliCommand.run}.
|
|
149
|
+
* @typedef DriverRunOptions
|
|
150
|
+
* @property {string} driver - name of the driver to run a script from
|
|
151
|
+
* @property {string} scriptName - name of the script to run
|
|
152
|
+
* @property {string[]} [extraArgs] - arguments to pass to the script
|
|
153
|
+
*/
|