appium 2.0.0-beta.7 → 2.0.0-beta.70
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 +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 -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 +71 -60
- 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 +388 -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 +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 +275 -407
- package/lib/cli/driver-command.js +132 -24
- package/lib/cli/extension-command.js +751 -272
- package/lib/cli/extension.js +47 -20
- 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 +369 -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 +289 -167
- package/package.json +84 -83
- 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 -3594
- 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 -200
- 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 -14
- package/lib/cli/argparse-actions.js +0 -77
- package/lib/cli/npm.js +0 -175
- 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 -10
package/lib/cli/args.js
CHANGED
|
@@ -1,430 +1,298 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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';
|
|
6
13
|
const DRIVER_EXAMPLE = 'xcuitest';
|
|
7
14
|
const PLUGIN_EXAMPLE = 'find_by_image';
|
|
8
|
-
const USE_ALL_PLUGINS = 'all';
|
|
9
|
-
|
|
10
|
-
// sharedArgs will be added to every subcommand
|
|
11
|
-
const sharedArgs = [
|
|
12
|
-
[['-ah', '--home', '--appium-home'], {
|
|
13
|
-
required: false,
|
|
14
|
-
default: process.env.APPIUM_HOME || DEFAULT_APPIUM_HOME,
|
|
15
|
-
help: 'The path to the directory where Appium will keep installed drivers, plugins, and any other metadata necessary for its operation',
|
|
16
|
-
dest: 'appiumHome',
|
|
17
|
-
}],
|
|
18
|
-
|
|
19
|
-
[['--log-filters'], {
|
|
20
|
-
dest: 'logFilters',
|
|
21
|
-
default: null,
|
|
22
|
-
required: false,
|
|
23
|
-
action: 'store_true',
|
|
24
|
-
help: 'Set the full path to a JSON file containing one or more log filtering rules',
|
|
25
|
-
}],
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
const serverArgs = [
|
|
29
|
-
[['--shell'], {
|
|
30
|
-
required: false,
|
|
31
|
-
default: null,
|
|
32
|
-
help: 'Enter REPL mode',
|
|
33
|
-
action: 'store_true',
|
|
34
|
-
dest: 'shell',
|
|
35
|
-
}],
|
|
36
|
-
|
|
37
|
-
[['--plugins'], {
|
|
38
|
-
required: false,
|
|
39
|
-
default: [],
|
|
40
|
-
help: `A comma-separated list of installed plugin names that should be active for this ` +
|
|
41
|
-
`server. To activate all plugins, you can use the single string "${USE_ALL_PLUGINS}" ` +
|
|
42
|
-
`as the value (e.g. --plugins=${USE_ALL_PLUGINS})`,
|
|
43
|
-
type: parsePluginNames,
|
|
44
|
-
dest: 'plugins',
|
|
45
|
-
}],
|
|
46
|
-
|
|
47
|
-
[['--allow-cors'], {
|
|
48
|
-
required: false,
|
|
49
|
-
default: false,
|
|
50
|
-
action: 'store_true',
|
|
51
|
-
help: 'Whether the Appium server should allow web browser connections from any host',
|
|
52
|
-
dest: 'allowCors',
|
|
53
|
-
}],
|
|
54
|
-
|
|
55
|
-
[['--reboot'], {
|
|
56
|
-
default: false,
|
|
57
|
-
dest: 'reboot',
|
|
58
|
-
action: StoreDeprecatedDefaultCapabilityAction,
|
|
59
|
-
required: false,
|
|
60
|
-
help: '(Android-only) reboot emulator after each session and kill it at the end',
|
|
61
|
-
}],
|
|
62
|
-
|
|
63
|
-
[['-a', '--address'], {
|
|
64
|
-
default: '0.0.0.0',
|
|
65
|
-
required: false,
|
|
66
|
-
help: 'IP Address to listen on',
|
|
67
|
-
dest: 'address',
|
|
68
|
-
}],
|
|
69
|
-
|
|
70
|
-
[['-p', '--port'], {
|
|
71
|
-
default: 4723,
|
|
72
|
-
required: false,
|
|
73
|
-
type: 'int',
|
|
74
|
-
help: 'port to listen on',
|
|
75
|
-
dest: 'port',
|
|
76
|
-
}],
|
|
77
|
-
|
|
78
|
-
[['-pa', '--base-path'], {
|
|
79
|
-
required: false,
|
|
80
|
-
default: DEFAULT_BASE_PATH,
|
|
81
|
-
dest: 'basePath',
|
|
82
|
-
help: 'Base path to use as the prefix for all webdriver routes running ' +
|
|
83
|
-
`on this server`
|
|
84
|
-
}],
|
|
85
|
-
|
|
86
|
-
[['-ka', '--keep-alive-timeout'], {
|
|
87
|
-
required: false,
|
|
88
|
-
default: null,
|
|
89
|
-
dest: 'keepAliveTimeout',
|
|
90
|
-
type: 'int',
|
|
91
|
-
help: 'Number of seconds the Appium server should apply as both the keep-alive timeout ' +
|
|
92
|
-
'and the connection timeout for all requests. Defaults to 600 (10 minutes).'
|
|
93
|
-
}],
|
|
94
|
-
|
|
95
|
-
[['-ca', '--callback-address'], {
|
|
96
|
-
required: false,
|
|
97
|
-
dest: 'callbackAddress',
|
|
98
|
-
default: null,
|
|
99
|
-
help: 'callback IP Address (default: same as --address)',
|
|
100
|
-
}],
|
|
101
|
-
|
|
102
|
-
[['-cp', '--callback-port'], {
|
|
103
|
-
required: false,
|
|
104
|
-
dest: 'callbackPort',
|
|
105
|
-
default: null,
|
|
106
|
-
type: 'int',
|
|
107
|
-
help: 'callback port (default: same as port)',
|
|
108
|
-
}],
|
|
109
|
-
|
|
110
|
-
[['--session-override'], {
|
|
111
|
-
default: false,
|
|
112
|
-
dest: 'sessionOverride',
|
|
113
|
-
action: 'store_true',
|
|
114
|
-
required: false,
|
|
115
|
-
help: 'Enables session override (clobbering)',
|
|
116
|
-
}],
|
|
117
|
-
|
|
118
|
-
[['-g', '--log'], {
|
|
119
|
-
default: null,
|
|
120
|
-
dest: 'logFile',
|
|
121
|
-
required: false,
|
|
122
|
-
help: 'Also send log output to this file',
|
|
123
|
-
}],
|
|
124
|
-
|
|
125
|
-
[['--log-level'], {
|
|
126
|
-
choices: [
|
|
127
|
-
'info', 'info:debug', 'info:info', 'info:warn', 'info:error',
|
|
128
|
-
'warn', 'warn:debug', 'warn:info', 'warn:warn', 'warn:error',
|
|
129
|
-
'error', 'error:debug', 'error:info', 'error:warn', 'error:error',
|
|
130
|
-
'debug', 'debug:debug', 'debug:info', 'debug:warn', 'debug:error',
|
|
131
|
-
],
|
|
132
|
-
default: 'debug',
|
|
133
|
-
dest: 'loglevel',
|
|
134
|
-
required: false,
|
|
135
|
-
help: 'log level; default (console[:file]): debug[:debug]',
|
|
136
|
-
}],
|
|
137
|
-
|
|
138
|
-
[['--log-timestamp'], {
|
|
139
|
-
default: false,
|
|
140
|
-
required: false,
|
|
141
|
-
help: 'Show timestamps in console output',
|
|
142
|
-
action: 'store_true',
|
|
143
|
-
dest: 'logTimestamp',
|
|
144
|
-
}],
|
|
145
|
-
|
|
146
|
-
[['--local-timezone'], {
|
|
147
|
-
default: false,
|
|
148
|
-
required: false,
|
|
149
|
-
help: 'Use local timezone for timestamps',
|
|
150
|
-
action: 'store_true',
|
|
151
|
-
dest: 'localTimezone',
|
|
152
|
-
}],
|
|
153
15
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
dest: 'logNoColors',
|
|
160
|
-
}],
|
|
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];
|
|
161
21
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
required: false,
|
|
165
|
-
dest: 'webhook',
|
|
166
|
-
help: 'Also send log output to this HTTP listener, for example localhost:9876',
|
|
167
|
-
}],
|
|
168
|
-
|
|
169
|
-
[['--nodeconfig'], {
|
|
170
|
-
required: false,
|
|
171
|
-
default: null,
|
|
172
|
-
dest: 'nodeconfig',
|
|
173
|
-
help: 'Configuration JSON file to register appium with selenium grid',
|
|
174
|
-
}],
|
|
175
|
-
|
|
176
|
-
[['--chromedriver-port'], {
|
|
177
|
-
default: null,
|
|
178
|
-
dest: 'chromeDriverPort',
|
|
179
|
-
required: false,
|
|
180
|
-
action: StoreDeprecatedDefaultCapabilityAction,
|
|
181
|
-
type: 'int',
|
|
182
|
-
help: 'Port upon which ChromeDriver will run. If not given, Android driver will pick a random available port.',
|
|
183
|
-
}],
|
|
184
|
-
|
|
185
|
-
[['--chromedriver-executable'], {
|
|
186
|
-
default: null,
|
|
187
|
-
dest: 'chromedriverExecutable',
|
|
188
|
-
action: StoreDeprecatedDefaultCapabilityAction,
|
|
189
|
-
required: false,
|
|
190
|
-
help: 'ChromeDriver executable full path',
|
|
191
|
-
}],
|
|
192
|
-
|
|
193
|
-
[['--show-config'], {
|
|
194
|
-
default: false,
|
|
195
|
-
dest: 'showConfig',
|
|
196
|
-
action: 'store_true',
|
|
197
|
-
required: false,
|
|
198
|
-
help: 'Show info about the appium server configuration and exit',
|
|
199
|
-
}],
|
|
200
|
-
|
|
201
|
-
[['--no-perms-check'], {
|
|
202
|
-
default: false,
|
|
203
|
-
dest: 'noPermsCheck',
|
|
204
|
-
action: 'store_true',
|
|
205
|
-
required: false,
|
|
206
|
-
help: 'Bypass Appium\'s checks to ensure we can read/write necessary files',
|
|
207
|
-
}],
|
|
208
|
-
|
|
209
|
-
[['--strict-caps'], {
|
|
210
|
-
default: false,
|
|
211
|
-
dest: 'enforceStrictCaps',
|
|
212
|
-
action: 'store_true',
|
|
213
|
-
required: false,
|
|
214
|
-
help: 'Cause sessions to fail if desired caps are sent in that Appium ' +
|
|
215
|
-
'does not recognize as valid for the selected device',
|
|
216
|
-
}],
|
|
217
|
-
|
|
218
|
-
[['--tmp'], {
|
|
219
|
-
default: null,
|
|
220
|
-
dest: 'tmpDir',
|
|
221
|
-
required: false,
|
|
222
|
-
help: 'Absolute path to directory Appium can use to manage temporary ' +
|
|
223
|
-
'files, like built-in iOS apps it needs to move around. On *nix/Mac ' +
|
|
224
|
-
'defaults to /tmp, on Windows defaults to C:\\Windows\\Temp',
|
|
225
|
-
}],
|
|
226
|
-
|
|
227
|
-
[['--trace-dir'], {
|
|
228
|
-
default: null,
|
|
229
|
-
dest: 'traceDir',
|
|
230
|
-
required: false,
|
|
231
|
-
help: 'Absolute path to directory Appium use to save ios instruments ' +
|
|
232
|
-
'traces, defaults to <tmp dir>/appium-instruments',
|
|
233
|
-
}],
|
|
234
|
-
|
|
235
|
-
[['--debug-log-spacing'], {
|
|
236
|
-
dest: 'debugLogSpacing',
|
|
237
|
-
default: false,
|
|
238
|
-
action: 'store_true',
|
|
239
|
-
required: false,
|
|
240
|
-
help: 'Add exaggerated spacing in logs to help with visual inspection',
|
|
241
|
-
}],
|
|
242
|
-
|
|
243
|
-
[['--suppress-adb-kill-server'], {
|
|
244
|
-
dest: 'suppressKillServer',
|
|
245
|
-
default: false,
|
|
246
|
-
action: StoreDeprecatedDefaultCapabilityAction,
|
|
247
|
-
required: false,
|
|
248
|
-
help: '(Android-only) If set, prevents Appium from killing the adb server instance',
|
|
249
|
-
}],
|
|
250
|
-
|
|
251
|
-
[['--long-stacktrace'], {
|
|
252
|
-
dest: 'longStacktrace',
|
|
253
|
-
default: false,
|
|
254
|
-
required: false,
|
|
255
|
-
action: 'store_true',
|
|
256
|
-
help: 'Add long stack traces to log entries. Recommended for debugging only.',
|
|
257
|
-
}],
|
|
258
|
-
|
|
259
|
-
[['--webkit-debug-proxy-port'], {
|
|
260
|
-
default: 27753,
|
|
261
|
-
dest: 'webkitDebugProxyPort',
|
|
262
|
-
action: StoreDeprecatedDefaultCapabilityAction,
|
|
263
|
-
required: false,
|
|
264
|
-
type: 'int',
|
|
265
|
-
help: '(IOS-only) Local port used for communication with ios-webkit-debug-proxy'
|
|
266
|
-
}],
|
|
267
|
-
|
|
268
|
-
[['--webdriveragent-port'], {
|
|
269
|
-
default: 8100,
|
|
270
|
-
dest: 'wdaLocalPort',
|
|
271
|
-
action: StoreDeprecatedDefaultCapabilityAction,
|
|
272
|
-
required: false,
|
|
273
|
-
type: 'int',
|
|
274
|
-
help: '(IOS-only, XCUITest-only) Local port used for communication with WebDriverAgent'
|
|
275
|
-
}],
|
|
276
|
-
|
|
277
|
-
[['-dc', DEFAULT_CAPS_ARG], {
|
|
278
|
-
dest: 'defaultCapabilities',
|
|
279
|
-
default: {},
|
|
280
|
-
type: parseDefaultCaps,
|
|
281
|
-
required: false,
|
|
282
|
-
help: 'Set the default desired capabilities, which will be set on each ' +
|
|
283
|
-
'session unless overridden by received capabilities. For example: ' +
|
|
284
|
-
'[ \'{"app": "myapp.app", "deviceName": "iPhone Simulator"}\' ' +
|
|
285
|
-
'| /path/to/caps.json ]'
|
|
286
|
-
}],
|
|
287
|
-
|
|
288
|
-
[['--relaxed-security'], {
|
|
289
|
-
default: false,
|
|
290
|
-
dest: 'relaxedSecurityEnabled',
|
|
291
|
-
action: 'store_true',
|
|
292
|
-
required: false,
|
|
293
|
-
help: 'Disable additional security checks, so it is possible to use some advanced features, provided ' +
|
|
294
|
-
'by drivers supporting this option. Only enable it if all the ' +
|
|
295
|
-
'clients are in the trusted network and it\'s not the case if a client could potentially ' +
|
|
296
|
-
'break out of the session sandbox. Specific features can be overridden by ' +
|
|
297
|
-
'using the --deny-insecure flag',
|
|
298
|
-
}],
|
|
299
|
-
|
|
300
|
-
[['--allow-insecure'], {
|
|
301
|
-
dest: 'allowInsecure',
|
|
302
|
-
default: [],
|
|
303
|
-
type: parseSecurityFeatures,
|
|
304
|
-
required: false,
|
|
305
|
-
help: 'Set which insecure features are allowed to run in this server\'s sessions. ' +
|
|
306
|
-
'Features are defined on a driver level; see documentation for more details. ' +
|
|
307
|
-
'This should be either a comma-separated list of feature names, or a path to ' +
|
|
308
|
-
'a file where each feature name is on a line. Note that features defined via ' +
|
|
309
|
-
'--deny-insecure will be disabled, even if also listed here.',
|
|
310
|
-
}],
|
|
311
|
-
|
|
312
|
-
[['--deny-insecure'], {
|
|
313
|
-
dest: 'denyInsecure',
|
|
314
|
-
default: [],
|
|
315
|
-
type: parseSecurityFeatures,
|
|
316
|
-
required: false,
|
|
317
|
-
help: 'Set which insecure features are not allowed to run in this server\'s sessions. ' +
|
|
318
|
-
'Features are defined on a driver level; see documentation for more details. ' +
|
|
319
|
-
'This should be either a comma-separated list of feature names, or a path to ' +
|
|
320
|
-
'a file where each feature name is on a line. Features listed here will not be ' +
|
|
321
|
-
'enabled even if also listed in --allow-insecure, and even if --relaxed-security ' +
|
|
322
|
-
'is turned on. For example: execute_driver_script,adb_shell',
|
|
323
|
-
}],
|
|
324
|
-
];
|
|
22
|
+
/** @type {Set<ExtensionType>} */
|
|
23
|
+
const EXTENSION_TYPES = new Set([DRIVER_TYPE, PLUGIN_TYPE]);
|
|
325
24
|
|
|
326
25
|
// this set of args works for both drivers and plugins ('extensions')
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
help: 'Use JSON for output format',
|
|
333
|
-
dest: 'json'
|
|
334
|
-
}]
|
|
335
|
-
];
|
|
336
|
-
|
|
337
|
-
const extensionArgs = {[DRIVER_TYPE]: {}, [PLUGIN_TYPE]: {}};
|
|
338
|
-
|
|
339
|
-
function makeListArgs (type) {
|
|
340
|
-
return [
|
|
341
|
-
...globalExtensionArgs,
|
|
342
|
-
[['--installed'], {
|
|
26
|
+
/** @type {ArgumentDefinitions} */
|
|
27
|
+
const globalExtensionArgs = new Map([
|
|
28
|
+
[
|
|
29
|
+
['--json'],
|
|
30
|
+
{
|
|
343
31
|
required: false,
|
|
344
32
|
default: false,
|
|
345
33
|
action: 'store_true',
|
|
346
|
-
help:
|
|
347
|
-
dest: '
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
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
|
+
]);
|
|
357
98
|
}
|
|
358
99
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
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([
|
|
362
107
|
...globalExtensionArgs,
|
|
363
|
-
[
|
|
364
|
-
type
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
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
|
+
]);
|
|
386
144
|
}
|
|
387
145
|
|
|
388
|
-
|
|
389
|
-
|
|
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([
|
|
390
153
|
...globalExtensionArgs,
|
|
391
|
-
[
|
|
392
|
-
type
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
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
|
+
]);
|
|
397
165
|
}
|
|
398
166
|
|
|
399
|
-
|
|
400
|
-
|
|
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([
|
|
401
174
|
...globalExtensionArgs,
|
|
402
|
-
[
|
|
403
|
-
type
|
|
404
|
-
|
|
175
|
+
[
|
|
176
|
+
[type],
|
|
177
|
+
{
|
|
178
|
+
type: 'str',
|
|
179
|
+
help:
|
|
180
|
+
`Name of the ${type} to update, or the word "installed" to update all installed ` +
|
|
405
181
|
`${type}s. To see available updates, run "appium ${type} list --installed --updates". ` +
|
|
406
|
-
'For example: ' +
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
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
|
+
]);
|
|
201
|
+
}
|
|
202
|
+
|
|
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([
|
|
210
|
+
...globalExtensionArgs,
|
|
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
|
+
]);
|
|
416
232
|
}
|
|
417
233
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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]);
|
|
423
241
|
}
|
|
424
242
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
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<[name: string]|[name: string, alias: string],import('argparse').ArgumentOptions>} ArgumentDefinitions
|
|
298
|
+
*/
|