appium 2.0.0-beta.3 → 2.0.0-beta.30

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 (139) hide show
  1. package/README.md +10 -11
  2. package/build/lib/appium.d.ts +215 -0
  3. package/build/lib/appium.d.ts.map +1 -0
  4. package/build/lib/appium.js +238 -132
  5. package/build/lib/cli/args.d.ts +20 -0
  6. package/build/lib/cli/args.d.ts.map +1 -0
  7. package/build/lib/cli/args.js +96 -282
  8. package/build/lib/cli/driver-command.d.ts +36 -0
  9. package/build/lib/cli/driver-command.d.ts.map +1 -0
  10. package/build/lib/cli/driver-command.js +19 -12
  11. package/build/lib/cli/extension-command.d.ts +345 -0
  12. package/build/lib/cli/extension-command.d.ts.map +1 -0
  13. package/build/lib/cli/extension-command.js +171 -96
  14. package/build/lib/cli/extension.d.ts +14 -0
  15. package/build/lib/cli/extension.d.ts.map +1 -0
  16. package/build/lib/cli/extension.js +31 -16
  17. package/build/lib/cli/parser.d.ts +79 -0
  18. package/build/lib/cli/parser.d.ts.map +1 -0
  19. package/build/lib/cli/parser.js +152 -95
  20. package/build/lib/cli/plugin-command.d.ts +39 -0
  21. package/build/lib/cli/plugin-command.d.ts.map +1 -0
  22. package/build/lib/cli/plugin-command.js +18 -13
  23. package/build/lib/cli/utils.d.ts +29 -0
  24. package/build/lib/cli/utils.d.ts.map +1 -0
  25. package/build/lib/cli/utils.js +27 -3
  26. package/build/lib/config-file.d.ts +100 -0
  27. package/build/lib/config-file.d.ts.map +1 -0
  28. package/build/lib/config-file.js +136 -0
  29. package/build/lib/config.d.ts +40 -0
  30. package/build/lib/config.d.ts.map +1 -0
  31. package/build/lib/config.js +92 -67
  32. package/build/lib/constants.d.ts +48 -0
  33. package/build/lib/constants.d.ts.map +1 -0
  34. package/build/lib/constants.js +60 -0
  35. package/build/lib/extension/driver-config.d.ts +84 -0
  36. package/build/lib/extension/driver-config.d.ts.map +1 -0
  37. package/build/lib/extension/driver-config.js +190 -0
  38. package/build/lib/extension/extension-config.d.ts +170 -0
  39. package/build/lib/extension/extension-config.d.ts.map +1 -0
  40. package/build/lib/extension/extension-config.js +297 -0
  41. package/build/lib/extension/index.d.ts +39 -0
  42. package/build/lib/extension/index.d.ts.map +1 -0
  43. package/build/lib/extension/index.js +77 -0
  44. package/build/lib/extension/manifest.d.ts +174 -0
  45. package/build/lib/extension/manifest.d.ts.map +1 -0
  46. package/build/lib/extension/manifest.js +246 -0
  47. package/build/lib/extension/package-changed.d.ts +11 -0
  48. package/build/lib/extension/package-changed.d.ts.map +1 -0
  49. package/build/lib/extension/package-changed.js +68 -0
  50. package/build/lib/extension/plugin-config.d.ts +62 -0
  51. package/build/lib/extension/plugin-config.d.ts.map +1 -0
  52. package/build/lib/extension/plugin-config.js +87 -0
  53. package/build/lib/grid-register.d.ts +10 -0
  54. package/build/lib/grid-register.d.ts.map +1 -0
  55. package/build/lib/grid-register.js +21 -25
  56. package/build/lib/logger.d.ts +3 -0
  57. package/build/lib/logger.d.ts.map +1 -0
  58. package/build/lib/logger.js +4 -6
  59. package/build/lib/logsink.d.ts +4 -0
  60. package/build/lib/logsink.d.ts.map +1 -0
  61. package/build/lib/logsink.js +12 -16
  62. package/build/lib/main.d.ts +51 -0
  63. package/build/lib/main.d.ts.map +1 -0
  64. package/build/lib/main.js +174 -82
  65. package/build/lib/schema/arg-spec.d.ts +143 -0
  66. package/build/lib/schema/arg-spec.d.ts.map +1 -0
  67. package/build/lib/schema/arg-spec.js +119 -0
  68. package/build/lib/schema/cli-args.d.ts +19 -0
  69. package/build/lib/schema/cli-args.d.ts.map +1 -0
  70. package/build/lib/schema/cli-args.js +180 -0
  71. package/build/lib/schema/cli-transformers.d.ts +5 -0
  72. package/build/lib/schema/cli-transformers.d.ts.map +1 -0
  73. package/build/lib/schema/cli-transformers.js +74 -0
  74. package/build/lib/schema/index.d.ts +3 -0
  75. package/build/lib/schema/index.d.ts.map +1 -0
  76. package/build/lib/schema/index.js +34 -0
  77. package/build/lib/schema/keywords.d.ts +24 -0
  78. package/build/lib/schema/keywords.d.ts.map +1 -0
  79. package/build/lib/schema/keywords.js +70 -0
  80. package/build/lib/schema/schema.d.ts +259 -0
  81. package/build/lib/schema/schema.d.ts.map +1 -0
  82. package/build/lib/schema/schema.js +452 -0
  83. package/build/lib/utils.d.ts +66 -0
  84. package/build/lib/utils.d.ts.map +1 -0
  85. package/build/lib/utils.js +35 -139
  86. package/build/tsconfig.tsbuildinfo +1 -0
  87. package/index.js +11 -0
  88. package/lib/appium-config.schema.json +278 -0
  89. package/lib/appium.js +398 -155
  90. package/lib/cli/args.js +174 -377
  91. package/lib/cli/driver-command.js +22 -7
  92. package/lib/cli/extension-command.js +372 -177
  93. package/lib/cli/extension.js +32 -10
  94. package/lib/cli/parser.js +252 -83
  95. package/lib/cli/plugin-command.js +19 -6
  96. package/lib/cli/utils.js +22 -2
  97. package/lib/config-file.js +223 -0
  98. package/lib/config.js +169 -69
  99. package/lib/constants.js +78 -0
  100. package/lib/extension/driver-config.js +249 -0
  101. package/lib/extension/extension-config.js +458 -0
  102. package/lib/extension/index.js +102 -0
  103. package/lib/extension/manifest.js +486 -0
  104. package/lib/extension/package-changed.js +63 -0
  105. package/lib/extension/plugin-config.js +113 -0
  106. package/lib/grid-register.js +25 -22
  107. package/lib/logger.js +1 -1
  108. package/lib/logsink.js +14 -7
  109. package/lib/main.js +233 -83
  110. package/lib/schema/arg-spec.js +232 -0
  111. package/lib/schema/cli-args.js +261 -0
  112. package/lib/schema/cli-transformers.js +122 -0
  113. package/lib/schema/index.js +2 -0
  114. package/lib/schema/keywords.js +134 -0
  115. package/lib/schema/schema.js +734 -0
  116. package/lib/utils.js +85 -129
  117. package/package.json +62 -85
  118. package/scripts/postinstall.js +71 -0
  119. package/types/appium-manifest.d.ts +61 -0
  120. package/types/cli.d.ts +134 -0
  121. package/types/extension.d.ts +56 -0
  122. package/types/external-manifest.d.ts +58 -0
  123. package/types/index.d.ts +7 -0
  124. package/CHANGELOG.md +0 -3515
  125. package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
  126. package/build/lib/cli/npm.js +0 -206
  127. package/build/lib/cli/parser-helpers.js +0 -82
  128. package/build/lib/driver-config.js +0 -77
  129. package/build/lib/drivers.js +0 -96
  130. package/build/lib/extension-config.js +0 -251
  131. package/build/lib/plugin-config.js +0 -59
  132. package/build/lib/plugins.js +0 -14
  133. package/lib/cli/npm.js +0 -183
  134. package/lib/cli/parser-helpers.js +0 -79
  135. package/lib/driver-config.js +0 -46
  136. package/lib/drivers.js +0 -81
  137. package/lib/extension-config.js +0 -208
  138. package/lib/plugin-config.js +0 -34
  139. package/lib/plugins.js +0 -10
