appium 2.0.0-beta.34 → 2.0.0-beta.38

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.
Files changed (123) hide show
  1. package/build/lib/appium.d.ts +41 -52
  2. package/build/lib/appium.d.ts.map +1 -1
  3. package/build/lib/appium.js +32 -15
  4. package/build/lib/cli/args.d.ts +1 -1
  5. package/build/lib/cli/args.d.ts.map +1 -1
  6. package/build/lib/cli/args.js +1 -1
  7. package/build/lib/cli/driver-command.d.ts +5 -5
  8. package/build/lib/cli/driver-command.d.ts.map +1 -1
  9. package/build/lib/cli/driver-command.js +8 -8
  10. package/build/lib/cli/extension-command.d.ts +78 -51
  11. package/build/lib/cli/extension-command.d.ts.map +1 -1
  12. package/build/lib/cli/extension-command.js +135 -80
  13. package/build/lib/cli/extension.d.ts +9 -5
  14. package/build/lib/cli/extension.d.ts.map +1 -1
  15. package/build/lib/cli/extension.js +5 -7
  16. package/build/lib/cli/parser.d.ts +3 -3
  17. package/build/lib/cli/parser.d.ts.map +1 -1
  18. package/build/lib/cli/parser.js +1 -1
  19. package/build/lib/cli/plugin-command.d.ts +9 -15
  20. package/build/lib/cli/plugin-command.d.ts.map +1 -1
  21. package/build/lib/cli/plugin-command.js +8 -8
  22. package/build/lib/cli/utils.js +1 -1
  23. package/build/lib/config-file.d.ts.map +1 -1
  24. package/build/lib/config-file.js +1 -1
  25. package/build/lib/config.d.ts +4 -4
  26. package/build/lib/config.d.ts.map +1 -1
  27. package/build/lib/config.js +1 -1
  28. package/build/lib/constants.d.ts.map +1 -1
  29. package/build/lib/constants.js +1 -1
  30. package/build/lib/extension/driver-config.d.ts +29 -32
  31. package/build/lib/extension/driver-config.d.ts.map +1 -1
  32. package/build/lib/extension/driver-config.js +7 -20
  33. package/build/lib/extension/extension-config.d.ts +108 -36
  34. package/build/lib/extension/extension-config.d.ts.map +1 -1
  35. package/build/lib/extension/extension-config.js +199 -60
  36. package/build/lib/extension/index.d.ts +16 -7
  37. package/build/lib/extension/index.d.ts.map +1 -1
  38. package/build/lib/extension/index.js +15 -18
  39. package/build/lib/extension/manifest.d.ts +12 -12
  40. package/build/lib/extension/manifest.d.ts.map +1 -1
  41. package/build/lib/extension/manifest.js +13 -3
  42. package/build/lib/extension/package-changed.d.ts.map +1 -1
  43. package/build/lib/extension/package-changed.js +1 -1
  44. package/build/lib/extension/plugin-config.d.ts +19 -24
  45. package/build/lib/extension/plugin-config.d.ts.map +1 -1
  46. package/build/lib/extension/plugin-config.js +9 -18
  47. package/build/lib/grid-register.d.ts.map +1 -1
  48. package/build/lib/grid-register.js +1 -1
  49. package/build/lib/logger.d.ts +1 -1
  50. package/build/lib/logger.d.ts.map +1 -1
  51. package/build/lib/logger.js +1 -1
  52. package/build/lib/logsink.d.ts.map +1 -1
  53. package/build/lib/logsink.js +3 -2
  54. package/build/lib/main.d.ts +13 -12
  55. package/build/lib/main.d.ts.map +1 -1
  56. package/build/lib/main.js +4 -4
  57. package/build/lib/schema/arg-spec.d.ts +4 -4
  58. package/build/lib/schema/arg-spec.d.ts.map +1 -1
  59. package/build/lib/schema/arg-spec.js +1 -1
  60. package/build/lib/schema/cli-args.d.ts.map +1 -1
  61. package/build/lib/schema/cli-args.js +1 -1
  62. package/build/lib/schema/cli-transformers.d.ts.map +1 -1
  63. package/build/lib/schema/cli-transformers.js +1 -1
  64. package/build/lib/schema/keywords.d.ts.map +1 -1
  65. package/build/lib/schema/keywords.js +1 -1
  66. package/build/lib/schema/schema.d.ts +2 -2
  67. package/build/lib/schema/schema.d.ts.map +1 -1
  68. package/build/lib/schema/schema.js +1 -1
  69. package/build/lib/utils.d.ts.map +1 -1
  70. package/build/lib/utils.js +1 -1
  71. package/build/tsconfig.tsbuildinfo +1 -1
  72. package/build/types/appium-manifest.d.ts +23 -4
  73. package/build/types/appium-manifest.d.ts.map +1 -1
  74. package/build/types/cli.d.ts.map +1 -1
  75. package/build/types/{external-manifest.d.ts → extension-manifest.d.ts} +15 -7
  76. package/build/types/extension-manifest.d.ts.map +1 -0
  77. package/build/types/index.d.ts +6 -5
  78. package/build/types/index.d.ts.map +1 -1
  79. package/driver.d.ts +1 -0
  80. package/driver.js +14 -0
  81. package/lib/appium.js +208 -124
  82. package/lib/cli/args.js +143 -93
  83. package/lib/cli/driver-command.js +46 -26
  84. package/lib/cli/extension-command.js +314 -157
  85. package/lib/cli/extension.js +15 -19
  86. package/lib/cli/parser.js +19 -31
  87. package/lib/cli/plugin-command.js +39 -24
  88. package/lib/cli/utils.js +8 -14
  89. package/lib/config-file.js +21 -25
  90. package/lib/config.js +82 -64
  91. package/lib/constants.js +4 -13
  92. package/lib/extension/driver-config.js +171 -171
  93. package/lib/extension/extension-config.js +347 -126
  94. package/lib/extension/index.js +72 -58
  95. package/lib/extension/manifest.js +48 -57
  96. package/lib/extension/package-changed.js +9 -8
  97. package/lib/extension/plugin-config.js +62 -62
  98. package/lib/grid-register.js +29 -18
  99. package/lib/logger.js +1 -2
  100. package/lib/logsink.js +29 -31
  101. package/lib/main.js +111 -73
  102. package/lib/schema/arg-spec.js +10 -13
  103. package/lib/schema/cli-args.js +14 -37
  104. package/lib/schema/cli-transformers.js +7 -14
  105. package/lib/schema/keywords.js +15 -13
  106. package/lib/schema/schema.js +58 -75
  107. package/lib/utils.js +50 -25
  108. package/package.json +25 -18
  109. package/plugin.d.ts +1 -0
  110. package/plugin.js +13 -0
  111. package/scripts/autoinstall-extensions.js +177 -0
  112. package/support.d.ts +1 -0
  113. package/support.js +13 -0
  114. package/types/appium-manifest.ts +27 -15
  115. package/types/cli.ts +2 -9
  116. package/types/{external-manifest.ts → extension-manifest.ts} +21 -15
  117. package/types/index.ts +12 -5
  118. package/build/types/extension.d.ts +0 -43
  119. package/build/types/extension.d.ts.map +0 -1
  120. package/build/types/external-manifest.d.ts.map +0 -1
  121. package/lib/appium-config.schema.json +0 -278
  122. package/scripts/postinstall.js +0 -71
  123. package/types/extension.ts +0 -56
