appium 2.0.0-beta.3 → 2.0.0-beta.34
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/README.md +10 -11
- package/build/lib/appium.d.ts +215 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +241 -132
- package/build/lib/cli/args.d.ts +20 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +96 -282
- package/build/lib/cli/driver-command.d.ts +36 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +19 -12
- package/build/lib/cli/extension-command.d.ts +345 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +171 -96
- package/build/lib/cli/extension.d.ts +14 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +31 -16
- package/build/lib/cli/parser.d.ts +80 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +152 -95
- package/build/lib/cli/plugin-command.d.ts +39 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +18 -13
- 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 +27 -3
- 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 +136 -0
- package/build/lib/config.d.ts +41 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +92 -67
- package/build/lib/constants.d.ts +48 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +60 -0
- package/build/lib/extension/driver-config.d.ts +84 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +190 -0
- package/build/lib/extension/extension-config.d.ts +170 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +297 -0
- package/build/lib/extension/index.d.ts +39 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +77 -0
- package/build/lib/extension/manifest.d.ts +174 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +246 -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 +68 -0
- package/build/lib/extension/plugin-config.d.ts +62 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +87 -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 +21 -25
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +4 -6
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +12 -16
- package/build/lib/main.d.ts +54 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +189 -90
- 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 +119 -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 +180 -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 +74 -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 +34 -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 +70 -0
- package/build/lib/schema/schema.d.ts +259 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +452 -0
- package/build/lib/utils.d.ts +66 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +35 -139
- package/build/tsconfig.tsbuildinfo +1 -0
- 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/index.js +11 -0
- package/lib/appium-config.schema.json +278 -0
- package/lib/appium.js +402 -155
- package/lib/cli/args.js +174 -377
- package/lib/cli/driver-command.js +22 -7
- package/lib/cli/extension-command.js +372 -177
- package/lib/cli/extension.js +32 -10
- package/lib/cli/parser.js +253 -83
- package/lib/cli/plugin-command.js +19 -6
- package/lib/cli/utils.js +22 -2
- package/lib/config-file.js +223 -0
- package/lib/config.js +170 -69
- package/lib/constants.js +78 -0
- package/lib/extension/driver-config.js +249 -0
- package/lib/extension/extension-config.js +458 -0
- package/lib/extension/index.js +102 -0
- package/lib/extension/manifest.js +484 -0
- package/lib/extension/package-changed.js +63 -0
- package/lib/extension/plugin-config.js +113 -0
- package/lib/grid-register.js +25 -22
- package/lib/logger.js +1 -1
- package/lib/logsink.js +14 -7
- package/lib/main.js +255 -90
- package/lib/schema/arg-spec.js +232 -0
- package/lib/schema/cli-args.js +261 -0
- package/lib/schema/cli-transformers.js +122 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +134 -0
- package/lib/schema/schema.js +734 -0
- package/lib/utils.js +85 -129
- package/package.json +68 -85
- package/scripts/postinstall.js +71 -0
- package/types/appium-manifest.ts +61 -0
- package/types/cli.ts +153 -0
- package/types/extension.ts +56 -0
- package/types/external-manifest.ts +58 -0
- package/types/index.ts +14 -0
- package/CHANGELOG.md +0 -3515
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/npm.js +0 -206
- package/build/lib/cli/parser-helpers.js +0 -82
- package/build/lib/driver-config.js +0 -77
- package/build/lib/drivers.js +0 -96
- package/build/lib/extension-config.js +0 -251
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -14
- package/lib/cli/npm.js +0 -183
- package/lib/cli/parser-helpers.js +0 -79
- package/lib/driver-config.js +0 -46
- package/lib/drivers.js +0 -81
- package/lib/extension-config.js +0 -208
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -10
package/lib/cli/args.js
CHANGED
|
@@ -1,443 +1,240 @@
|
|
|
1
|
-
import { DEFAULT_BASE_PATH } from 'appium-base-driver';
|
|
2
|
-
import { parseSecurityFeatures, parseDefaultCaps, parsePluginNames, parseInstallTypes } from './parser-helpers';
|
|
3
|
-
import { INSTALL_TYPES, DEFAULT_APPIUM_HOME, DRIVER_TYPE, PLUGIN_TYPE } from '../extension-config';
|
|
4
1
|
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { DRIVER_TYPE, PLUGIN_TYPE, EXT_SUBCOMMAND_INSTALL, EXT_SUBCOMMAND_LIST, EXT_SUBCOMMAND_RUN, EXT_SUBCOMMAND_UNINSTALL, EXT_SUBCOMMAND_UPDATE } from '../constants';
|
|
5
|
+
import { INSTALL_TYPES } from '../extension/extension-config';
|
|
6
|
+
import { toParserArgs } from '../schema/cli-args';
|
|
5
7
|
const DRIVER_EXAMPLE = 'xcuitest';
|
|
6
8
|
const PLUGIN_EXAMPLE = 'find_by_image';
|
|
7
|
-
const USE_ALL_PLUGINS = 'all';
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
help: 'The path to the directory where Appium will keep installed drivers, plugins, and any other metadata necessary for its operation',
|
|
15
|
-
dest: 'appiumHome',
|
|
16
|
-
}],
|
|
17
|
-
|
|
18
|
-
[['--log-filters'], {
|
|
19
|
-
dest: 'logFilters',
|
|
20
|
-
defaultValue: null,
|
|
21
|
-
required: false,
|
|
22
|
-
help: 'Set the full path to a JSON file containing one or more log filtering rules',
|
|
23
|
-
example: '/home/rules.json',
|
|
24
|
-
}],
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const serverArgs = [
|
|
28
|
-
[['--shell'], {
|
|
29
|
-
required: false,
|
|
30
|
-
defaultValue: null,
|
|
31
|
-
help: 'Enter REPL mode',
|
|
32
|
-
nargs: 0,
|
|
33
|
-
dest: 'shell',
|
|
34
|
-
}],
|
|
35
|
-
|
|
36
|
-
[['--plugins'], {
|
|
37
|
-
required: false,
|
|
38
|
-
defaultValue: [],
|
|
39
|
-
help: `A comma-separated list of installed plugin names that should be active for this ` +
|
|
40
|
-
`server. To activate all plugins, you can use the single string "${USE_ALL_PLUGINS}" ` +
|
|
41
|
-
`as the value (e.g. --plugins=${USE_ALL_PLUGINS})`,
|
|
42
|
-
type: parsePluginNames,
|
|
43
|
-
dest: 'plugins',
|
|
44
|
-
}],
|
|
45
|
-
|
|
46
|
-
[['--allow-cors'], {
|
|
47
|
-
required: false,
|
|
48
|
-
defaultValue: false,
|
|
49
|
-
action: 'storeTrue',
|
|
50
|
-
help: 'Whether the Appium server should allow web browser connections from any host',
|
|
51
|
-
nargs: 0,
|
|
52
|
-
dest: 'allowCors',
|
|
53
|
-
}],
|
|
54
|
-
|
|
55
|
-
[['--reboot'], {
|
|
56
|
-
defaultValue: false,
|
|
57
|
-
dest: 'reboot',
|
|
58
|
-
action: 'storeTrue',
|
|
59
|
-
required: false,
|
|
60
|
-
help: '(Android-only) reboot emulator after each session and kill it at the end',
|
|
61
|
-
nargs: 0,
|
|
62
|
-
}],
|
|
63
|
-
|
|
64
|
-
[['-a', '--address'], {
|
|
65
|
-
defaultValue: '0.0.0.0',
|
|
66
|
-
required: false,
|
|
67
|
-
example: '0.0.0.0',
|
|
68
|
-
help: 'IP Address to listen on',
|
|
69
|
-
dest: 'address',
|
|
70
|
-
}],
|
|
71
|
-
|
|
72
|
-
[['-p', '--port'], {
|
|
73
|
-
defaultValue: 4723,
|
|
74
|
-
required: false,
|
|
75
|
-
type: 'int',
|
|
76
|
-
example: '4723',
|
|
77
|
-
help: 'port to listen on',
|
|
78
|
-
dest: 'port',
|
|
79
|
-
}],
|
|
80
|
-
|
|
81
|
-
[['-pa', '--base-path'], {
|
|
82
|
-
required: false,
|
|
83
|
-
defaultValue: DEFAULT_BASE_PATH,
|
|
84
|
-
dest: 'basePath',
|
|
85
|
-
example: '/path/prefix',
|
|
86
|
-
help: 'Base path to use as the prefix for all webdriver routes running' +
|
|
87
|
-
`on this server (default: ${DEFAULT_BASE_PATH})`
|
|
88
|
-
}],
|
|
89
|
-
|
|
90
|
-
[['-ca', '--callback-address'], {
|
|
91
|
-
required: false,
|
|
92
|
-
dest: 'callbackAddress',
|
|
93
|
-
defaultValue: null,
|
|
94
|
-
example: '127.0.0.1',
|
|
95
|
-
help: 'callback IP Address (default: same as --address)',
|
|
96
|
-
}],
|
|
97
|
-
|
|
98
|
-
[['-cp', '--callback-port'], {
|
|
99
|
-
required: false,
|
|
100
|
-
dest: 'callbackPort',
|
|
101
|
-
defaultValue: null,
|
|
102
|
-
type: 'int',
|
|
103
|
-
example: '4723',
|
|
104
|
-
help: 'callback port (default: same as port)',
|
|
105
|
-
}],
|
|
106
|
-
|
|
107
|
-
[['--session-override'], {
|
|
108
|
-
defaultValue: false,
|
|
109
|
-
dest: 'sessionOverride',
|
|
110
|
-
action: 'storeTrue',
|
|
111
|
-
required: false,
|
|
112
|
-
help: 'Enables session override (clobbering)',
|
|
113
|
-
nargs: 0,
|
|
114
|
-
}],
|
|
115
|
-
|
|
116
|
-
[['-g', '--log'], {
|
|
117
|
-
defaultValue: null,
|
|
118
|
-
dest: 'logFile',
|
|
119
|
-
required: false,
|
|
120
|
-
example: '/path/to/appium.log',
|
|
121
|
-
help: 'Also send log output to this file',
|
|
122
|
-
}],
|
|
123
|
-
|
|
124
|
-
[['--log-level'], {
|
|
125
|
-
choices: [
|
|
126
|
-
'info', 'info:debug', 'info:info', 'info:warn', 'info:error',
|
|
127
|
-
'warn', 'warn:debug', 'warn:info', 'warn:warn', 'warn:error',
|
|
128
|
-
'error', 'error:debug', 'error:info', 'error:warn', 'error:error',
|
|
129
|
-
'debug', 'debug:debug', 'debug:info', 'debug:warn', 'debug:error',
|
|
130
|
-
],
|
|
131
|
-
defaultValue: 'debug',
|
|
132
|
-
dest: 'loglevel',
|
|
133
|
-
required: false,
|
|
134
|
-
example: 'debug',
|
|
135
|
-
help: 'log level; default (console[:file]): debug[:debug]',
|
|
136
|
-
}],
|
|
137
|
-
|
|
138
|
-
[['--log-timestamp'], {
|
|
139
|
-
defaultValue: false,
|
|
140
|
-
required: false,
|
|
141
|
-
help: 'Show timestamps in console output',
|
|
142
|
-
nargs: 0,
|
|
143
|
-
action: 'storeTrue',
|
|
144
|
-
dest: 'logTimestamp',
|
|
145
|
-
}],
|
|
146
|
-
|
|
147
|
-
[['--local-timezone'], {
|
|
148
|
-
defaultValue: false,
|
|
149
|
-
required: false,
|
|
150
|
-
help: 'Use local timezone for timestamps',
|
|
151
|
-
nargs: 0,
|
|
152
|
-
action: 'storeTrue',
|
|
153
|
-
dest: 'localTimezone',
|
|
154
|
-
}],
|
|
155
|
-
|
|
156
|
-
[['--log-no-colors'], {
|
|
157
|
-
defaultValue: false,
|
|
158
|
-
required: false,
|
|
159
|
-
help: 'Do not use colors in console output',
|
|
160
|
-
nargs: 0,
|
|
161
|
-
action: 'storeTrue',
|
|
162
|
-
dest: 'logNoColors',
|
|
163
|
-
}],
|
|
164
|
-
|
|
165
|
-
[['-G', '--webhook'], {
|
|
166
|
-
defaultValue: null,
|
|
167
|
-
required: false,
|
|
168
|
-
example: 'localhost:9876',
|
|
169
|
-
dest: 'webhook',
|
|
170
|
-
help: 'Also send log output to this HTTP listener',
|
|
171
|
-
}],
|
|
172
|
-
|
|
173
|
-
[['--nodeconfig'], {
|
|
174
|
-
required: false,
|
|
175
|
-
defaultValue: null,
|
|
176
|
-
dest: 'nodeconfig',
|
|
177
|
-
help: 'Configuration JSON file to register appium with selenium grid',
|
|
178
|
-
example: '/abs/path/to/nodeconfig.json',
|
|
179
|
-
}],
|
|
180
|
-
|
|
181
|
-
[['--chromedriver-port'], {
|
|
182
|
-
defaultValue: null,
|
|
183
|
-
dest: 'chromeDriverPort',
|
|
184
|
-
required: false,
|
|
185
|
-
type: 'int',
|
|
186
|
-
example: '9515',
|
|
187
|
-
help: 'Port upon which ChromeDriver will run. If not given, Android driver will pick a random available port.',
|
|
188
|
-
}],
|
|
189
|
-
|
|
190
|
-
[['--chromedriver-executable'], {
|
|
191
|
-
defaultValue: null,
|
|
192
|
-
dest: 'chromedriverExecutable',
|
|
193
|
-
required: false,
|
|
194
|
-
help: 'ChromeDriver executable full path',
|
|
195
|
-
}],
|
|
196
|
-
|
|
197
|
-
[['--show-config'], {
|
|
198
|
-
defaultValue: false,
|
|
199
|
-
dest: 'showConfig',
|
|
200
|
-
action: 'storeTrue',
|
|
201
|
-
required: false,
|
|
202
|
-
help: 'Show info about the appium server configuration and exit',
|
|
203
|
-
}],
|
|
204
|
-
|
|
205
|
-
[['--no-perms-check'], {
|
|
206
|
-
defaultValue: false,
|
|
207
|
-
dest: 'noPermsCheck',
|
|
208
|
-
action: 'storeTrue',
|
|
209
|
-
required: false,
|
|
210
|
-
help: 'Bypass Appium\'s checks to ensure we can read/write necessary files',
|
|
211
|
-
}],
|
|
10
|
+
/**
|
|
11
|
+
* This is necessary because we pass the array into `argparse`. `argparse` is bad and mutates things. We don't want that.
|
|
12
|
+
* Bad `argparse`! Bad!
|
|
13
|
+
*/
|
|
14
|
+
const INSTALL_TYPES_ARRAY = [...INSTALL_TYPES];
|
|
212
15
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
dest: 'enforceStrictCaps',
|
|
216
|
-
action: 'storeTrue',
|
|
217
|
-
required: false,
|
|
218
|
-
help: 'Cause sessions to fail if desired caps are sent in that Appium ' +
|
|
219
|
-
'does not recognize as valid for the selected device',
|
|
220
|
-
nargs: 0,
|
|
221
|
-
}],
|
|
222
|
-
|
|
223
|
-
[['--tmp'], {
|
|
224
|
-
defaultValue: null,
|
|
225
|
-
dest: 'tmpDir',
|
|
226
|
-
required: false,
|
|
227
|
-
help: 'Absolute path to directory Appium can use to manage temporary ' +
|
|
228
|
-
'files, like built-in iOS apps it needs to move around. On *nix/Mac ' +
|
|
229
|
-
'defaults to /tmp, on Windows defaults to C:\\Windows\\Temp',
|
|
230
|
-
}],
|
|
231
|
-
|
|
232
|
-
[['--trace-dir'], {
|
|
233
|
-
defaultValue: null,
|
|
234
|
-
dest: 'traceDir',
|
|
235
|
-
required: false,
|
|
236
|
-
help: 'Absolute path to directory Appium use to save ios instruments ' +
|
|
237
|
-
'traces, defaults to <tmp dir>/appium-instruments',
|
|
238
|
-
}],
|
|
239
|
-
|
|
240
|
-
[['--debug-log-spacing'], {
|
|
241
|
-
dest: 'debugLogSpacing',
|
|
242
|
-
defaultValue: false,
|
|
243
|
-
action: 'storeTrue',
|
|
244
|
-
required: false,
|
|
245
|
-
help: 'Add exaggerated spacing in logs to help with visual inspection',
|
|
246
|
-
}],
|
|
247
|
-
|
|
248
|
-
[['--suppress-adb-kill-server'], {
|
|
249
|
-
dest: 'suppressKillServer',
|
|
250
|
-
defaultValue: false,
|
|
251
|
-
action: 'storeTrue',
|
|
252
|
-
required: false,
|
|
253
|
-
help: '(Android-only) If set, prevents Appium from killing the adb server instance',
|
|
254
|
-
nargs: 0,
|
|
255
|
-
}],
|
|
256
|
-
|
|
257
|
-
[['--long-stacktrace'], {
|
|
258
|
-
dest: 'longStacktrace',
|
|
259
|
-
defaultValue: false,
|
|
260
|
-
required: false,
|
|
261
|
-
action: 'storeTrue',
|
|
262
|
-
help: 'Add long stack traces to log entries. Recommended for debugging only.',
|
|
263
|
-
}],
|
|
264
|
-
|
|
265
|
-
[['--webkit-debug-proxy-port'], {
|
|
266
|
-
defaultValue: 27753,
|
|
267
|
-
dest: 'webkitDebugProxyPort',
|
|
268
|
-
required: false,
|
|
269
|
-
type: 'int',
|
|
270
|
-
example: '27753',
|
|
271
|
-
help: '(IOS-only) Local port used for communication with ios-webkit-debug-proxy'
|
|
272
|
-
}],
|
|
273
|
-
|
|
274
|
-
[['--webdriveragent-port'], {
|
|
275
|
-
defaultValue: 8100,
|
|
276
|
-
dest: 'wdaLocalPort',
|
|
277
|
-
required: false,
|
|
278
|
-
type: 'int',
|
|
279
|
-
example: '8100',
|
|
280
|
-
help: '(IOS-only, XCUITest-only) Local port used for communication with WebDriverAgent'
|
|
281
|
-
}],
|
|
282
|
-
|
|
283
|
-
[['-dc', '--default-capabilities'], {
|
|
284
|
-
dest: 'defaultCapabilities',
|
|
285
|
-
defaultValue: {},
|
|
286
|
-
type: parseDefaultCaps,
|
|
287
|
-
required: false,
|
|
288
|
-
example: '[ \'{"app": "myapp.app", "deviceName": "iPhone Simulator"}\' ' +
|
|
289
|
-
'| /path/to/caps.json ]',
|
|
290
|
-
help: 'Set the default desired capabilities, which will be set on each ' +
|
|
291
|
-
'session unless overridden by received capabilities.'
|
|
292
|
-
}],
|
|
293
|
-
|
|
294
|
-
[['--relaxed-security'], {
|
|
295
|
-
defaultValue: false,
|
|
296
|
-
dest: 'relaxedSecurityEnabled',
|
|
297
|
-
action: 'storeTrue',
|
|
298
|
-
required: false,
|
|
299
|
-
help: 'Disable additional security checks, so it is possible to use some advanced features, provided ' +
|
|
300
|
-
'by drivers supporting this option. Only enable it if all the ' +
|
|
301
|
-
'clients are in the trusted network and it\'s not the case if a client could potentially ' +
|
|
302
|
-
'break out of the session sandbox. Specific features can be overridden by ' +
|
|
303
|
-
'using the --deny-insecure flag',
|
|
304
|
-
nargs: 0
|
|
305
|
-
}],
|
|
306
|
-
|
|
307
|
-
[['--allow-insecure'], {
|
|
308
|
-
dest: 'allowInsecure',
|
|
309
|
-
defaultValue: [],
|
|
310
|
-
type: parseSecurityFeatures,
|
|
311
|
-
required: false,
|
|
312
|
-
example: 'execute_driver_script,adb_shell',
|
|
313
|
-
help: 'Set which insecure features are allowed to run in this server\'s sessions. ' +
|
|
314
|
-
'Features are defined on a driver level; see documentation for more details. ' +
|
|
315
|
-
'This should be either a comma-separated list of feature names, or a path to ' +
|
|
316
|
-
'a file where each feature name is on a line. Note that features defined via ' +
|
|
317
|
-
'--deny-insecure will be disabled, even if also listed here.',
|
|
318
|
-
}],
|
|
319
|
-
|
|
320
|
-
[['--deny-insecure'], {
|
|
321
|
-
dest: 'denyInsecure',
|
|
322
|
-
defaultValue: [],
|
|
323
|
-
type: parseSecurityFeatures,
|
|
324
|
-
required: false,
|
|
325
|
-
example: 'execute_driver_script,adb_shell',
|
|
326
|
-
help: 'Set which insecure features are not allowed to run in this server\'s sessions. ' +
|
|
327
|
-
'Features are defined on a driver level; see documentation for more details. ' +
|
|
328
|
-
'This should be either a comma-separated list of feature names, or a path to ' +
|
|
329
|
-
'a file where each feature name is on a line. Features listed here will not be ' +
|
|
330
|
-
'enabled even if also listed in --allow-insecure, and even if --relaxed-security ' +
|
|
331
|
-
'is turned on.',
|
|
332
|
-
}],
|
|
333
|
-
];
|
|
16
|
+
/** @type {Set<ExtensionType>} */
|
|
17
|
+
const EXTENSION_TYPES = new Set([DRIVER_TYPE, PLUGIN_TYPE]);
|
|
334
18
|
|
|
335
19
|
// this set of args works for both drivers and plugins ('extensions')
|
|
336
|
-
|
|
20
|
+
/** @type {ArgumentDefinitions} */
|
|
21
|
+
const globalExtensionArgs = new Map([
|
|
337
22
|
[['--json'], {
|
|
338
23
|
required: false,
|
|
339
|
-
|
|
340
|
-
action: '
|
|
24
|
+
default: false,
|
|
25
|
+
action: 'store_true',
|
|
341
26
|
help: 'Use JSON for output format',
|
|
342
|
-
nargs: 0,
|
|
343
27
|
dest: 'json'
|
|
344
28
|
}]
|
|
345
|
-
];
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Builds a Record of extension types to a Record of subcommands to their argument definitions
|
|
33
|
+
*/
|
|
34
|
+
const getExtensionArgs = _.memoize(function getExtensionArgs () {
|
|
35
|
+
const extensionArgs = {};
|
|
36
|
+
for (const type of EXTENSION_TYPES) {
|
|
37
|
+
extensionArgs[type] = {
|
|
38
|
+
[EXT_SUBCOMMAND_LIST]: makeListArgs(type),
|
|
39
|
+
[EXT_SUBCOMMAND_INSTALL]: makeInstallArgs(type),
|
|
40
|
+
[EXT_SUBCOMMAND_UNINSTALL]: makeUninstallArgs(type),
|
|
41
|
+
[EXT_SUBCOMMAND_UPDATE]: makeUpdateArgs(type),
|
|
42
|
+
[EXT_SUBCOMMAND_RUN]: makeRunArgs(type),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return /** @type {Record<ExtensionType, Record<import('../../types/cli').CliExtensionSubcommand,ArgumentDefinitions>>} */(extensionArgs);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Makes the opts for the `list` subcommand for each extension type.
|
|
50
|
+
* @param {ExtensionType} type
|
|
51
|
+
* @returns {ArgumentDefinitions}
|
|
52
|
+
*/
|
|
349
53
|
function makeListArgs (type) {
|
|
350
|
-
return [
|
|
54
|
+
return new Map([
|
|
351
55
|
...globalExtensionArgs,
|
|
352
56
|
[['--installed'], {
|
|
353
57
|
required: false,
|
|
354
|
-
|
|
355
|
-
action: '
|
|
58
|
+
default: false,
|
|
59
|
+
action: 'store_true',
|
|
356
60
|
help: `List only installed ${type}s`,
|
|
357
|
-
nargs: 0,
|
|
358
61
|
dest: 'showInstalled'
|
|
359
62
|
}],
|
|
360
63
|
[['--updates'], {
|
|
361
64
|
required: false,
|
|
362
|
-
|
|
363
|
-
action: '
|
|
65
|
+
default: false,
|
|
66
|
+
action: 'store_true',
|
|
364
67
|
help: 'Show information about newer versions',
|
|
365
|
-
nargs: 0,
|
|
366
68
|
dest: 'showUpdates'
|
|
367
69
|
}]
|
|
368
|
-
];
|
|
70
|
+
]);
|
|
369
71
|
}
|
|
370
72
|
|
|
371
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Makes the opts for the `install` subcommand for each extension type
|
|
75
|
+
* @param {ExtensionType} type
|
|
76
|
+
* @returns {ArgumentDefinitions}
|
|
77
|
+
*/
|
|
372
78
|
function makeInstallArgs (type) {
|
|
373
|
-
return [
|
|
79
|
+
return new Map([
|
|
374
80
|
...globalExtensionArgs,
|
|
375
81
|
[[type], {
|
|
376
|
-
type: '
|
|
377
|
-
|
|
378
|
-
|
|
82
|
+
type: 'str',
|
|
83
|
+
help: `Name of the ${type} to install, for example: ` +
|
|
84
|
+
type === DRIVER_TYPE ? DRIVER_EXAMPLE : PLUGIN_EXAMPLE,
|
|
379
85
|
}],
|
|
380
86
|
[['--source'], {
|
|
381
87
|
required: false,
|
|
382
|
-
|
|
383
|
-
|
|
88
|
+
default: null,
|
|
89
|
+
choices: INSTALL_TYPES_ARRAY,
|
|
384
90
|
help: `Where to look for the ${type} if it is not one of Appium's verified ` +
|
|
385
|
-
`${type}s. Possible values: ${
|
|
91
|
+
`${type}s. Possible values: ${INSTALL_TYPES_ARRAY.join(', ')}`,
|
|
386
92
|
dest: 'installType'
|
|
387
93
|
}],
|
|
388
94
|
[['--package'], {
|
|
389
95
|
required: false,
|
|
390
|
-
|
|
391
|
-
type: '
|
|
96
|
+
default: null,
|
|
97
|
+
type: 'str',
|
|
392
98
|
help: `If installing from Git or GitHub, the package name, as defined in the plugin's ` +
|
|
393
99
|
`package.json file in the "name" field, cannot be determined automatically, and ` +
|
|
394
100
|
`should be reported here, otherwise the install will probably fail.`,
|
|
395
101
|
dest: 'packageName',
|
|
396
102
|
}],
|
|
397
|
-
];
|
|
103
|
+
]);
|
|
398
104
|
}
|
|
399
105
|
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Makes the opts for the `uninstall` subcommand for each extension type
|
|
109
|
+
* @param {ExtensionType} type
|
|
110
|
+
* @returns {ArgumentDefinitions}
|
|
111
|
+
*/
|
|
400
112
|
function makeUninstallArgs (type) {
|
|
401
|
-
return [
|
|
113
|
+
return new Map([
|
|
402
114
|
...globalExtensionArgs,
|
|
403
115
|
[[type], {
|
|
404
|
-
type: '
|
|
405
|
-
|
|
406
|
-
|
|
116
|
+
type: 'str',
|
|
117
|
+
help: 'Name of the driver to uninstall, for example: ' +
|
|
118
|
+
type === DRIVER_TYPE ? DRIVER_EXAMPLE : PLUGIN_EXAMPLE
|
|
407
119
|
}],
|
|
408
|
-
];
|
|
120
|
+
]);
|
|
409
121
|
}
|
|
410
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Makes the opts for the `update` subcommand for each extension type
|
|
125
|
+
* @param {ExtensionType} type
|
|
126
|
+
* @returns {ArgumentDefinitions}
|
|
127
|
+
*/
|
|
411
128
|
function makeUpdateArgs (type) {
|
|
412
|
-
return [
|
|
129
|
+
return new Map([
|
|
413
130
|
...globalExtensionArgs,
|
|
414
131
|
[[type], {
|
|
415
|
-
type: '
|
|
416
|
-
example: type === DRIVER_TYPE ? DRIVER_EXAMPLE : PLUGIN_EXAMPLE,
|
|
132
|
+
type: 'str',
|
|
417
133
|
help: `Name of the ${type} to update, or the word "installed" to update all installed ` +
|
|
418
|
-
`${type}s. To see available updates, run "appium ${type} list --installed --updates"
|
|
134
|
+
`${type}s. To see available updates, run "appium ${type} list --installed --updates". ` +
|
|
135
|
+
'For example: ' + type === DRIVER_TYPE ? DRIVER_EXAMPLE : PLUGIN_EXAMPLE,
|
|
419
136
|
}],
|
|
420
137
|
[['--unsafe'], {
|
|
421
138
|
required: false,
|
|
422
|
-
|
|
423
|
-
action: '
|
|
424
|
-
nargs: 0,
|
|
139
|
+
default: false,
|
|
140
|
+
action: 'store_true',
|
|
425
141
|
help: `Include updates that might have a new major revision, and potentially include ` +
|
|
426
142
|
`breaking changes`,
|
|
427
143
|
}],
|
|
428
|
-
];
|
|
144
|
+
]);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Makes the opts for the `run` subcommand for each extension type
|
|
149
|
+
* @param {ExtensionType} type
|
|
150
|
+
* @returns {ArgumentDefinitions}
|
|
151
|
+
*/
|
|
152
|
+
function makeRunArgs (type) {
|
|
153
|
+
return new Map([
|
|
154
|
+
...globalExtensionArgs,
|
|
155
|
+
[[type], {
|
|
156
|
+
type: 'str',
|
|
157
|
+
help: `Name of the ${type} to run a script from, for example: ` +
|
|
158
|
+
type === DRIVER_TYPE ? DRIVER_EXAMPLE : PLUGIN_EXAMPLE,
|
|
159
|
+
}],
|
|
160
|
+
[['scriptName'], {
|
|
161
|
+
default: null,
|
|
162
|
+
type: 'str',
|
|
163
|
+
help: `Name of the script to run from the ${type}. The script name must be cached ` +
|
|
164
|
+
`inside the "scripts" field under "appium" inside the ${type}'s "package.json" file`
|
|
165
|
+
}],
|
|
166
|
+
]);
|
|
429
167
|
}
|
|
430
168
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
169
|
+
/**
|
|
170
|
+
* Derives the options for the `server` command from the schema, and adds the arguments
|
|
171
|
+
* which are disallowed in the config file.
|
|
172
|
+
* @returns {ArgumentDefinitions}
|
|
173
|
+
*/
|
|
174
|
+
function getServerArgs () {
|
|
175
|
+
return new Map([
|
|
176
|
+
...toParserArgs(),
|
|
177
|
+
...serverArgsDisallowedInConfig,
|
|
178
|
+
]);
|
|
436
179
|
}
|
|
437
180
|
|
|
181
|
+
/**
|
|
182
|
+
* These don't make sense in the context of a config file for obvious reasons.
|
|
183
|
+
* @type {ArgumentDefinitions}
|
|
184
|
+
*/
|
|
185
|
+
const serverArgsDisallowedInConfig = new Map([
|
|
186
|
+
[
|
|
187
|
+
['--shell'],
|
|
188
|
+
{
|
|
189
|
+
required: false,
|
|
190
|
+
help: 'Enter REPL mode',
|
|
191
|
+
action: 'store_const',
|
|
192
|
+
const: true,
|
|
193
|
+
dest: 'shell',
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
[
|
|
197
|
+
['--show-build-info'],
|
|
198
|
+
{
|
|
199
|
+
dest: 'showBuildInfo',
|
|
200
|
+
action: 'store_const',
|
|
201
|
+
const: true,
|
|
202
|
+
required: false,
|
|
203
|
+
help: 'Show info about the Appium build and exit',
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
['--show-config'],
|
|
208
|
+
{
|
|
209
|
+
dest: 'showConfig',
|
|
210
|
+
action: 'store_const',
|
|
211
|
+
const: true,
|
|
212
|
+
required: false,
|
|
213
|
+
help: 'Show the current Appium configuration and exit',
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
[
|
|
217
|
+
['--config'],
|
|
218
|
+
{
|
|
219
|
+
dest: 'configFile',
|
|
220
|
+
type: 'string',
|
|
221
|
+
required: false,
|
|
222
|
+
help: 'Explicit path to Appium configuration file',
|
|
223
|
+
},
|
|
224
|
+
],
|
|
225
|
+
]);
|
|
226
|
+
|
|
438
227
|
export {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
extensionArgs,
|
|
442
|
-
USE_ALL_PLUGINS,
|
|
228
|
+
getServerArgs,
|
|
229
|
+
getExtensionArgs
|
|
443
230
|
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Alias
|
|
234
|
+
* @typedef {import('../extension/manifest').ExtensionType} ExtensionType
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* A tuple of argument aliases and argument options
|
|
239
|
+
* @typedef {Map<string[],import('argparse').ArgumentOptions>} ArgumentDefinitions
|
|
240
|
+
*/
|
|
@@ -1,27 +1,36 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import ExtensionCommand from './extension-command';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
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
|
+
* @extends {ExtensionCommand<import('../extension/manifest').DriverType>}
|
|
9
|
+
*/
|
|
8
10
|
export default class DriverCommand extends ExtensionCommand {
|
|
9
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @param {DriverCommandOptions} opts
|
|
14
|
+
*/
|
|
10
15
|
constructor ({config, json}) {
|
|
11
|
-
super({config, json
|
|
16
|
+
super({config, json});
|
|
12
17
|
this.knownExtensions = KNOWN_DRIVERS;
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
async install ({driver, installType, packageName}) {
|
|
16
|
-
return await super.
|
|
21
|
+
return await super._install({ext: driver, installType, packageName});
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
async uninstall ({driver}) {
|
|
20
|
-
return await super.
|
|
25
|
+
return await super._uninstall({ext: driver});
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
async update ({driver, unsafe}) {
|
|
24
|
-
return await super.
|
|
29
|
+
return await super._update({ext: driver, unsafe});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async run ({driver, scriptName}) {
|
|
33
|
+
return await super._run({ext: driver, scriptName});
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
getPostInstallText ({extName, extData}) {
|
|
@@ -43,3 +52,9 @@ export default class DriverCommand extends ExtensionCommand {
|
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @typedef DriverCommandOptions
|
|
58
|
+
* @property {import('../extension/extension-config').ExtensionConfig<import('../extension/manifest').DriverType>} config
|
|
59
|
+
* @property {boolean} json
|
|
60
|
+
*/
|