package/types/cli.d.ts ADDED
@@ -0,0 +1,134 @@
1
+ import { DriverOpts } from '@appium/types';
2
+ import {
3
+ DRIVER_TYPE as DRIVER_SUBCOMMAND,
4
+ EXT_SUBCOMMAND_INSTALL,
5
+ EXT_SUBCOMMAND_LIST,
6
+ EXT_SUBCOMMAND_RUN,
7
+ EXT_SUBCOMMAND_UNINSTALL,
8
+ EXT_SUBCOMMAND_UPDATE,
9
+ PLUGIN_TYPE as PLUGIN_SUBCOMMAND,
10
+ SERVER_SUBCOMMAND,
11
+ } from '../lib/constants';
12
+
13
+ /**
14
+ * Possible subcommands for the `appium` CLI.
15
+ */
16
+ type CliSubcommand =
17
+ | typeof SERVER_SUBCOMMAND
18
+ | typeof DRIVER_SUBCOMMAND
19
+ | typeof PLUGIN_SUBCOMMAND;
20
+
21
+ /**
22
+ * Possible subcommands of {@link DRIVER_SUBCOMMAND} or
23
+ * {@link PLUGIN_SUBCOMMAND}.
24
+ */
25
+ export type CliExtensionSubcommand =
26
+ | typeof EXT_SUBCOMMAND_INSTALL
27
+ | typeof EXT_SUBCOMMAND_LIST
28
+ | typeof EXT_SUBCOMMAND_RUN
29
+ | typeof EXT_SUBCOMMAND_UPDATE
30
+ | typeof EXT_SUBCOMMAND_UNINSTALL;
31
+
32
+ /**
33
+ * Random stuff that may appear in the parsed args which has no equivalent in a
34
+ * config file.
35
+ */
36
+ interface MoreArgs {
37
+ /**
38
+ * Path to config file, if any. Does not make sense for this to be allowed in a config file!
39
+ */
40
+ configFile?: string;
41
+
42
+ /**
43
+ * If true, show the config and exit
44
+ */
45
+ showConfig?: boolean;
46
+
47
+ /**
48
+ * If true, open a REPL
49
+ */
50
+ shell?: boolean;
51
+ }
52
+
53
+ /**
54
+ * These arguments are _not_ supported by the CLI, but only via programmatic usage / tests.
55
+ */
56
+ interface ProgrammaticArgs {
57
+ /**
58
+ * If `true`, throw on error instead of exit.
59
+ */
60
+ throwInsteadOfExit?: boolean;
61
+
62
+ /**
63
+ * Seems to only be used in tests or standalone driver calls
64
+ */
65
+ logHandler?: (...args: any[]) => void;
66
+
67
+ /**
68
+ * Alternate way to set `APPIUM_HOME` for tests. Since we don't want to muck about
69
+ * with the environment, we just set it here.
70
+ *
71
+ * Setting this means that any discovery of the proper `APPIUM_HOME` path is bypassed
72
+ * and is equivalent to setting `APPIUM_HOME` in the environment.
73
+ */
74
+ appiumHome?: string;
75
+
76
+ /**
77
+ * If true, show the {@link BuildInfo build info} and exit
78
+ */
79
+ showBuildInfo?: boolean;
80
+
81
+ /**
82
+ * If true, show config and exit
83
+ */
84
+ showConfig?: boolean;
85
+ }
86
+
87
+ /**
88
+ * These are args that Appium assigns while parsing the args.
89
+ */
90
+ interface InternalArgs {
91
+ /**
92
+ * Subcommands of `driver` subcommand
93
+ */
94
+ driverCommand?: CliExtensionSubcommand;
95
+
96
+ /**
97
+ * Subcommands of `plugin` subcommand
98
+ */
99
+ pluginCommand?: CliExtensionSubcommand;
100
+
101
+ /**
102
+ * Possible subcommands
103
+ */
104
+ subcommand: CliSubcommand;
105
+ }
106
+
107
+ /**
108
+ * The same as {@link ParsedArgs} but with a nullable `subcommand`.
109
+ * This is _not_ the same as `Partial<ParsedArgs>`.
110
+ */
111
+ export type PartialArgs = DriverOpts &
112
+ MoreArgs &
113
+ ProgrammaticArgs &
114
+ Partial<InternalArgs>;
115
+
116
+ /**
117
+ * The Appium configuration as a flattened object, parsed via CLI args _and_ any
118
+ * CLI args unsupported by the config file.
119
+ * @todo Does not make any assumptions about property names derived from
120
+ * extensions.
121
+ */
122
+ export type ParsedArgs = DriverOpts &
123
+ MoreArgs &
124
+ ProgrammaticArgs &
125
+ InternalArgs;
126
+
127
+ /**
128
+ * Shown by `appium --build-info`
129
+ */
130
+ export type BuildInfo = {
131
+ version: string;
132
+ 'git-sha'?: string;
133
+ built?: string;
134
+ };
@@ -0,0 +1,56 @@
1
+ import { 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
+ 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
+ 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
+ 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;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * These types describe information about external extensions and the contents of their `package.json` files
3
+ */
4
+
5
+ import { SchemaObject } from 'ajv';
6
+ import { PackageJson, SetRequired } from 'type-fest';
7
+ import { DriverType, ExtensionType, PluginType } from './index';
8
+
9
+ /**
10
+ * This is what is allowed in the `appium.schema` prop of an extension's `package.json`.
11
+ */
12
+ export type SchemaMetadata = string | (SchemaObject & {[key: number]: never});
13
+
14
+ /**
15
+ * Manifest data shared by all extensions, as contained in `package.json`
16
+ */
17
+ export interface CommonMetadata {
18
+ mainClass: string;
19
+ scripts?: Record<string, string>;
20
+ schema?: SchemaMetadata;
21
+ }
22
+
23
+ /**
24
+ * Driver-specific manifest data as contained in `package.json`
25
+ */
26
+ export interface DriverMetadata {
27
+ automationName: string;
28
+ platformNames: string[];
29
+ driverName: string;
30
+ }
31
+
32
+ /**
33
+ * Plugin-specific manifest data as stored in `package.json`
34
+ */
35
+ export interface PluginMetadata {
36
+ pluginName: string;
37
+ }
38
+
39
+ /**
40
+ * Generic type to refer to either {@linkcode DriverMetadata} or {@linkcode PluginMetadata}
41
+ * Corresponds to the `appium` prop in an extension's `package.json`.
42
+ */
43
+ export type ExtMetadata<ExtType extends ExtensionType> =
44
+ (ExtType extends DriverType
45
+ ? DriverMetadata
46
+ : ExtType extends PluginType
47
+ ? PluginMetadata
48
+ : never) &
49
+ CommonMetadata;
50
+
51
+ /**
52
+ * A `package.json` containing extension metadata.
53
+ * Required fields are `name`, `version`, and `appium`.
54
+ */
55
+ export type ExtPackageJson<ExtType extends ExtensionType> = SetRequired<
56
+ PackageJson,
57
+ 'name' | 'version'
58
+ > & {appium: ExtMetadata<ExtType>};
@@ -0,0 +1,7 @@
1
+ export * from './appium-manifest';
2
+ export * from './external-manifest';
3
+ export * from './extension';
4
+ export * from './cli';
5
+ export type DriverType = 'driver';
6
+ export type PluginType = 'plugin';
7
+ export type ExtensionType = DriverType | PluginType;