@@ -1,278 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema",
3
- "additionalProperties": false,
4
- "description": "A schema for Appium configuration files",
5
- "properties": {
6
- "server": {
7
- "additionalProperties": false,
8
- "description": "Configuration when running Appium as a server",
9
- "properties": {
10
- "address": {
11
- "$comment": "I think hostname covers both DNS and IPv4...could be wrong",
12
- "appiumCliAliases": [
13
- "a"
14
- ],
15
- "default": "0.0.0.0",
16
- "description": "IP address to listen on",
17
- "format": "hostname",
18
- "title": "address config",
19
- "type": "string"
20
- },
21
- "allow-cors": {
22
- "description": "Whether the Appium server should allow web browser connections from any host",
23
- "title": "allow-cors config",
24
- "type": "boolean",
25
- "default": false
26
- },
27
- "allow-insecure": {
28
- "appiumCliTransformer": "csv",
29
- "default": [],
30
- "description": "Set which insecure features are allowed to run in this server's sessions. Features are defined on a driver level; see documentation for more details. Note that features defined via \"deny-insecure\" will be disabled, even if also listed here. If string, a path to a text file containing policy or a comma-delimited list.",
31
- "items": {
32
- "type": "string"
33
- },
34
- "title": "allow-insecure config",
35
- "type": "array",
36
- "uniqueItems": true
37
- },
38
- "base-path": {
39
- "appiumCliAliases": [
40
- "pa"
41
- ],
42
- "default": "",
43
- "description": "Base path to use as the prefix for all webdriver routes running on the server",
44
- "title": "base-path config",
45
- "type": "string"
46
- },
47
- "callback-address": {
48
- "appiumCliAliases": [
49
- "ca"
50
- ],
51
- "description": "Callback IP address (default: same as \"address\")",
52
- "title": "callback-address config",
53
- "type": "string"
54
- },
55
- "callback-port": {
56
- "appiumCliAliases": [
57
- "cp"
58
- ],
59
- "default": 4723,
60
- "description": "Callback port (default: same as \"port\")",
61
- "maximum": 65535,
62
- "minimum": 1,
63
- "title": "callback-port config",
64
- "type": "integer"
65
- },
66
- "debug-log-spacing": {
67
- "default": false,
68
- "description": "Add exaggerated spacing in logs to help with visual inspection",
69
- "title": "debug-log-spacing config",
70
- "type": "boolean"
71
- },
72
- "default-capabilities": {
73
- "$comment": "TODO",
74
- "appiumCliAliases": [
75
- "dc"
76
- ],
77
- "description": "Set the default desired capabilities, which will be set on each session unless overridden by received capabilities. If a string, a path to a JSON file containing the capabilities, or raw JSON.",
78
- "title": "default-capabilities config",
79
- "type": "object"
80
- },
81
- "deny-insecure": {
82
- "$comment": "Allowed values are defined by drivers",
83
- "appiumCliTransformer": "csv",
84
- "default": [],
85
- "description": "Set which insecure features are not allowed to run in this server's sessions. Features are defined on a driver level; see documentation for more details. Features listed here will not be enabled even if also listed in \"allow-insecure\", and even if \"relaxed-security\" is enabled. If string, a path to a text file containing policy or a comma-delimited list.",
86
- "items": {
87
- "type": "string"
88
- },
89
- "title": "deny-insecure config",
90
- "type": "array",
91
- "uniqueItems": true
92
- },
93
- "driver": {
94
- "description": "Driver-specific configuration. Keys should correspond to driver package names",
95
- "properties": {},
96
- "title": "driver config",
97
- "type": "object"
98
- },
99
- "keep-alive-timeout": {
100
- "appiumCliAliases": [
101
- "ka"
102
- ],
103
- "default": 600,
104
- "description": "Number of seconds the Appium server should apply as both the keep-alive timeout and the connection timeout for all requests. A value of 0 disables the timeout.",
105
- "minimum": 0,
106
- "title": "keep-alive-timeout config",
107
- "type": "integer"
108
- },
109
- "local-timezone": {
110
- "default": false,
111
- "description": "Use local timezone for timestamps",
112
- "title": "local-timezone config",
113
- "type": "boolean"
114
- },
115
- "log": {
116
- "appiumCliAliases": [
117
- "g"
118
- ],
119
- "appiumCliDest": "logFile",
120
- "description": "Also send log output to this file",
121
- "title": "log config",
122
- "type": "string"
123
- },
124
- "log-filters": {
125
- "$comment": "TODO",
126
- "description": "One or more log filtering rules",
127
- "items": {
128
- "type": "string"
129
- },
130
- "title": "log-filters config",
131
- "type": "array"
132
- },
133
- "log-level": {
134
- "appiumCliDest": "loglevel",
135
- "default": "debug",
136
- "description": "Log level (console[:file])",
137
- "enum": [
138
- "info",
139
- "info:debug",
140
- "info:info",
141
- "info:warn",
142
- "info:error",
143
- "warn",
144
- "warn:debug",
145
- "warn:info",
146
- "warn:warn",
147
- "warn:error",
148
- "error",
149
- "error:debug",
150
- "error:info",
151
- "error:warn",
152
- "error:error",
153
- "debug",
154
- "debug:debug",
155
- "debug:info",
156
- "debug:warn",
157
- "debug:error"
158
- ],
159
- "title": "log-level config",
160
- "type": "string"
161
- },
162
- "log-no-colors": {
163
- "default": false,
164
- "description": "Do not use color in console output",
165
- "title": "log-no-colors config",
166
- "type": "boolean"
167
- },
168
- "log-timestamp": {
169
- "default": false,
170
- "description": "Show timestamps in console output",
171
- "title": "log-timestamp config",
172
- "type": "boolean"
173
- },
174
- "long-stacktrace": {
175
- "default": false,
176
- "description": "Add long stack traces to log entries. Recommended for debugging only.",
177
- "title": "long-stacktrace config",
178
- "type": "boolean"
179
- },
180
- "no-perms-check": {
181
- "default": false,
182
- "description": "Do not check that needed files are readable and/or writable",
183
- "title": "no-perms-check config",
184
- "type": "boolean"
185
- },
186
- "nodeconfig": {
187
- "$comment": "Selenium Grid 3 is unmaintained and Selenium Grid 4 no longer supports this file.",
188
- "description": "Path to configuration JSON file to register Appium as a node with Selenium Grid 3; otherwise the configuration itself",
189
- "title": "nodeconfig config",
190
- "type": "object"
191
- },
192
- "plugin": {
193
- "description": "Plugin-specific configuration. Keys should correspond to plugin package names",
194
- "properties": {},
195
- "title": "plugin config",
196
- "type": "object"
197
- },
198
- "port": {
199
- "appiumCliAliases": [
200
- "p"
201
- ],
202
- "default": 4723,
203
- "description": "Port to listen on",
204
- "maximum": 65535,
205
- "minimum": 1,
206
- "title": "port config",
207
- "type": "integer"
208
- },
209
- "relaxed-security": {
210
- "default": false,
211
- "description": "Disable additional security checks, so it is possible to use some advanced features, provided by drivers supporting this option. Only enable it if all the clients are in the trusted network and it's not the case if a client could potentially break out of the session sandbox. Specific features can be overridden by using \"deny-insecure\"",
212
- "title": "relaxed-security config",
213
- "type": "boolean",
214
- "appiumCliDest": "relaxedSecurityEnabled"
215
- },
216
- "session-override": {
217
- "default": false,
218
- "description": "Enables session override (clobbering)",
219
- "title": "session-override config",
220
- "type": "boolean"
221
- },
222
- "strict-caps": {
223
- "default": false,
224
- "description": "Cause sessions to fail if desired caps are sent in that Appium does not recognize as valid for the selected device",
225
- "title": "strict-caps config",
226
- "type": "boolean"
227
- },
228
- "tmp": {
229
- "appiumCliDest": "tmpDir",
230
- "description": "Absolute path to directory Appium can use to manage temp files. Defaults to C:\\Windows\\Temp on Windows and /tmp otherwise.",
231
- "title": "tmp config",
232
- "type": "string"
233
- },
234
- "trace-dir": {
235
- "description": "Absolute path to directory Appium can use to save iOS instrument traces; defaults to <tmp>/appium-instruments",
236
- "title": "trace-dir config",
237
- "type": "string"
238
- },
239
- "use-drivers": {
240
- "appiumCliDescription": "A list of drivers to activate. Can be a comma-delimited string or path to CSV file. By default, all installed drivers will be activated.",
241
- "default": [],
242
- "description": "A list of drivers to activate. By default, all installed drivers will be activated.",
243
- "items": {
244
- "type": "string"
245
- },
246
- "title": "use-drivers config",
247
- "type": "array",
248
- "uniqueItems": true
249
- },
250
- "use-plugins": {
251
- "appiumCliDescription": "A list of plugins to activate. Can be a comma-delimited string, path to CSV file, or the string \"all\" to use all installed plugins.",
252
- "default": [],
253
- "description": "A list of plugins to activate. To activate all plugins, the value should be an array with a single item \"all\".",
254
- "items": {
255
- "type": "string"
256
- },
257
- "title": "use-plugins config",
258
- "type": "array",
259
- "uniqueItems": true
260
- },
261
- "webhook": {
262
- "$comment": "This should probably use a uri-template format to restrict the protocol to http/https",
263
- "appiumCliAliases": [
264
- "G"
265
- ],
266
- "description": "Also send log output to this http listener",
267
- "format": "uri",
268
- "title": "webhook config",
269
- "type": "string"
270
- }
271
- },
272
- "title": "server config",
273
- "type": "object"
274
- }
275
- },
276
- "title": "Appium Configuration",
277
- "type": "object"
278
- }
@@ -1,71 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-console, promise/prefer-await-to-then */
3
-
4
- async function main () {
5
- const driverEnv = process.env.npm_config_drivers;
6
- const pluginEnv = process.env.npm_config_plugins;
7
-
8
- if (!driverEnv && !pluginEnv) {
9
- console.log('Not auto-installing any drivers or plugins');
10
- return;
11
- }
12
-
13
- let extension;
14
- try {
15
- extension = require('../build/lib/cli/extension');
16
- } catch (e) {
17
- throw new Error(`Could not load extension CLI file; has the project been transpiled? ` +
18
- `(${e.message})`);
19
- }
20
-
21
- const {DEFAULT_APPIUM_HOME, DRIVER_TYPE, PLUGIN_TYPE} = require('./build/lib/extension-config');
22
- const {runExtensionCommand} = extension;
23
- const appiumHome = process.env.npm_config_appium_home || DEFAULT_APPIUM_HOME;
24
- const specs = [[DRIVER_TYPE, driverEnv], [PLUGIN_TYPE, pluginEnv]];
25
-
26
- for (const [type, extEnv] of specs) {
27
- if (extEnv) {
28
- for (const ext of extEnv.split(',')) {
29
- try {
30
- await checkAndInstallExtension({runExtensionCommand, appiumHome, type, ext});
31
- } catch (e) {
32
- console.log(`There was an error checking and installing ${type} ${ext}: ${e.message}`);
33
- }
34
- }
35
- }
36
- }
37
- }
38
-
39
- async function checkAndInstallExtension ({
40
- runExtensionCommand,
41
- appiumHome,
42
- type,
43
- ext,
44
- }) {
45
- const extList = await runExtensionCommand({
46
- appiumHome,
47
- [`${type}Command`]: 'list',
48
- showInstalled: true,
49
- suppressOutput: true,
50
- }, type);
51
- if (extList[ext]) {
52
- console.log(`The ${type} ${ext} was already installed, skipping...`);
53
- return;
54
- }
55
- console.log(`Installing the ${type} ${ext}...`);
56
- await runExtensionCommand({
57
- appiumHome,
58
- [`${type}Command`]: 'install',
59
- [type]: ext,
60
- suppressOutput: true,
61
- }, type);
62
- }
63
-
64
- if (require.main === module) {
65
- main().then(() => {
66
- process.exit(0);
67
- }).catch((e) => {
68
- console.error(e);
69
- process.exit(1);
70
- });
71
- }
@@ -1,56 +0,0 @@
1
- import type { BaseDriverBase } from '@appium/base-driver/lib/basedriver/driver';
2
- import { Class, Driver, ExternalDriver } from '@appium/types';
3
- import { DriverType, ExtensionType, PluginType } from '.';
4
-
5
- export type DriverClass = BaseDriverBase<ExternalDriver,
6
- ExternalDriverStatic>;
7
-
8
- /**
9
- * Additional static props for external driver classes
10
- */
11
- export interface ExternalDriverStatic {
12
- driverName: string;
13
- }
14
-
15
- /**
16
- * TODO: This should be derived from the base plugin.
17
- */
18
- export type PluginClass = Class<PluginProto, ExternalPluginStatic>;
19
-
20
- /**
21
- * Static props for plugin classes
22
- */
23
- export interface ExternalPluginStatic {
24
- pluginName: string;
25
- }
26
-
27
- /**
28
- * A plugin must have this shape.
29
- * @todo Use base plugin instead of this
30
- */
31
- export interface PluginProto {
32
- /**
33
- * I'm not sure why `plugin.name` is required, but it is.
34
- */
35
- name: string;
36
- /**
37
- * Assigned by Appium; _not_ provided by implementor.
38
- */
39
- cliArgs?: Record<string, any>;
40
- /**
41
- * Don't know what this is, but it's also required.
42
- */
43
- onUnexpectedShutdown?: (
44
- driver: Driver,
45
- cause: Error | string,
46
- ) => Promise<void>;
47
- }
48
-
49
- /**
50
- * Generic to get at the class of an extension.
51
- */
52
- export type ExtClass<ExtType extends ExtensionType> = ExtType extends DriverType
53
- ? DriverClass
54
- : ExtType extends PluginType
55
- ? PluginClass
56
- : never;