appium 2.0.0-beta.6 → 2.0.0-beta.61
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 +156 -65
- package/build/lib/appium.d.ts +229 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +678 -439
- 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 -319
- 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 +71 -54
- 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 +240 -128
- 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 +267 -202
- 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 +190 -187
- 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 +339 -229
- 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 +217 -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 +266 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +349 -273
- 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 +558 -186
- package/lib/cli/args.js +277 -422
- package/lib/cli/driver-command.js +132 -24
- package/lib/cli/extension-command.js +751 -272
- package/lib/cli/extension.js +49 -18
- package/lib/cli/parser.js +263 -83
- 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 +246 -111
- 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 +64 -38
- package/lib/main.js +318 -103
- package/lib/schema/arg-spec.js +229 -0
- package/lib/schema/cli-args.js +238 -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 +289 -167
- 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 -3515
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/npm.js +0 -208
- 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 -253
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -14
- package/lib/cli/npm.js +0 -184
- 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 -209
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -10
package/lib/cli/args.js
CHANGED
|
@@ -1,443 +1,298 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import _ from 'lodash';
|
|
2
|
+
import {
|
|
3
|
+
DRIVER_TYPE,
|
|
4
|
+
PLUGIN_TYPE,
|
|
5
|
+
EXT_SUBCOMMAND_INSTALL,
|
|
6
|
+
EXT_SUBCOMMAND_LIST,
|
|
7
|
+
EXT_SUBCOMMAND_RUN,
|
|
8
|
+
EXT_SUBCOMMAND_UNINSTALL,
|
|
9
|
+
EXT_SUBCOMMAND_UPDATE,
|
|
10
|
+
} from '../constants';
|
|
11
|
+
import {INSTALL_TYPES} from '../extension/extension-config';
|
|
12
|
+
import {toParserArgs} from '../schema/cli-args';
|
|
5
13
|
const DRIVER_EXAMPLE = 'xcuitest';
|
|
6
14
|
const PLUGIN_EXAMPLE = 'find_by_image';
|
|
7
|
-
const USE_ALL_PLUGINS = 'all';
|
|
8
|
-
|
|
9
|
-
// sharedArgs will be added to every subcommand
|
|
10
|
-
const sharedArgs = [
|
|
11
|
-
[['-ah', '--home', '--appium-home'], {
|
|
12
|
-
required: false,
|
|
13
|
-
defaultValue: process.env.APPIUM_HOME || DEFAULT_APPIUM_HOME,
|
|
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
|
-
}],
|
|
212
|
-
|
|
213
|
-
[['--strict-caps'], {
|
|
214
|
-
defaultValue: false,
|
|
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
15
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
example: '8100',
|
|
280
|
-
help: '(IOS-only, XCUITest-only) Local port used for communication with WebDriverAgent'
|
|
281
|
-
}],
|
|
16
|
+
/**
|
|
17
|
+
* This is necessary because we pass the array into `argparse`. `argparse` is bad and mutates things. We don't want that.
|
|
18
|
+
* Bad `argparse`! Bad!
|
|
19
|
+
*/
|
|
20
|
+
const INSTALL_TYPES_ARRAY = [...INSTALL_TYPES];
|
|
282
21
|
|
|
283
|
-
|
|
284
|
-
|
|
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
|
-
];
|
|
22
|
+
/** @type {Set<ExtensionType>} */
|
|
23
|
+
const EXTENSION_TYPES = new Set([DRIVER_TYPE, PLUGIN_TYPE]);
|
|
334
24
|
|
|
335
25
|
// this set of args works for both drivers and plugins ('extensions')
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
help: 'Use JSON for output format',
|
|
342
|
-
nargs: 0,
|
|
343
|
-
dest: 'json'
|
|
344
|
-
}]
|
|
345
|
-
];
|
|
346
|
-
|
|
347
|
-
const extensionArgs = {[DRIVER_TYPE]: {}, [PLUGIN_TYPE]: {}};
|
|
348
|
-
|
|
349
|
-
function makeListArgs (type) {
|
|
350
|
-
return [
|
|
351
|
-
...globalExtensionArgs,
|
|
352
|
-
[['--installed'], {
|
|
26
|
+
/** @type {ArgumentDefinitions} */
|
|
27
|
+
const globalExtensionArgs = new Map([
|
|
28
|
+
[
|
|
29
|
+
['--json'],
|
|
30
|
+
{
|
|
353
31
|
required: false,
|
|
354
|
-
|
|
355
|
-
action: '
|
|
356
|
-
help:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
32
|
+
default: false,
|
|
33
|
+
action: 'store_true',
|
|
34
|
+
help: 'Use JSON for output format',
|
|
35
|
+
dest: 'json',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Builds a Record of extension types to a Record of subcommands to their argument definitions
|
|
42
|
+
*/
|
|
43
|
+
const getExtensionArgs = _.memoize(function getExtensionArgs() {
|
|
44
|
+
const extensionArgs = {};
|
|
45
|
+
for (const type of EXTENSION_TYPES) {
|
|
46
|
+
extensionArgs[type] = {
|
|
47
|
+
[EXT_SUBCOMMAND_LIST]: makeListArgs(type),
|
|
48
|
+
[EXT_SUBCOMMAND_INSTALL]: makeInstallArgs(type),
|
|
49
|
+
[EXT_SUBCOMMAND_UNINSTALL]: makeUninstallArgs(type),
|
|
50
|
+
[EXT_SUBCOMMAND_UPDATE]: makeUpdateArgs(type),
|
|
51
|
+
[EXT_SUBCOMMAND_RUN]: makeRunArgs(type),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return /** @type {Record<ExtensionType, Record<import('appium/types').CliExtensionSubcommand,ArgumentDefinitions>>} */ (
|
|
55
|
+
extensionArgs
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Makes the opts for the `list` subcommand for each extension type.
|
|
61
|
+
* @param {ExtensionType} type
|
|
62
|
+
* @returns {ArgumentDefinitions}
|
|
63
|
+
*/
|
|
64
|
+
function makeListArgs(type) {
|
|
65
|
+
return new Map([
|
|
66
|
+
...globalExtensionArgs,
|
|
67
|
+
[
|
|
68
|
+
['--installed'],
|
|
69
|
+
{
|
|
70
|
+
required: false,
|
|
71
|
+
default: false,
|
|
72
|
+
action: 'store_true',
|
|
73
|
+
help: `List only installed ${type}s`,
|
|
74
|
+
dest: 'showInstalled',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
[
|
|
78
|
+
['--updates'],
|
|
79
|
+
{
|
|
80
|
+
required: false,
|
|
81
|
+
default: false,
|
|
82
|
+
action: 'store_true',
|
|
83
|
+
help: 'Show information about newer versions',
|
|
84
|
+
dest: 'showUpdates',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
['--verbose'],
|
|
89
|
+
{
|
|
90
|
+
required: false,
|
|
91
|
+
default: false,
|
|
92
|
+
action: 'store_true',
|
|
93
|
+
help: 'Show more information about each extension',
|
|
94
|
+
dest: 'verbose',
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
]);
|
|
369
98
|
}
|
|
370
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Makes the opts for the `install` subcommand for each extension type
|
|
102
|
+
* @param {ExtensionType} type
|
|
103
|
+
* @returns {ArgumentDefinitions}
|
|
104
|
+
*/
|
|
105
|
+
function makeInstallArgs(type) {
|
|
106
|
+
return new Map([
|
|
107
|
+
...globalExtensionArgs,
|
|
108
|
+
[
|
|
109
|
+
[type],
|
|
110
|
+
{
|
|
111
|
+
type: 'str',
|
|
112
|
+
help:
|
|
113
|
+
`Name of the ${type} to install, for example: ` + type === DRIVER_TYPE
|
|
114
|
+
? DRIVER_EXAMPLE
|
|
115
|
+
: PLUGIN_EXAMPLE,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
[
|
|
119
|
+
['--source'],
|
|
120
|
+
{
|
|
121
|
+
required: false,
|
|
122
|
+
default: null,
|
|
123
|
+
choices: INSTALL_TYPES_ARRAY,
|
|
124
|
+
help:
|
|
125
|
+
`Where to look for the ${type} if it is not one of Appium's verified ` +
|
|
126
|
+
`${type}s. Possible values: ${INSTALL_TYPES_ARRAY.join(', ')}`,
|
|
127
|
+
dest: 'installType',
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
[
|
|
131
|
+
['--package'],
|
|
132
|
+
{
|
|
133
|
+
required: false,
|
|
134
|
+
default: null,
|
|
135
|
+
type: 'str',
|
|
136
|
+
help:
|
|
137
|
+
`If installing from Git or GitHub, the package name, as defined in the plugin's ` +
|
|
138
|
+
`package.json file in the "name" field, cannot be determined automatically, and ` +
|
|
139
|
+
`should be reported here, otherwise the install will probably fail.`,
|
|
140
|
+
dest: 'packageName',
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
]);
|
|
144
|
+
}
|
|
371
145
|
|
|
372
|
-
|
|
373
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Makes the opts for the `uninstall` subcommand for each extension type
|
|
148
|
+
* @param {ExtensionType} type
|
|
149
|
+
* @returns {ArgumentDefinitions}
|
|
150
|
+
*/
|
|
151
|
+
function makeUninstallArgs(type) {
|
|
152
|
+
return new Map([
|
|
374
153
|
...globalExtensionArgs,
|
|
375
|
-
[
|
|
376
|
-
type
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
dest: 'installType'
|
|
387
|
-
}],
|
|
388
|
-
[['--package'], {
|
|
389
|
-
required: false,
|
|
390
|
-
defaultValue: null,
|
|
391
|
-
type: 'string',
|
|
392
|
-
help: `If installing from Git or GitHub, the package name, as defined in the plugin's ` +
|
|
393
|
-
`package.json file in the "name" field, cannot be determined automatically, and ` +
|
|
394
|
-
`should be reported here, otherwise the install will probably fail.`,
|
|
395
|
-
dest: 'packageName',
|
|
396
|
-
}],
|
|
397
|
-
];
|
|
154
|
+
[
|
|
155
|
+
[type],
|
|
156
|
+
{
|
|
157
|
+
type: 'str',
|
|
158
|
+
help:
|
|
159
|
+
'Name of the driver to uninstall, for example: ' + type === DRIVER_TYPE
|
|
160
|
+
? DRIVER_EXAMPLE
|
|
161
|
+
: PLUGIN_EXAMPLE,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
]);
|
|
398
165
|
}
|
|
399
166
|
|
|
400
|
-
|
|
401
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Makes the opts for the `update` subcommand for each extension type
|
|
169
|
+
* @param {ExtensionType} type
|
|
170
|
+
* @returns {ArgumentDefinitions}
|
|
171
|
+
*/
|
|
172
|
+
function makeUpdateArgs(type) {
|
|
173
|
+
return new Map([
|
|
402
174
|
...globalExtensionArgs,
|
|
403
|
-
[
|
|
404
|
-
type
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
175
|
+
[
|
|
176
|
+
[type],
|
|
177
|
+
{
|
|
178
|
+
type: 'str',
|
|
179
|
+
help:
|
|
180
|
+
`Name of the ${type} to update, or the word "installed" to update all installed ` +
|
|
181
|
+
`${type}s. To see available updates, run "appium ${type} list --installed --updates". ` +
|
|
182
|
+
'For example: ' +
|
|
183
|
+
type ===
|
|
184
|
+
DRIVER_TYPE
|
|
185
|
+
? DRIVER_EXAMPLE
|
|
186
|
+
: PLUGIN_EXAMPLE,
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
['--unsafe'],
|
|
191
|
+
{
|
|
192
|
+
required: false,
|
|
193
|
+
default: false,
|
|
194
|
+
action: 'store_true',
|
|
195
|
+
help:
|
|
196
|
+
`Include updates that might have a new major revision, and potentially include ` +
|
|
197
|
+
`breaking changes`,
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
]);
|
|
409
201
|
}
|
|
410
202
|
|
|
411
|
-
|
|
412
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Makes the opts for the `run` subcommand for each extension type
|
|
205
|
+
* @param {ExtensionType} type
|
|
206
|
+
* @returns {ArgumentDefinitions}
|
|
207
|
+
*/
|
|
208
|
+
function makeRunArgs(type) {
|
|
209
|
+
return new Map([
|
|
413
210
|
...globalExtensionArgs,
|
|
414
|
-
[
|
|
415
|
-
type
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
211
|
+
[
|
|
212
|
+
[type],
|
|
213
|
+
{
|
|
214
|
+
type: 'str',
|
|
215
|
+
help:
|
|
216
|
+
`Name of the ${type} to run a script from, for example: ` + type === DRIVER_TYPE
|
|
217
|
+
? DRIVER_EXAMPLE
|
|
218
|
+
: PLUGIN_EXAMPLE,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
[
|
|
222
|
+
['scriptName'],
|
|
223
|
+
{
|
|
224
|
+
default: null,
|
|
225
|
+
type: 'str',
|
|
226
|
+
help:
|
|
227
|
+
`Name of the script to run from the ${type}. The script name must be a key ` +
|
|
228
|
+
`inside the "appium.scripts" field inside the ${type}'s "package.json" file`,
|
|
229
|
+
},
|
|
230
|
+
],
|
|
231
|
+
]);
|
|
429
232
|
}
|
|
430
233
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
234
|
+
/**
|
|
235
|
+
* Derives the options for the `server` command from the schema, and adds the arguments
|
|
236
|
+
* which are disallowed in the config file.
|
|
237
|
+
* @returns {ArgumentDefinitions}
|
|
238
|
+
*/
|
|
239
|
+
function getServerArgs() {
|
|
240
|
+
return new Map([...toParserArgs(), ...serverArgsDisallowedInConfig]);
|
|
436
241
|
}
|
|
437
242
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
243
|
+
/**
|
|
244
|
+
* These don't make sense in the context of a config file for obvious reasons.
|
|
245
|
+
* @type {ArgumentDefinitions}
|
|
246
|
+
*/
|
|
247
|
+
const serverArgsDisallowedInConfig = new Map([
|
|
248
|
+
[
|
|
249
|
+
['--shell'],
|
|
250
|
+
{
|
|
251
|
+
required: false,
|
|
252
|
+
help: 'Enter REPL mode',
|
|
253
|
+
action: 'store_const',
|
|
254
|
+
const: true,
|
|
255
|
+
dest: 'shell',
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
[
|
|
259
|
+
['--show-build-info'],
|
|
260
|
+
{
|
|
261
|
+
dest: 'showBuildInfo',
|
|
262
|
+
action: 'store_const',
|
|
263
|
+
const: true,
|
|
264
|
+
required: false,
|
|
265
|
+
help: 'Show info about the Appium build and exit',
|
|
266
|
+
},
|
|
267
|
+
],
|
|
268
|
+
[
|
|
269
|
+
['--show-config'],
|
|
270
|
+
{
|
|
271
|
+
dest: 'showConfig',
|
|
272
|
+
action: 'store_const',
|
|
273
|
+
const: true,
|
|
274
|
+
required: false,
|
|
275
|
+
help: 'Show the current Appium configuration and exit',
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
['--config'],
|
|
280
|
+
{
|
|
281
|
+
dest: 'configFile',
|
|
282
|
+
type: 'str',
|
|
283
|
+
required: false,
|
|
284
|
+
help: 'Explicit path to Appium configuration file',
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
]);
|
|
288
|
+
|
|
289
|
+
export {getServerArgs, getExtensionArgs};
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* @typedef {import('@appium/types').ExtensionType} ExtensionType
|
|
293
|
+
*/
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* A tuple of argument aliases and argument options
|
|
297
|
+
* @typedef {Map<string[],import('argparse').ArgumentOptions>} ArgumentDefinitions
|
|
298
|
+
*/
|