appium 2.0.0-beta.3 → 2.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/build/lib/appium.d.ts +215 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +241 -132
- package/build/lib/cli/args.d.ts +20 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +96 -282
- package/build/lib/cli/driver-command.d.ts +36 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +19 -12
- package/build/lib/cli/extension-command.d.ts +345 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +171 -96
- package/build/lib/cli/extension.d.ts +14 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +31 -16
- package/build/lib/cli/parser.d.ts +80 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +152 -95
- package/build/lib/cli/plugin-command.d.ts +39 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +18 -13
- package/build/lib/cli/utils.d.ts +29 -0
- package/build/lib/cli/utils.d.ts.map +1 -0
- package/build/lib/cli/utils.js +27 -3
- package/build/lib/config-file.d.ts +100 -0
- package/build/lib/config-file.d.ts.map +1 -0
- package/build/lib/config-file.js +136 -0
- package/build/lib/config.d.ts +41 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +92 -67
- package/build/lib/constants.d.ts +48 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +60 -0
- package/build/lib/extension/driver-config.d.ts +84 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +190 -0
- package/build/lib/extension/extension-config.d.ts +170 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +297 -0
- package/build/lib/extension/index.d.ts +39 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +77 -0
- package/build/lib/extension/manifest.d.ts +174 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +246 -0
- package/build/lib/extension/package-changed.d.ts +11 -0
- package/build/lib/extension/package-changed.d.ts.map +1 -0
- package/build/lib/extension/package-changed.js +68 -0
- package/build/lib/extension/plugin-config.d.ts +62 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +87 -0
- package/build/lib/grid-register.d.ts +10 -0
- package/build/lib/grid-register.d.ts.map +1 -0
- package/build/lib/grid-register.js +21 -25
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +4 -6
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +12 -16
- package/build/lib/main.d.ts +54 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +189 -90
- package/build/lib/schema/arg-spec.d.ts +143 -0
- package/build/lib/schema/arg-spec.d.ts.map +1 -0
- package/build/lib/schema/arg-spec.js +119 -0
- package/build/lib/schema/cli-args.d.ts +19 -0
- package/build/lib/schema/cli-args.d.ts.map +1 -0
- package/build/lib/schema/cli-args.js +180 -0
- package/build/lib/schema/cli-transformers.d.ts +5 -0
- package/build/lib/schema/cli-transformers.d.ts.map +1 -0
- package/build/lib/schema/cli-transformers.js +74 -0
- package/build/lib/schema/index.d.ts +3 -0
- package/build/lib/schema/index.d.ts.map +1 -0
- package/build/lib/schema/index.js +34 -0
- package/build/lib/schema/keywords.d.ts +24 -0
- package/build/lib/schema/keywords.d.ts.map +1 -0
- package/build/lib/schema/keywords.js +70 -0
- package/build/lib/schema/schema.d.ts +259 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +452 -0
- package/build/lib/utils.d.ts +66 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +35 -139
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/types/appium-manifest.d.ts +40 -0
- package/build/types/appium-manifest.d.ts.map +1 -0
- package/build/types/cli.d.ts +112 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/extension.d.ts +43 -0
- package/build/types/extension.d.ts.map +1 -0
- package/build/types/external-manifest.d.ts +47 -0
- package/build/types/external-manifest.d.ts.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- package/index.js +11 -0
- package/lib/appium-config.schema.json +278 -0
- package/lib/appium.js +402 -155
- package/lib/cli/args.js +174 -377
- package/lib/cli/driver-command.js +22 -7
- package/lib/cli/extension-command.js +372 -177
- package/lib/cli/extension.js +32 -10
- package/lib/cli/parser.js +253 -83
- package/lib/cli/plugin-command.js +19 -6
- package/lib/cli/utils.js +22 -2
- package/lib/config-file.js +223 -0
- package/lib/config.js +170 -69
- package/lib/constants.js +78 -0
- package/lib/extension/driver-config.js +249 -0
- package/lib/extension/extension-config.js +458 -0
- package/lib/extension/index.js +102 -0
- package/lib/extension/manifest.js +484 -0
- package/lib/extension/package-changed.js +63 -0
- package/lib/extension/plugin-config.js +113 -0
- package/lib/grid-register.js +25 -22
- package/lib/logger.js +1 -1
- package/lib/logsink.js +14 -7
- package/lib/main.js +255 -90
- package/lib/schema/arg-spec.js +232 -0
- package/lib/schema/cli-args.js +261 -0
- package/lib/schema/cli-transformers.js +122 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +134 -0
- package/lib/schema/schema.js +734 -0
- package/lib/utils.js +85 -129
- package/package.json +68 -85
- package/scripts/postinstall.js +71 -0
- package/types/appium-manifest.ts +61 -0
- package/types/cli.ts +153 -0
- package/types/extension.ts +56 -0
- package/types/external-manifest.ts +58 -0
- package/types/index.ts +14 -0
- package/CHANGELOG.md +0 -3515
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/npm.js +0 -206
- package/build/lib/cli/parser-helpers.js +0 -82
- package/build/lib/driver-config.js +0 -77
- package/build/lib/drivers.js +0 -96
- package/build/lib/extension-config.js +0 -251
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -14
- package/lib/cli/npm.js +0 -183
- package/lib/cli/parser-helpers.js +0 -79
- package/lib/driver-config.js +0 -46
- package/lib/drivers.js +0 -81
- package/lib/extension-config.js +0 -208
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -10
package/types/cli.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import {ServerArgs} from '@appium/types';
|
|
2
|
+
import type {
|
|
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
|
+
export type ServerSubcommand = typeof SERVER_SUBCOMMAND;
|
|
14
|
+
export type DriverSubcommand = typeof DRIVER_SUBCOMMAND;
|
|
15
|
+
export type PluginSubcommand = typeof PLUGIN_SUBCOMMAND;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Possible subcommands for the `appium` CLI.
|
|
19
|
+
*/
|
|
20
|
+
export type CliSubcommand =
|
|
21
|
+
| ServerSubcommand
|
|
22
|
+
| DriverSubcommand
|
|
23
|
+
| PluginSubcommand;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Possible subcommands of {@linkcode DriverSubcommand} or
|
|
27
|
+
* {@linkcode PluginSubcommand}.
|
|
28
|
+
*/
|
|
29
|
+
export type CliExtensionSubcommand =
|
|
30
|
+
| typeof EXT_SUBCOMMAND_INSTALL
|
|
31
|
+
| typeof EXT_SUBCOMMAND_LIST
|
|
32
|
+
| typeof EXT_SUBCOMMAND_RUN
|
|
33
|
+
| typeof EXT_SUBCOMMAND_UPDATE
|
|
34
|
+
| typeof EXT_SUBCOMMAND_UNINSTALL;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Random stuff that may appear in the parsed args which has no equivalent in a
|
|
38
|
+
* config file.
|
|
39
|
+
*/
|
|
40
|
+
export interface MoreArgs {
|
|
41
|
+
/**
|
|
42
|
+
* Possible subcommands. If empty, defaults to {@linkcode ServerSubcommand}.
|
|
43
|
+
*/
|
|
44
|
+
subcommand?: CliSubcommand;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Path to config file, if any. Does not make sense for this to be allowed in a config file!
|
|
48
|
+
*/
|
|
49
|
+
configFile?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* If true, show the config and exit
|
|
53
|
+
*/
|
|
54
|
+
showConfig?: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* If true, open a REPL
|
|
58
|
+
*/
|
|
59
|
+
shell?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* These arguments are _not_ supported by the CLI, but only via programmatic usage / tests.
|
|
64
|
+
*/
|
|
65
|
+
export interface ProgrammaticArgs {
|
|
66
|
+
/**
|
|
67
|
+
* If `true`, throw on error instead of exit.
|
|
68
|
+
*/
|
|
69
|
+
throwInsteadOfExit?: boolean;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Seems to only be used in tests or standalone driver calls
|
|
73
|
+
*/
|
|
74
|
+
logHandler?: (...args: any[]) => void;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Alternate way to set `APPIUM_HOME` for tests. Since we don't want to muck about
|
|
78
|
+
* with the environment, we just set it here.
|
|
79
|
+
*
|
|
80
|
+
* Setting this means that any discovery of the proper `APPIUM_HOME` path is bypassed
|
|
81
|
+
* and is equivalent to setting `APPIUM_HOME` in the environment.
|
|
82
|
+
*/
|
|
83
|
+
appiumHome?: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* If true, show the {@link BuildInfo build info} and exit
|
|
87
|
+
*/
|
|
88
|
+
showBuildInfo?: boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* If true, show config and exit
|
|
92
|
+
*/
|
|
93
|
+
showConfig?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* These are args which the user will specify if using an extension command
|
|
98
|
+
*/
|
|
99
|
+
export interface ExtArgs extends WithExtSubcommand {
|
|
100
|
+
/**
|
|
101
|
+
* Subcommands of `driver` subcommand
|
|
102
|
+
*/
|
|
103
|
+
driverCommand?: CliExtensionSubcommand;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Subcommands of `plugin` subcommand
|
|
107
|
+
*/
|
|
108
|
+
pluginCommand?: CliExtensionSubcommand;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Args having the `server` subcommand
|
|
113
|
+
*/
|
|
114
|
+
export interface WithServerSubcommand {
|
|
115
|
+
subcommand?: ServerSubcommand;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Args having the `driver` or `plugin` subcommand
|
|
120
|
+
*/
|
|
121
|
+
export interface WithExtSubcommand {
|
|
122
|
+
subcommand: DriverSubcommand | PluginSubcommand;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Some generic bits of arguments; should not be used outside this declaration
|
|
127
|
+
*/
|
|
128
|
+
type CommonArgs<SArgs, T = WithServerSubcommand> = MoreArgs &
|
|
129
|
+
ProgrammaticArgs &
|
|
130
|
+
(T extends WithServerSubcommand
|
|
131
|
+
? SArgs
|
|
132
|
+
: T extends WithExtSubcommand
|
|
133
|
+
? ExtArgs
|
|
134
|
+
: never);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Fully-parsed arguments, containing defaults, computed args, and config file values.
|
|
138
|
+
*/
|
|
139
|
+
export type ParsedArgs<T = WithServerSubcommand> = CommonArgs<ServerArgs, T>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Partial arguments, as supplied by a user. _May_ have defaults applied; _may_ contain config values; _may_ contain computed args.
|
|
143
|
+
*/
|
|
144
|
+
export type Args<T = WithServerSubcommand> = CommonArgs<Partial<ServerArgs>, T>;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Shown by `appium --build-info`
|
|
148
|
+
*/
|
|
149
|
+
export type BuildInfo = {
|
|
150
|
+
version: string;
|
|
151
|
+
'git-sha'?: string;
|
|
152
|
+
built?: string;
|
|
153
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
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;
|
|
@@ -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 type { SchemaObject } from 'ajv';
|
|
6
|
+
import type { 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>};
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
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;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Known environment variables concerning Appium
|
|
11
|
+
*/
|
|
12
|
+
export interface AppiumEnv extends NodeJS.ProcessEnv {
|
|
13
|
+
APPIUM_HOME?: string;
|
|
14
|
+
}
|