appium 2.0.0-beta.35 → 2.0.0-beta.37
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 +41 -52
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +32 -15
- package/build/lib/cli/args.d.ts +1 -1
- package/build/lib/cli/args.d.ts.map +1 -1
- 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 +1 -1
- package/build/lib/cli/extension-command.d.ts +60 -38
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +115 -59
- package/build/lib/cli/extension.d.ts +9 -5
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +5 -7
- package/build/lib/cli/parser.d.ts +3 -3
- 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 +1 -1
- package/build/lib/cli/plugin-command.d.ts.map +1 -1
- package/build/lib/cli/plugin-command.js +1 -1
- package/build/lib/cli/utils.js +1 -1
- package/build/lib/config-file.d.ts.map +1 -1
- package/build/lib/config-file.js +1 -1
- package/build/lib/config.d.ts +4 -4
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js +1 -1
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +1 -1
- package/build/lib/extension/driver-config.d.ts +29 -32
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +7 -20
- package/build/lib/extension/extension-config.d.ts +108 -36
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +199 -60
- package/build/lib/extension/index.d.ts +16 -7
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/index.js +15 -18
- package/build/lib/extension/manifest.d.ts +12 -12
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +13 -3
- package/build/lib/extension/package-changed.d.ts.map +1 -1
- package/build/lib/extension/package-changed.js +1 -1
- package/build/lib/extension/plugin-config.d.ts +19 -24
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +9 -18
- package/build/lib/grid-register.d.ts.map +1 -1
- package/build/lib/grid-register.js +1 -1
- package/build/lib/logger.d.ts +1 -1
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +1 -1
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +3 -2
- package/build/lib/main.d.ts +13 -12
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +4 -4
- 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/arg-spec.js +1 -1
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/cli-args.js +1 -1
- package/build/lib/schema/cli-transformers.d.ts.map +1 -1
- package/build/lib/schema/cli-transformers.js +1 -1
- package/build/lib/schema/keywords.d.ts.map +1 -1
- package/build/lib/schema/keywords.js +1 -1
- package/build/lib/schema/schema.d.ts +2 -2
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +1 -1
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/appium-manifest.d.ts +23 -4
- package/build/types/appium-manifest.d.ts.map +1 -1
- package/build/types/cli.d.ts.map +1 -1
- package/build/types/{external-manifest.d.ts → extension-manifest.d.ts} +15 -7
- package/build/types/extension-manifest.d.ts.map +1 -0
- package/build/types/index.d.ts +6 -5
- package/build/types/index.d.ts.map +1 -1
- package/driver.d.ts +1 -0
- package/driver.js +14 -0
- package/lib/appium.js +208 -124
- package/lib/cli/args.js +143 -93
- package/lib/cli/driver-command.js +10 -15
- package/lib/cli/extension-command.js +226 -175
- package/lib/cli/extension.js +15 -19
- package/lib/cli/parser.js +19 -31
- package/lib/cli/plugin-command.js +8 -8
- package/lib/cli/utils.js +8 -14
- package/lib/config-file.js +21 -25
- package/lib/config.js +82 -64
- package/lib/constants.js +4 -13
- package/lib/extension/driver-config.js +171 -171
- package/lib/extension/extension-config.js +347 -126
- package/lib/extension/index.js +72 -58
- package/lib/extension/manifest.js +48 -57
- package/lib/extension/package-changed.js +9 -8
- package/lib/extension/plugin-config.js +62 -62
- package/lib/grid-register.js +29 -18
- package/lib/logger.js +1 -2
- package/lib/logsink.js +29 -31
- package/lib/main.js +111 -73
- package/lib/schema/arg-spec.js +10 -13
- package/lib/schema/cli-args.js +14 -37
- package/lib/schema/cli-transformers.js +7 -14
- package/lib/schema/keywords.js +15 -13
- package/lib/schema/schema.js +58 -75
- package/lib/utils.js +50 -25
- package/package.json +25 -18
- package/plugin.d.ts +1 -0
- package/plugin.js +13 -0
- package/scripts/autoinstall-extensions.js +177 -0
- package/support.d.ts +1 -0
- package/support.js +13 -0
- package/types/appium-manifest.ts +27 -15
- package/types/cli.ts +2 -9
- package/types/{external-manifest.ts → extension-manifest.ts} +21 -15
- package/types/index.ts +12 -5
- package/build/types/extension.d.ts +0 -43
- package/build/types/extension.d.ts.map +0 -1
- package/build/types/external-manifest.d.ts.map +0 -1
- package/scripts/postinstall.js +0 -71
- package/types/extension.ts +0 -56
package/lib/cli/args.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
|
|
2
1
|
// @ts-ignore
|
|
3
2
|
import _ from 'lodash';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import {
|
|
4
|
+
DRIVER_TYPE,
|
|
5
|
+
PLUGIN_TYPE,
|
|
6
|
+
EXT_SUBCOMMAND_INSTALL,
|
|
7
|
+
EXT_SUBCOMMAND_LIST,
|
|
8
|
+
EXT_SUBCOMMAND_RUN,
|
|
9
|
+
EXT_SUBCOMMAND_UNINSTALL,
|
|
10
|
+
EXT_SUBCOMMAND_UPDATE,
|
|
11
|
+
} from '../constants';
|
|
12
|
+
import {INSTALL_TYPES} from '../extension/extension-config';
|
|
13
|
+
import {toParserArgs} from '../schema/cli-args';
|
|
7
14
|
const DRIVER_EXAMPLE = 'xcuitest';
|
|
8
15
|
const PLUGIN_EXAMPLE = 'find_by_image';
|
|
9
16
|
|
|
@@ -19,19 +26,22 @@ const EXTENSION_TYPES = new Set([DRIVER_TYPE, PLUGIN_TYPE]);
|
|
|
19
26
|
// this set of args works for both drivers and plugins ('extensions')
|
|
20
27
|
/** @type {ArgumentDefinitions} */
|
|
21
28
|
const globalExtensionArgs = new Map([
|
|
22
|
-
[
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
[
|
|
30
|
+
['--json'],
|
|
31
|
+
{
|
|
32
|
+
required: false,
|
|
33
|
+
default: false,
|
|
34
|
+
action: 'store_true',
|
|
35
|
+
help: 'Use JSON for output format',
|
|
36
|
+
dest: 'json',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
29
39
|
]);
|
|
30
40
|
|
|
31
41
|
/**
|
|
32
42
|
* Builds a Record of extension types to a Record of subcommands to their argument definitions
|
|
33
43
|
*/
|
|
34
|
-
const getExtensionArgs = _.memoize(function getExtensionArgs
|
|
44
|
+
const getExtensionArgs = _.memoize(function getExtensionArgs() {
|
|
35
45
|
const extensionArgs = {};
|
|
36
46
|
for (const type of EXTENSION_TYPES) {
|
|
37
47
|
extensionArgs[type] = {
|
|
@@ -42,7 +52,9 @@ const getExtensionArgs = _.memoize(function getExtensionArgs () {
|
|
|
42
52
|
[EXT_SUBCOMMAND_RUN]: makeRunArgs(type),
|
|
43
53
|
};
|
|
44
54
|
}
|
|
45
|
-
return /** @type {Record<ExtensionType, Record<import('
|
|
55
|
+
return /** @type {Record<ExtensionType, Record<import('appium/types').CliExtensionSubcommand,ArgumentDefinitions>>} */ (
|
|
56
|
+
extensionArgs
|
|
57
|
+
);
|
|
46
58
|
});
|
|
47
59
|
|
|
48
60
|
/**
|
|
@@ -50,23 +62,29 @@ const getExtensionArgs = _.memoize(function getExtensionArgs () {
|
|
|
50
62
|
* @param {ExtensionType} type
|
|
51
63
|
* @returns {ArgumentDefinitions}
|
|
52
64
|
*/
|
|
53
|
-
function makeListArgs
|
|
65
|
+
function makeListArgs(type) {
|
|
54
66
|
return new Map([
|
|
55
67
|
...globalExtensionArgs,
|
|
56
|
-
[
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
[
|
|
69
|
+
['--installed'],
|
|
70
|
+
{
|
|
71
|
+
required: false,
|
|
72
|
+
default: false,
|
|
73
|
+
action: 'store_true',
|
|
74
|
+
help: `List only installed ${type}s`,
|
|
75
|
+
dest: 'showInstalled',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
[
|
|
79
|
+
['--updates'],
|
|
80
|
+
{
|
|
81
|
+
required: false,
|
|
82
|
+
default: false,
|
|
83
|
+
action: 'store_true',
|
|
84
|
+
help: 'Show information about newer versions',
|
|
85
|
+
dest: 'showUpdates',
|
|
86
|
+
},
|
|
87
|
+
],
|
|
70
88
|
]);
|
|
71
89
|
}
|
|
72
90
|
|
|
@@ -75,48 +93,65 @@ function makeListArgs (type) {
|
|
|
75
93
|
* @param {ExtensionType} type
|
|
76
94
|
* @returns {ArgumentDefinitions}
|
|
77
95
|
*/
|
|
78
|
-
function makeInstallArgs
|
|
96
|
+
function makeInstallArgs(type) {
|
|
79
97
|
return new Map([
|
|
80
98
|
...globalExtensionArgs,
|
|
81
|
-
[
|
|
82
|
-
type
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
[
|
|
100
|
+
[type],
|
|
101
|
+
{
|
|
102
|
+
type: 'str',
|
|
103
|
+
help:
|
|
104
|
+
`Name of the ${type} to install, for example: ` + type === DRIVER_TYPE
|
|
105
|
+
? DRIVER_EXAMPLE
|
|
106
|
+
: PLUGIN_EXAMPLE,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
[
|
|
110
|
+
['--source'],
|
|
111
|
+
{
|
|
112
|
+
required: false,
|
|
113
|
+
default: null,
|
|
114
|
+
choices: INSTALL_TYPES_ARRAY,
|
|
115
|
+
help:
|
|
116
|
+
`Where to look for the ${type} if it is not one of Appium's verified ` +
|
|
117
|
+
`${type}s. Possible values: ${INSTALL_TYPES_ARRAY.join(', ')}`,
|
|
118
|
+
dest: 'installType',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
['--package'],
|
|
123
|
+
{
|
|
124
|
+
required: false,
|
|
125
|
+
default: null,
|
|
126
|
+
type: 'str',
|
|
127
|
+
help:
|
|
128
|
+
`If installing from Git or GitHub, the package name, as defined in the plugin's ` +
|
|
129
|
+
`package.json file in the "name" field, cannot be determined automatically, and ` +
|
|
130
|
+
`should be reported here, otherwise the install will probably fail.`,
|
|
131
|
+
dest: 'packageName',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
103
134
|
]);
|
|
104
135
|
}
|
|
105
136
|
|
|
106
|
-
|
|
107
137
|
/**
|
|
108
138
|
* Makes the opts for the `uninstall` subcommand for each extension type
|
|
109
139
|
* @param {ExtensionType} type
|
|
110
140
|
* @returns {ArgumentDefinitions}
|
|
111
141
|
*/
|
|
112
|
-
function makeUninstallArgs
|
|
142
|
+
function makeUninstallArgs(type) {
|
|
113
143
|
return new Map([
|
|
114
144
|
...globalExtensionArgs,
|
|
115
|
-
[
|
|
116
|
-
type
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
145
|
+
[
|
|
146
|
+
[type],
|
|
147
|
+
{
|
|
148
|
+
type: 'str',
|
|
149
|
+
help:
|
|
150
|
+
'Name of the driver to uninstall, for example: ' + type === DRIVER_TYPE
|
|
151
|
+
? DRIVER_EXAMPLE
|
|
152
|
+
: PLUGIN_EXAMPLE,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
120
155
|
]);
|
|
121
156
|
}
|
|
122
157
|
|
|
@@ -125,22 +160,34 @@ function makeUninstallArgs (type) {
|
|
|
125
160
|
* @param {ExtensionType} type
|
|
126
161
|
* @returns {ArgumentDefinitions}
|
|
127
162
|
*/
|
|
128
|
-
function makeUpdateArgs
|
|
163
|
+
function makeUpdateArgs(type) {
|
|
129
164
|
return new Map([
|
|
130
165
|
...globalExtensionArgs,
|
|
131
|
-
[
|
|
132
|
-
type
|
|
133
|
-
|
|
166
|
+
[
|
|
167
|
+
[type],
|
|
168
|
+
{
|
|
169
|
+
type: 'str',
|
|
170
|
+
help:
|
|
171
|
+
`Name of the ${type} to update, or the word "installed" to update all installed ` +
|
|
134
172
|
`${type}s. To see available updates, run "appium ${type} list --installed --updates". ` +
|
|
135
|
-
'For example: ' +
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
173
|
+
'For example: ' +
|
|
174
|
+
type ===
|
|
175
|
+
DRIVER_TYPE
|
|
176
|
+
? DRIVER_EXAMPLE
|
|
177
|
+
: PLUGIN_EXAMPLE,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
[
|
|
181
|
+
['--unsafe'],
|
|
182
|
+
{
|
|
183
|
+
required: false,
|
|
184
|
+
default: false,
|
|
185
|
+
action: 'store_true',
|
|
186
|
+
help:
|
|
187
|
+
`Include updates that might have a new major revision, and potentially include ` +
|
|
188
|
+
`breaking changes`,
|
|
189
|
+
},
|
|
190
|
+
],
|
|
144
191
|
]);
|
|
145
192
|
}
|
|
146
193
|
|
|
@@ -149,20 +196,29 @@ function makeUpdateArgs (type) {
|
|
|
149
196
|
* @param {ExtensionType} type
|
|
150
197
|
* @returns {ArgumentDefinitions}
|
|
151
198
|
*/
|
|
152
|
-
function makeRunArgs
|
|
199
|
+
function makeRunArgs(type) {
|
|
153
200
|
return new Map([
|
|
154
201
|
...globalExtensionArgs,
|
|
155
|
-
[
|
|
156
|
-
type
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
202
|
+
[
|
|
203
|
+
[type],
|
|
204
|
+
{
|
|
205
|
+
type: 'str',
|
|
206
|
+
help:
|
|
207
|
+
`Name of the ${type} to run a script from, for example: ` + type === DRIVER_TYPE
|
|
208
|
+
? DRIVER_EXAMPLE
|
|
209
|
+
: PLUGIN_EXAMPLE,
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
['scriptName'],
|
|
214
|
+
{
|
|
215
|
+
default: null,
|
|
216
|
+
type: 'str',
|
|
217
|
+
help:
|
|
218
|
+
`Name of the script to run from the ${type}. The script name must be cached ` +
|
|
219
|
+
`inside the "scripts" field under "appium" inside the ${type}'s "package.json" file`,
|
|
220
|
+
},
|
|
221
|
+
],
|
|
166
222
|
]);
|
|
167
223
|
}
|
|
168
224
|
|
|
@@ -171,11 +227,8 @@ function makeRunArgs (type) {
|
|
|
171
227
|
* which are disallowed in the config file.
|
|
172
228
|
* @returns {ArgumentDefinitions}
|
|
173
229
|
*/
|
|
174
|
-
function getServerArgs
|
|
175
|
-
return new Map([
|
|
176
|
-
...toParserArgs(),
|
|
177
|
-
...serverArgsDisallowedInConfig,
|
|
178
|
-
]);
|
|
230
|
+
function getServerArgs() {
|
|
231
|
+
return new Map([...toParserArgs(), ...serverArgsDisallowedInConfig]);
|
|
179
232
|
}
|
|
180
233
|
|
|
181
234
|
/**
|
|
@@ -211,7 +264,7 @@ const serverArgsDisallowedInConfig = new Map([
|
|
|
211
264
|
const: true,
|
|
212
265
|
required: false,
|
|
213
266
|
help: 'Show the current Appium configuration and exit',
|
|
214
|
-
}
|
|
267
|
+
},
|
|
215
268
|
],
|
|
216
269
|
[
|
|
217
270
|
['--config'],
|
|
@@ -224,10 +277,7 @@ const serverArgsDisallowedInConfig = new Map([
|
|
|
224
277
|
],
|
|
225
278
|
]);
|
|
226
279
|
|
|
227
|
-
export {
|
|
228
|
-
getServerArgs,
|
|
229
|
-
getExtensionArgs
|
|
230
|
-
};
|
|
280
|
+
export {getServerArgs, getExtensionArgs};
|
|
231
281
|
|
|
232
282
|
/**
|
|
233
283
|
* Alias
|
|
@@ -3,26 +3,21 @@ import ExtensionCommand from './extension-command';
|
|
|
3
3
|
import {KNOWN_DRIVERS} from '../constants';
|
|
4
4
|
import '@colors/colors';
|
|
5
5
|
|
|
6
|
-
const REQ_DRIVER_FIELDS = [
|
|
7
|
-
'driverName',
|
|
8
|
-
'automationName',
|
|
9
|
-
'platformNames',
|
|
10
|
-
'mainClass',
|
|
11
|
-
];
|
|
6
|
+
const REQ_DRIVER_FIELDS = ['driverName', 'automationName', 'platformNames', 'mainClass'];
|
|
12
7
|
|
|
13
8
|
/**
|
|
14
9
|
* @extends {ExtensionCommand<DriverType>}
|
|
15
10
|
*/
|
|
16
11
|
export default class DriverCommand extends ExtensionCommand {
|
|
17
12
|
/**
|
|
18
|
-
* @param {
|
|
13
|
+
* @param {import('./extension-command').ExtensionCommandOptions<DriverType>} opts
|
|
19
14
|
*/
|
|
20
|
-
constructor
|
|
15
|
+
constructor({config, json}) {
|
|
21
16
|
super({config, json});
|
|
22
17
|
this.knownExtensions = KNOWN_DRIVERS;
|
|
23
18
|
}
|
|
24
19
|
|
|
25
|
-
async install
|
|
20
|
+
async install({driver, installType, packageName}) {
|
|
26
21
|
return await super._install({
|
|
27
22
|
installSpec: driver,
|
|
28
23
|
installType,
|
|
@@ -30,19 +25,19 @@ export default class DriverCommand extends ExtensionCommand {
|
|
|
30
25
|
});
|
|
31
26
|
}
|
|
32
27
|
|
|
33
|
-
async uninstall
|
|
28
|
+
async uninstall({driver}) {
|
|
34
29
|
return await super._uninstall({installSpec: driver});
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
async update
|
|
32
|
+
async update({driver, unsafe}) {
|
|
38
33
|
return await super._update({installSpec: driver, unsafe});
|
|
39
34
|
}
|
|
40
35
|
|
|
41
|
-
async run
|
|
36
|
+
async run({driver, scriptName}) {
|
|
42
37
|
return await super._run({installSpec: driver, scriptName});
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
getPostInstallText
|
|
40
|
+
getPostInstallText({extName, extData}) {
|
|
46
41
|
return (
|
|
47
42
|
`Driver ${extName}@${extData.version} successfully installed\n`.green +
|
|
48
43
|
`- automationName: ${extData.automationName.green}\n` +
|
|
@@ -59,7 +54,7 @@ export default class DriverCommand extends ExtensionCommand {
|
|
|
59
54
|
* @param {import('appium/types').ExtMetadata<DriverType>} driverMetadata
|
|
60
55
|
* @param {string} installSpec
|
|
61
56
|
*/
|
|
62
|
-
validateExtensionFields
|
|
57
|
+
validateExtensionFields(driverMetadata, installSpec) {
|
|
63
58
|
const missingFields = REQ_DRIVER_FIELDS.reduce(
|
|
64
59
|
(acc, field) => (driverMetadata[field] ? acc : [...acc, field]),
|
|
65
60
|
[]
|
|
@@ -81,5 +76,5 @@ export default class DriverCommand extends ExtensionCommand {
|
|
|
81
76
|
*/
|
|
82
77
|
|
|
83
78
|
/**
|
|
84
|
-
* @typedef {import('appium/types').DriverType} DriverType
|
|
79
|
+
* @typedef {import('@appium/types').DriverType} DriverType
|
|
85
80
|
*/
|