appium 3.2.2 → 3.3.1
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/build/lib/appium.d.ts +147 -205
- package/build/lib/appium.d.ts.map +1 -1
- package/build/lib/appium.js +169 -282
- package/build/lib/appium.js.map +1 -1
- package/build/lib/bidi-commands.d.ts.map +1 -1
- package/build/lib/bidi-commands.js +11 -11
- package/build/lib/bidi-commands.js.map +1 -1
- package/build/lib/bootstrap/appium-initializer.d.ts +21 -0
- package/build/lib/bootstrap/appium-initializer.d.ts.map +1 -0
- package/build/lib/bootstrap/appium-initializer.js +146 -0
- package/build/lib/bootstrap/appium-initializer.js.map +1 -0
- package/build/lib/bootstrap/appium-main-runner.d.ts +22 -0
- package/build/lib/bootstrap/appium-main-runner.d.ts.map +1 -0
- package/build/lib/bootstrap/appium-main-runner.js +109 -0
- package/build/lib/bootstrap/appium-main-runner.js.map +1 -0
- package/build/lib/bootstrap/config-file.d.ts +37 -0
- package/build/lib/bootstrap/config-file.d.ts.map +1 -0
- package/build/lib/{config-file.js → bootstrap/config-file.js} +62 -138
- package/build/lib/bootstrap/config-file.js.map +1 -0
- package/build/lib/bootstrap/grid-v3-register.d.ts +20 -0
- package/build/lib/bootstrap/grid-v3-register.d.ts.map +1 -0
- package/build/lib/bootstrap/grid-v3-register.js +185 -0
- package/build/lib/bootstrap/grid-v3-register.js.map +1 -0
- package/build/lib/bootstrap/init-types.d.ts +16 -0
- package/build/lib/bootstrap/init-types.d.ts.map +1 -0
- package/build/lib/bootstrap/init-types.js +3 -0
- package/build/lib/bootstrap/init-types.js.map +1 -0
- package/build/lib/bootstrap/main-helpers.d.ts +55 -0
- package/build/lib/bootstrap/main-helpers.d.ts.map +1 -0
- package/build/lib/bootstrap/main-helpers.js +187 -0
- package/build/lib/bootstrap/main-helpers.js.map +1 -0
- package/build/lib/bootstrap/node-helpers.d.ts +32 -0
- package/build/lib/bootstrap/node-helpers.d.ts.map +1 -0
- package/build/lib/bootstrap/node-helpers.js +201 -0
- package/build/lib/bootstrap/node-helpers.js.map +1 -0
- package/build/lib/bootstrap/startup-config.d.ts +22 -0
- package/build/lib/bootstrap/startup-config.d.ts.map +1 -0
- package/build/lib/bootstrap/startup-config.js +111 -0
- package/build/lib/bootstrap/startup-config.js.map +1 -0
- package/build/lib/cli/args.d.ts +16 -12
- package/build/lib/cli/args.d.ts.map +1 -1
- package/build/lib/cli/args.js +20 -40
- package/build/lib/cli/args.js.map +1 -1
- package/build/lib/cli/driver-command.d.ts +51 -93
- package/build/lib/cli/driver-command.d.ts.map +1 -1
- package/build/lib/cli/driver-command.js +11 -66
- package/build/lib/cli/driver-command.js.map +1 -1
- package/build/lib/cli/extension-command.d.ts +173 -377
- package/build/lib/cli/extension-command.d.ts.map +1 -1
- package/build/lib/cli/extension-command.js +387 -656
- package/build/lib/cli/extension-command.js.map +1 -1
- package/build/lib/cli/extension.d.ts +10 -15
- package/build/lib/cli/extension.d.ts.map +1 -1
- package/build/lib/cli/extension.js +15 -33
- package/build/lib/cli/extension.js.map +1 -1
- package/build/lib/cli/parser.d.ts +37 -66
- package/build/lib/cli/parser.d.ts.map +1 -1
- package/build/lib/cli/parser.js +69 -104
- package/build/lib/cli/parser.js.map +1 -1
- package/build/lib/cli/plugin-command.d.ts +50 -90
- package/build/lib/cli/plugin-command.d.ts.map +1 -1
- package/build/lib/cli/plugin-command.js +11 -63
- package/build/lib/cli/plugin-command.js.map +1 -1
- package/build/lib/cli/setup-command.d.ts +21 -26
- package/build/lib/cli/setup-command.d.ts.map +1 -1
- package/build/lib/cli/setup-command.js +19 -61
- package/build/lib/cli/setup-command.js.map +1 -1
- package/build/lib/cli/utils.d.ts +33 -35
- package/build/lib/cli/utils.d.ts.map +1 -1
- package/build/lib/cli/utils.js +48 -50
- package/build/lib/cli/utils.js.map +1 -1
- package/build/lib/constants.d.ts +23 -23
- package/build/lib/constants.d.ts.map +1 -1
- package/build/lib/constants.js +10 -15
- package/build/lib/constants.js.map +1 -1
- package/build/lib/doctor/doctor.d.ts +40 -57
- package/build/lib/doctor/doctor.d.ts.map +1 -1
- package/build/lib/doctor/doctor.js +31 -62
- package/build/lib/doctor/doctor.js.map +1 -1
- package/build/lib/extension/driver-config.d.ts +18 -77
- package/build/lib/extension/driver-config.d.ts.map +1 -1
- package/build/lib/extension/driver-config.js +37 -125
- package/build/lib/extension/driver-config.js.map +1 -1
- package/build/lib/extension/extension-config.d.ts +103 -210
- package/build/lib/extension/extension-config.d.ts.map +1 -1
- package/build/lib/extension/extension-config.js +180 -342
- package/build/lib/extension/extension-config.js.map +1 -1
- package/build/lib/extension/index.d.ts +12 -29
- package/build/lib/extension/index.d.ts.map +1 -1
- package/build/lib/extension/index.js +33 -75
- package/build/lib/extension/index.js.map +1 -1
- package/build/lib/extension/manifest-migrations.d.ts +3 -20
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -1
- package/build/lib/extension/manifest-migrations.js +20 -101
- package/build/lib/extension/manifest-migrations.js.map +1 -1
- package/build/lib/extension/manifest.d.ts +61 -107
- package/build/lib/extension/manifest.d.ts.map +1 -1
- package/build/lib/extension/manifest.js +181 -356
- package/build/lib/extension/manifest.js.map +1 -1
- package/build/lib/extension/package-changed.d.ts +1 -3
- package/build/lib/extension/package-changed.d.ts.map +1 -1
- package/build/lib/extension/package-changed.js +8 -15
- package/build/lib/extension/package-changed.js.map +1 -1
- package/build/lib/extension/plugin-config.d.ts +10 -52
- package/build/lib/extension/plugin-config.d.ts.map +1 -1
- package/build/lib/extension/plugin-config.js +11 -63
- package/build/lib/extension/plugin-config.js.map +1 -1
- package/build/lib/helpers/build.d.ts +22 -0
- package/build/lib/helpers/build.d.ts.map +1 -0
- package/build/lib/helpers/build.js +109 -0
- package/build/lib/helpers/build.js.map +1 -0
- package/build/lib/helpers/capability.d.ts +38 -0
- package/build/lib/helpers/capability.d.ts.map +1 -0
- package/build/lib/helpers/capability.js +128 -0
- package/build/lib/helpers/capability.js.map +1 -0
- package/build/lib/helpers/network.d.ts +14 -0
- package/build/lib/helpers/network.d.ts.map +1 -0
- package/build/lib/helpers/network.js +35 -0
- package/build/lib/helpers/network.js.map +1 -0
- package/build/lib/insecure-features.js +6 -6
- package/build/lib/insecure-features.js.map +1 -1
- package/build/lib/inspector-commands.d.ts +6 -0
- package/build/lib/inspector-commands.d.ts.map +1 -1
- package/build/lib/inspector-commands.js +6 -0
- package/build/lib/inspector-commands.js.map +1 -1
- package/build/lib/logger.d.ts +2 -3
- package/build/lib/logger.d.ts.map +1 -1
- package/build/lib/logger.js +2 -3
- package/build/lib/logger.js.map +1 -1
- package/build/lib/logsink.d.ts +13 -22
- package/build/lib/logsink.d.ts.map +1 -1
- package/build/lib/logsink.js +48 -103
- package/build/lib/logsink.js.map +1 -1
- package/build/lib/main.d.ts +15 -58
- package/build/lib/main.d.ts.map +1 -1
- package/build/lib/main.js +25 -425
- package/build/lib/main.js.map +1 -1
- package/build/lib/schema/arg-spec.d.ts +32 -107
- package/build/lib/schema/arg-spec.d.ts.map +1 -1
- package/build/lib/schema/arg-spec.js +11 -107
- package/build/lib/schema/arg-spec.js.map +1 -1
- package/build/lib/schema/cli-args-guards.d.ts +34 -0
- package/build/lib/schema/cli-args-guards.d.ts.map +1 -0
- package/build/lib/schema/cli-args-guards.js +49 -0
- package/build/lib/schema/cli-args-guards.js.map +1 -0
- package/build/lib/schema/cli-args.d.ts +3 -15
- package/build/lib/schema/cli-args.d.ts.map +1 -1
- package/build/lib/schema/cli-args.js +17 -107
- package/build/lib/schema/cli-args.js.map +1 -1
- package/build/lib/schema/cli-transformers.d.ts +15 -12
- package/build/lib/schema/cli-transformers.d.ts.map +1 -1
- package/build/lib/schema/cli-transformers.js +15 -45
- package/build/lib/schema/cli-transformers.js.map +1 -1
- package/build/lib/schema/format-errors.d.ts +28 -0
- package/build/lib/schema/format-errors.d.ts.map +1 -0
- package/build/lib/schema/format-errors.js +29 -0
- package/build/lib/schema/format-errors.js.map +1 -0
- package/build/lib/schema/index.d.ts +4 -2
- package/build/lib/schema/index.d.ts.map +1 -1
- package/build/lib/schema/index.js +2 -0
- package/build/lib/schema/index.js.map +1 -1
- package/build/lib/schema/keywords.d.ts +12 -20
- package/build/lib/schema/keywords.d.ts.map +1 -1
- package/build/lib/schema/keywords.js +6 -51
- package/build/lib/schema/keywords.js.map +1 -1
- package/build/lib/schema/schema.d.ts +106 -231
- package/build/lib/schema/schema.d.ts.map +1 -1
- package/build/lib/schema/schema.js +88 -358
- package/build/lib/schema/schema.js.map +1 -1
- package/build/lib/utils.d.ts +7 -267
- package/build/lib/utils.d.ts.map +1 -1
- package/build/lib/utils.js +10 -409
- package/build/lib/utils.js.map +1 -1
- package/lib/{appium.js → appium.ts} +297 -341
- package/lib/bidi-commands.ts +10 -14
- package/lib/bootstrap/appium-initializer.ts +212 -0
- package/lib/bootstrap/appium-main-runner.ts +172 -0
- package/lib/bootstrap/config-file.ts +178 -0
- package/lib/bootstrap/grid-v3-register.ts +250 -0
- package/lib/bootstrap/init-types.ts +31 -0
- package/lib/bootstrap/main-helpers.ts +223 -0
- package/lib/bootstrap/node-helpers.ts +180 -0
- package/lib/bootstrap/startup-config.ts +143 -0
- package/lib/cli/{args.js → args.ts} +45 -56
- package/lib/cli/driver-command.ts +122 -0
- package/lib/cli/{extension-command.js → extension-command.ts} +827 -906
- package/lib/cli/extension.ts +65 -0
- package/lib/cli/{parser.js → parser.ts} +93 -116
- package/lib/cli/plugin-command.ts +117 -0
- package/lib/cli/{setup-command.js → setup-command.ts} +59 -74
- package/lib/cli/utils.ts +97 -0
- package/lib/{constants.js → constants.ts} +30 -41
- package/lib/doctor/{doctor.js → doctor.ts} +82 -92
- package/lib/extension/driver-config.ts +165 -0
- package/lib/extension/{extension-config.js → extension-config.ts} +291 -405
- package/lib/extension/index.ts +143 -0
- package/lib/extension/manifest-migrations.ts +57 -0
- package/lib/extension/manifest.ts +369 -0
- package/lib/extension/{package-changed.js → package-changed.ts} +9 -18
- package/lib/extension/plugin-config.ts +62 -0
- package/lib/helpers/build.ts +111 -0
- package/lib/helpers/capability.ts +171 -0
- package/lib/helpers/network.ts +30 -0
- package/lib/insecure-features.ts +1 -1
- package/lib/inspector-commands.ts +6 -1
- package/lib/{logger.js → logger.ts} +1 -2
- package/lib/{logsink.js → logsink.ts} +91 -137
- package/lib/main.ts +60 -0
- package/lib/schema/arg-spec.ts +131 -0
- package/lib/schema/cli-args-guards.ts +67 -0
- package/lib/schema/cli-args.ts +171 -0
- package/lib/schema/cli-transformers.ts +83 -0
- package/lib/schema/format-errors.ts +43 -0
- package/lib/schema/index.ts +4 -0
- package/lib/schema/keywords.ts +96 -0
- package/lib/schema/schema.ts +448 -0
- package/lib/utils.ts +73 -0
- package/package.json +17 -18
- package/scripts/autoinstall-extensions.js +3 -0
- package/build/lib/config-file.d.ts +0 -100
- package/build/lib/config-file.d.ts.map +0 -1
- package/build/lib/config-file.js.map +0 -1
- package/build/lib/config.d.ts +0 -70
- package/build/lib/config.d.ts.map +0 -1
- package/build/lib/config.js +0 -390
- package/build/lib/config.js.map +0 -1
- package/build/lib/grid-register.d.ts +0 -10
- package/build/lib/grid-register.d.ts.map +0 -1
- package/build/lib/grid-register.js +0 -134
- package/build/lib/grid-register.js.map +0 -1
- package/lib/cli/driver-command.js +0 -174
- package/lib/cli/extension.js +0 -74
- package/lib/cli/plugin-command.js +0 -164
- package/lib/cli/utils.js +0 -91
- package/lib/config-file.js +0 -228
- package/lib/config.js +0 -389
- package/lib/extension/driver-config.js +0 -245
- package/lib/extension/index.js +0 -169
- package/lib/extension/manifest-migrations.js +0 -136
- package/lib/extension/manifest.js +0 -550
- package/lib/extension/plugin-config.js +0 -112
- package/lib/grid-register.js +0 -146
- package/lib/main.js +0 -545
- package/lib/schema/arg-spec.js +0 -229
- package/lib/schema/cli-args.js +0 -254
- package/lib/schema/cli-transformers.js +0 -113
- package/lib/schema/index.js +0 -2
- package/lib/schema/keywords.js +0 -136
- package/lib/schema/schema.js +0 -725
- package/lib/utils.js +0 -512
|
@@ -1,37 +1,32 @@
|
|
|
1
|
+
import type { Args, CliCommandSetup, CliCommandSetupSubcommand } from 'appium/types';
|
|
2
|
+
import type { ExtensionConfig } from '../extension/extension-config';
|
|
1
3
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {import('appium/types').CliCommandSetupSubcommand} presetName
|
|
4
|
-
* @returns {Array<string>}
|
|
4
|
+
* Subcommands of preset for setup
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export declare const SUBCOMMAND_MOBILE = "mobile";
|
|
7
|
+
export declare const SUBCOMMAND_DESKTOP = "desktop";
|
|
8
|
+
export declare const SUBCOMMAND_BROWSER = "browser";
|
|
9
|
+
export declare const SUBCOMMAND_RESET = "reset";
|
|
7
10
|
/**
|
|
8
|
-
*
|
|
9
|
-
* @returns {string}
|
|
11
|
+
* Plugin names listed in KNOWN_PLUGINS to install by default.
|
|
10
12
|
*/
|
|
11
|
-
export
|
|
13
|
+
export declare const DEFAULT_PLUGINS: string[];
|
|
14
|
+
type DriverConfig = ExtensionConfig<'driver'>;
|
|
15
|
+
type PluginConfig = ExtensionConfig<'plugin'>;
|
|
12
16
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @template {import('appium/types').CliCommandSetup} SetupCmd
|
|
15
|
-
* @param {import('appium/types').Args<SetupCmd>} preConfigArgs
|
|
16
|
-
* @param {DriverConfig} driverConfig
|
|
17
|
-
* @param {PluginConfig} pluginConfig
|
|
18
|
-
* @returns {Promise<void>}
|
|
17
|
+
* Return a list of drivers available for current host platform.
|
|
19
18
|
*/
|
|
20
|
-
export function
|
|
19
|
+
export declare function getPresetDrivers(presetName: CliCommandSetupSubcommand): string[];
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
21
|
+
* Return desktop platform name for setup command description.
|
|
23
22
|
*/
|
|
24
|
-
export
|
|
25
|
-
export const SUBCOMMAND_DESKTOP: "desktop";
|
|
26
|
-
export const SUBCOMMAND_BROWSER: "browser";
|
|
27
|
-
export const SUBCOMMAND_RESET: "reset";
|
|
23
|
+
export declare function determinePlatformName(): string;
|
|
28
24
|
/**
|
|
29
|
-
*
|
|
25
|
+
* Runs the `setup` command and applies the selected preset.
|
|
26
|
+
*
|
|
27
|
+
* Depending on the subcommand, this installs mobile/desktop/browser presets or
|
|
28
|
+
* removes all installed extensions and manifests via `reset`.
|
|
30
29
|
*/
|
|
31
|
-
export
|
|
32
|
-
export
|
|
33
|
-
export type CliExtensionSubcommand = import("appium/types").CliExtensionSubcommand;
|
|
34
|
-
export type PluginConfig = import("../extension/extension-config").ExtensionConfig<CliExtensionCommand>;
|
|
35
|
-
export type DriverConfig = import("../extension/extension-config").ExtensionConfig<CliExtensionCommand>;
|
|
36
|
-
export type Args = import("appium/types").Args<CliExtensionCommand, CliExtensionSubcommand>;
|
|
30
|
+
export declare function runSetupCommand(preConfigArgs: Args<CliCommandSetup>, driverConfig: DriverConfig, pluginConfig: PluginConfig): Promise<void>;
|
|
31
|
+
export {};
|
|
37
32
|
//# sourceMappingURL=setup-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-command.d.ts","sourceRoot":"","sources":["../../../lib/cli/setup-command.
|
|
1
|
+
{"version":3,"file":"setup-command.d.ts","sourceRoot":"","sources":["../../../lib/cli/setup-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EACJ,eAAe,EACf,yBAAyB,EAG1B,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAC5C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAexC;;GAEG;AACH,eAAO,MAAM,eAAe,UAA0B,CAAC;AAEvD,KAAK,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAC9C,KAAK,YAAY,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;AAG9C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,yBAAyB,GAAG,MAAM,EAAE,CAahF;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAO9C;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,aAAa,EAAE,IAAI,CAAC,eAAe,CAAC,EACpC,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,IAAI,CAAC,CAkBf"}
|
|
@@ -11,7 +11,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
11
11
|
const constants_1 = require("../constants");
|
|
12
12
|
const extension_1 = require("./extension");
|
|
13
13
|
const support_1 = require("@appium/support");
|
|
14
|
-
const logger_1 =
|
|
14
|
+
const logger_1 = require("../logger");
|
|
15
15
|
/**
|
|
16
16
|
* Subcommands of preset for setup
|
|
17
17
|
*/
|
|
@@ -23,12 +23,11 @@ exports.SUBCOMMAND_RESET = 'reset';
|
|
|
23
23
|
* Pairs of preset subcommand and driver candidates.
|
|
24
24
|
* Driver names listed in KNOWN_DRIVERS to install by default
|
|
25
25
|
*/
|
|
26
|
-
const PRESET_PAIRS = Object.freeze(
|
|
27
|
-
/** @type {const} */ ({
|
|
26
|
+
const PRESET_PAIRS = Object.freeze({
|
|
28
27
|
mobile: lodash_1.default.keys(constants_1.MOBILE_DRIVERS),
|
|
29
28
|
desktop: lodash_1.default.keys(constants_1.DESKTOP_DRIVERS),
|
|
30
|
-
browser: lodash_1.default.keys(constants_1.DESKTOP_BROWSERS)
|
|
31
|
-
})
|
|
29
|
+
browser: lodash_1.default.keys(constants_1.DESKTOP_BROWSERS),
|
|
30
|
+
});
|
|
32
31
|
const DRIVERS_ONLY_MACOS = ['xcuitest', 'safari', 'mac2'];
|
|
33
32
|
const DRIVERS_ONLY_WINDOWS = ['windows'];
|
|
34
33
|
/**
|
|
@@ -37,8 +36,6 @@ const DRIVERS_ONLY_WINDOWS = ['windows'];
|
|
|
37
36
|
exports.DEFAULT_PLUGINS = ['images', 'inspector'];
|
|
38
37
|
/**
|
|
39
38
|
* Return a list of drivers available for current host platform.
|
|
40
|
-
* @param {import('appium/types').CliCommandSetupSubcommand} presetName
|
|
41
|
-
* @returns {Array<string>}
|
|
42
39
|
*/
|
|
43
40
|
function getPresetDrivers(presetName) {
|
|
44
41
|
return lodash_1.default.filter(PRESET_PAIRS[presetName], (driver) => {
|
|
@@ -53,7 +50,6 @@ function getPresetDrivers(presetName) {
|
|
|
53
50
|
}
|
|
54
51
|
/**
|
|
55
52
|
* Return desktop platform name for setup command description.
|
|
56
|
-
* @returns {string}
|
|
57
53
|
*/
|
|
58
54
|
function determinePlatformName() {
|
|
59
55
|
if (support_1.system.isMac()) {
|
|
@@ -65,12 +61,10 @@ function determinePlatformName() {
|
|
|
65
61
|
return 'Linux';
|
|
66
62
|
}
|
|
67
63
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* @param {PluginConfig} pluginConfig
|
|
73
|
-
* @returns {Promise<void>}
|
|
64
|
+
* Runs the `setup` command and applies the selected preset.
|
|
65
|
+
*
|
|
66
|
+
* Depending on the subcommand, this installs mobile/desktop/browser presets or
|
|
67
|
+
* removes all installed extensions and manifests via `reset`.
|
|
74
68
|
*/
|
|
75
69
|
async function runSetupCommand(preConfigArgs, driverConfig, pluginConfig) {
|
|
76
70
|
switch (preConfigArgs.setupCommand) {
|
|
@@ -94,28 +88,24 @@ async function runSetupCommand(preConfigArgs, driverConfig, pluginConfig) {
|
|
|
94
88
|
;
|
|
95
89
|
/**
|
|
96
90
|
* Resets all installed drivers and extensions
|
|
97
|
-
*
|
|
98
|
-
* @param {DriverConfig} driverConfig
|
|
99
|
-
* @param {PluginConfig} pluginConfig
|
|
100
|
-
* @returns {Promise<void>}
|
|
101
91
|
*/
|
|
102
92
|
async function resetAllExtensions(driverConfig, pluginConfig) {
|
|
103
|
-
|
|
93
|
+
const commandConfigs = [
|
|
104
94
|
['driver', driverConfig],
|
|
105
95
|
['plugin', pluginConfig],
|
|
106
|
-
]
|
|
107
|
-
|
|
96
|
+
];
|
|
97
|
+
for (const [command, config] of commandConfigs) {
|
|
98
|
+
for (const extensionName of lodash_1.default.keys(config.installedExtensions)) {
|
|
108
99
|
try {
|
|
109
|
-
await uninstallExtension(extensionName, extensionCommandArgs(
|
|
110
|
-
/** @type {DriverConfig|PluginConfig} */ (config));
|
|
100
|
+
await uninstallExtension(extensionName, extensionCommandArgs(command, extensionName, 'uninstall'), config);
|
|
111
101
|
}
|
|
112
102
|
catch (e) {
|
|
113
|
-
logger_1.
|
|
103
|
+
logger_1.log.warn(`${extensionName} ${command} cannot be uninstalled. Will delete the manifest anyway. ` +
|
|
114
104
|
`Original error: ${e.stack}`);
|
|
115
105
|
}
|
|
116
106
|
}
|
|
117
|
-
const manifestPath =
|
|
118
|
-
if (!await support_1.fs.exists(manifestPath)) {
|
|
107
|
+
const manifestPath = config.manifestPath;
|
|
108
|
+
if (!manifestPath || !await support_1.fs.exists(manifestPath)) {
|
|
119
109
|
continue;
|
|
120
110
|
}
|
|
121
111
|
await support_1.fs.rimraf(manifestPath);
|
|
@@ -123,39 +113,30 @@ async function resetAllExtensions(driverConfig, pluginConfig) {
|
|
|
123
113
|
throw new Error(`${command} manifest at '${manifestPath}' cannot be deleted. Is it accessible?`);
|
|
124
114
|
}
|
|
125
115
|
else {
|
|
126
|
-
logger_1.
|
|
116
|
+
logger_1.log.info(`Successfully deleted ${command} manifest at '${manifestPath}'`);
|
|
127
117
|
}
|
|
128
118
|
}
|
|
129
119
|
}
|
|
130
120
|
/**
|
|
131
121
|
* Install drivers listed in DEFAULT_DRIVERS.
|
|
132
|
-
* @param {DriverConfig} driverConfig
|
|
133
|
-
* @returns {Promise<void>}
|
|
134
122
|
*/
|
|
135
123
|
async function setupMobileDrivers(driverConfig) {
|
|
136
124
|
await installDrivers(exports.SUBCOMMAND_MOBILE, driverConfig);
|
|
137
125
|
}
|
|
138
126
|
/**
|
|
139
127
|
* Install all of known drivers listed in BROWSER_DRIVERS.
|
|
140
|
-
* @param {DriverConfig} driverConfig
|
|
141
|
-
* @returns {Promise<void>}
|
|
142
128
|
*/
|
|
143
129
|
async function setupBrowserDrivers(driverConfig) {
|
|
144
130
|
await installDrivers(exports.SUBCOMMAND_BROWSER, driverConfig);
|
|
145
131
|
}
|
|
146
132
|
/**
|
|
147
133
|
* Install all of known drivers listed in DESKTOP_APP_DRIVERS.
|
|
148
|
-
* @param {DriverConfig} driverConfig
|
|
149
|
-
* @returns {Promise<void>}
|
|
150
134
|
*/
|
|
151
135
|
async function setupDesktopAppDrivers(driverConfig) {
|
|
152
136
|
await installDrivers(exports.SUBCOMMAND_DESKTOP, driverConfig);
|
|
153
137
|
}
|
|
154
138
|
/**
|
|
155
139
|
* Install the given driver name. It skips the installation if the given driver name was already installed.
|
|
156
|
-
* @param {import('appium/types').CliCommandSetupSubcommand} subcommand
|
|
157
|
-
* @param {DriverConfig} driverConfig
|
|
158
|
-
* @returns {Promise<void>}
|
|
159
140
|
*/
|
|
160
141
|
async function installDrivers(subcommand, driverConfig) {
|
|
161
142
|
for (const driverName of getPresetDrivers(subcommand)) {
|
|
@@ -164,8 +145,6 @@ async function installDrivers(subcommand, driverConfig) {
|
|
|
164
145
|
}
|
|
165
146
|
/**
|
|
166
147
|
* Install plugins listed in DEFAULT_PLUGINS.
|
|
167
|
-
* @param {PluginConfig} pluginConfig
|
|
168
|
-
* @returns {Promise<void>}
|
|
169
148
|
*/
|
|
170
149
|
async function setupDefaultPlugins(pluginConfig) {
|
|
171
150
|
for (const pluginName of exports.DEFAULT_PLUGINS) {
|
|
@@ -174,14 +153,10 @@ async function setupDefaultPlugins(pluginConfig) {
|
|
|
174
153
|
}
|
|
175
154
|
/**
|
|
176
155
|
* Run the given extensionConfigArgs command after checking if the given extensionName was already installed.
|
|
177
|
-
* @param {string} extensionName
|
|
178
|
-
* @param {Args} extensionConfigArgs
|
|
179
|
-
* @param {DriverConfig|PluginConfig} extensionConfig
|
|
180
|
-
* @returns {Promise<void>}
|
|
181
156
|
*/
|
|
182
157
|
async function installExtension(extensionName, extensionConfigArgs, extensionConfig) {
|
|
183
158
|
if (lodash_1.default.keys(extensionConfig.installedExtensions).includes(extensionName)) {
|
|
184
|
-
logger_1.
|
|
159
|
+
logger_1.log.info(`${extensionName} (${extensionConfig.installedExtensions[extensionName].version}) is already installed. ` +
|
|
185
160
|
`Skipping the installation.`);
|
|
186
161
|
return;
|
|
187
162
|
}
|
|
@@ -189,14 +164,10 @@ async function installExtension(extensionName, extensionConfigArgs, extensionCon
|
|
|
189
164
|
}
|
|
190
165
|
/**
|
|
191
166
|
* Run the given extensionConfigArgs command after checking if the given extensionName was already installed.
|
|
192
|
-
* @param {string} extensionName
|
|
193
|
-
* @param {Args} extensionConfigArgs
|
|
194
|
-
* @param {DriverConfig|PluginConfig} extensionConfig
|
|
195
|
-
* @returns {Promise<void>}
|
|
196
167
|
*/
|
|
197
168
|
async function uninstallExtension(extensionName, extensionConfigArgs, extensionConfig) {
|
|
198
169
|
if (!lodash_1.default.keys(extensionConfig.installedExtensions).includes(extensionName)) {
|
|
199
|
-
logger_1.
|
|
170
|
+
logger_1.log.info(`${extensionName} (${extensionConfig.installedExtensions[extensionName].version}) is not installed. ` +
|
|
200
171
|
`Skipping its uninstall.`);
|
|
201
172
|
return;
|
|
202
173
|
}
|
|
@@ -204,23 +175,10 @@ async function uninstallExtension(extensionName, extensionConfigArgs, extensionC
|
|
|
204
175
|
}
|
|
205
176
|
/**
|
|
206
177
|
* Return the command config for driver or plugin.
|
|
207
|
-
* @param {CliExtensionCommand} extensionCommand
|
|
208
|
-
* @param {string} extensionName
|
|
209
|
-
* @param {CliExtensionSubcommand} command
|
|
210
|
-
* @returns {Args}
|
|
211
178
|
*/
|
|
212
179
|
function extensionCommandArgs(extensionCommand, extensionName, command) {
|
|
213
180
|
return (extensionCommand === 'plugin')
|
|
214
181
|
? { 'subcommand': 'plugin', 'pluginCommand': command, 'plugin': extensionName }
|
|
215
182
|
: { 'subcommand': 'driver', 'driverCommand': command, 'driver': extensionName };
|
|
216
183
|
}
|
|
217
|
-
/**
|
|
218
|
-
* @typedef {import('appium/types').CliExtensionCommand} CliExtensionCommand
|
|
219
|
-
* @typedef {import('appium/types').CliExtensionSubcommand} CliExtensionSubcommand
|
|
220
|
-
* @typedef {import('../extension/extension-config').ExtensionConfig<CliExtensionCommand>} PluginConfig
|
|
221
|
-
* @typedef {import('../extension/extension-config').ExtensionConfig<CliExtensionCommand>} DriverConfig
|
|
222
|
-
*/
|
|
223
|
-
/**
|
|
224
|
-
* @typedef {import('appium/types').Args<CliExtensionCommand, CliExtensionSubcommand>} Args
|
|
225
|
-
*/
|
|
226
184
|
//# sourceMappingURL=setup-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-command.js","sourceRoot":"","sources":["../../../lib/cli/setup-command.
|
|
1
|
+
{"version":3,"file":"setup-command.js","sourceRoot":"","sources":["../../../lib/cli/setup-command.ts"],"names":[],"mappings":";;;;;;AAmDA,4CAaC;AAKD,sDAOC;AAQD,0CAsBC;AA1GD,oDAAuB;AAQvB,4CAIsB;AACtB,2CAAgD;AAChD,6CAA6C;AAC7C,sCAA8B;AAG9B;;GAEG;AACU,QAAA,iBAAiB,GAAG,QAAQ,CAAC;AAC7B,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAC/B,QAAA,kBAAkB,GAAG,SAAS,CAAC;AAC/B,QAAA,gBAAgB,GAAG,OAAO,CAAC;AAExC;;;GAGG;AACH,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,gBAAC,CAAC,IAAI,CAAC,0BAAc,CAAC;IAC9B,OAAO,EAAE,gBAAC,CAAC,IAAI,CAAC,2BAAe,CAAC;IAChC,OAAO,EAAE,gBAAC,CAAC,IAA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
-
* Conditionally log something to the console
|
|
9
|
-
* @param {boolean} json - whether we are in json mode (and should therefore not log)
|
|
10
|
-
* @param {string} msg - string to log
|
|
11
|
-
*/
|
|
12
|
-
export function log(json: boolean, msg: string): void;
|
|
13
|
-
/**
|
|
14
|
-
* Start a spinner, execute an async function, and then stop the spinner
|
|
15
|
-
* @param {boolean} json - whether we are in json mode (and should therefore not log)
|
|
16
|
-
* @param {string} msg - string to log
|
|
17
|
-
* @param {function} fn - function to wrap with spinning
|
|
18
|
-
*/
|
|
19
|
-
export function spinWith(json: boolean, msg: string, fn: Function): Promise<any>;
|
|
20
|
-
export const JSON_SPACES: 4;
|
|
21
|
-
export class RingBuffer {
|
|
1
|
+
export declare const JSON_SPACES = 4;
|
|
2
|
+
export declare class RingBuffer<T = any> {
|
|
3
|
+
private readonly size;
|
|
4
|
+
private readonly buffer;
|
|
22
5
|
constructor(size?: number);
|
|
23
|
-
size: number;
|
|
24
|
-
buffer: any[];
|
|
25
6
|
/**
|
|
26
|
-
* Get the current buffer contents
|
|
27
|
-
*
|
|
28
|
-
* @returns {any[]}
|
|
7
|
+
* Get the current buffer contents.
|
|
29
8
|
*/
|
|
30
|
-
getBuff():
|
|
9
|
+
getBuff(): T[];
|
|
31
10
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @returns {void}
|
|
11
|
+
* Add an item to the buffer.
|
|
35
12
|
*/
|
|
36
|
-
|
|
13
|
+
enqueue(item: T): void;
|
|
37
14
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @param {any} item
|
|
15
|
+
* Remove the oldest item from the buffer.
|
|
41
16
|
*/
|
|
42
|
-
|
|
17
|
+
dequeue(): void;
|
|
43
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Log an error to the console and exit the process.
|
|
21
|
+
*
|
|
22
|
+
* @param json - whether we should log json or text
|
|
23
|
+
* @param msg - error message, object, Error instance, etc.
|
|
24
|
+
*/
|
|
25
|
+
export declare function errAndQuit(json: boolean, msg: unknown): never;
|
|
26
|
+
/**
|
|
27
|
+
* Conditionally log something to the console.
|
|
28
|
+
*
|
|
29
|
+
* @param json - whether we are in json mode (and should therefore not log)
|
|
30
|
+
* @param msg - string to log
|
|
31
|
+
*/
|
|
32
|
+
export declare function log(json: boolean, msg: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Start a spinner, execute an async function, and then stop the spinner.
|
|
35
|
+
*
|
|
36
|
+
* @param json - whether we are in json mode (and should therefore not log)
|
|
37
|
+
* @param msg - string to log
|
|
38
|
+
* @param fn - function to wrap with spinning
|
|
39
|
+
* @returns result of `fn`
|
|
40
|
+
*/
|
|
41
|
+
export declare function spinWith<T>(json: boolean, msg: string, fn: () => T | Promise<T>): Promise<T>;
|
|
44
42
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/cli/utils.
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../lib/cli/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,IAAI,CAAC;AAI7B,qBAAa,UAAU,CAAC,CAAC,GAAG,GAAG;IAC7B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAW;gBAEtB,IAAI,SAAK;IAIrB;;OAEG;IACH,OAAO,IAAI,CAAC,EAAE;IAId;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;IAOtB;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,GAAG,KAAK,CAU7D;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAIpD;AAED;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC,CAAC,CAAC,CAaZ"}
|
package/build/lib/cli/utils.js
CHANGED
|
@@ -10,27 +10,58 @@ exports.log = log;
|
|
|
10
10
|
exports.spinWith = spinWith;
|
|
11
11
|
const ora_1 = __importDefault(require("ora"));
|
|
12
12
|
exports.JSON_SPACES = 4;
|
|
13
|
-
|
|
13
|
+
class RingBuffer {
|
|
14
|
+
size;
|
|
15
|
+
buffer = [];
|
|
16
|
+
constructor(size = 50) {
|
|
17
|
+
this.size = size;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the current buffer contents.
|
|
21
|
+
*/
|
|
22
|
+
getBuff() {
|
|
23
|
+
return this.buffer;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Add an item to the buffer.
|
|
27
|
+
*/
|
|
28
|
+
enqueue(item) {
|
|
29
|
+
if (this.buffer.length >= this.size) {
|
|
30
|
+
this.dequeue();
|
|
31
|
+
}
|
|
32
|
+
this.buffer.push(item);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Remove the oldest item from the buffer.
|
|
36
|
+
*/
|
|
37
|
+
dequeue() {
|
|
38
|
+
this.buffer.shift();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.RingBuffer = RingBuffer;
|
|
42
|
+
/**
|
|
14
43
|
* Log an error to the console and exit the process.
|
|
15
|
-
*
|
|
16
|
-
* @param
|
|
44
|
+
*
|
|
45
|
+
* @param json - whether we should log json or text
|
|
46
|
+
* @param msg - error message, object, Error instance, etc.
|
|
17
47
|
*/
|
|
18
48
|
function errAndQuit(json, msg) {
|
|
19
49
|
if (json) {
|
|
20
|
-
console.log(JSON.stringify({ error:
|
|
50
|
+
console.log(JSON.stringify({ error: String(msg) }, null, exports.JSON_SPACES));
|
|
21
51
|
}
|
|
22
52
|
else {
|
|
23
|
-
console.error(
|
|
24
|
-
if (msg
|
|
25
|
-
console.error(
|
|
53
|
+
console.error(String(msg).red);
|
|
54
|
+
if (msg?.stderr) {
|
|
55
|
+
console.error(String(msg.stderr).red);
|
|
26
56
|
}
|
|
27
57
|
}
|
|
28
58
|
process.exit(1);
|
|
29
59
|
}
|
|
30
60
|
/**
|
|
31
|
-
* Conditionally log something to the console
|
|
32
|
-
*
|
|
33
|
-
* @param
|
|
61
|
+
* Conditionally log something to the console.
|
|
62
|
+
*
|
|
63
|
+
* @param json - whether we are in json mode (and should therefore not log)
|
|
64
|
+
* @param msg - string to log
|
|
34
65
|
*/
|
|
35
66
|
function log(json, msg) {
|
|
36
67
|
if (!json) {
|
|
@@ -38,19 +69,20 @@ function log(json, msg) {
|
|
|
38
69
|
}
|
|
39
70
|
}
|
|
40
71
|
/**
|
|
41
|
-
* Start a spinner, execute an async function, and then stop the spinner
|
|
42
|
-
*
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
72
|
+
* Start a spinner, execute an async function, and then stop the spinner.
|
|
73
|
+
*
|
|
74
|
+
* @param json - whether we are in json mode (and should therefore not log)
|
|
75
|
+
* @param msg - string to log
|
|
76
|
+
* @param fn - function to wrap with spinning
|
|
77
|
+
* @returns result of `fn`
|
|
45
78
|
*/
|
|
46
79
|
async function spinWith(json, msg, fn) {
|
|
47
80
|
if (json) {
|
|
48
81
|
return await fn();
|
|
49
82
|
}
|
|
50
83
|
const spinner = (0, ora_1.default)(msg).start();
|
|
51
|
-
let res;
|
|
52
84
|
try {
|
|
53
|
-
res = await fn();
|
|
85
|
+
const res = await fn();
|
|
54
86
|
spinner.succeed();
|
|
55
87
|
return res;
|
|
56
88
|
}
|
|
@@ -59,38 +91,4 @@ async function spinWith(json, msg, fn) {
|
|
|
59
91
|
throw err;
|
|
60
92
|
}
|
|
61
93
|
}
|
|
62
|
-
class RingBuffer {
|
|
63
|
-
constructor(size = 50) {
|
|
64
|
-
this.size = size;
|
|
65
|
-
this.buffer = [];
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Get the current buffer contents
|
|
69
|
-
*
|
|
70
|
-
* @returns {any[]}
|
|
71
|
-
*/
|
|
72
|
-
getBuff() {
|
|
73
|
-
return this.buffer;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Remove the oldest item from the buffer
|
|
77
|
-
*
|
|
78
|
-
* @returns {void}
|
|
79
|
-
*/
|
|
80
|
-
dequeue() {
|
|
81
|
-
this.buffer.shift();
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Add an item to the buffer
|
|
85
|
-
*
|
|
86
|
-
* @param {any} item
|
|
87
|
-
*/
|
|
88
|
-
enqueue(item) {
|
|
89
|
-
if (this.buffer.length >= this.size) {
|
|
90
|
-
this.dequeue();
|
|
91
|
-
}
|
|
92
|
-
this.buffer.push(item);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.RingBuffer = RingBuffer;
|
|
96
94
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/cli/utils.
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../lib/cli/utils.ts"],"names":[],"mappings":";AAAA,+BAA+B;;;;;;AA+C/B,gCAUC;AAQD,kBAIC;AAUD,4BAiBC;AA9FD,8CAAsB;AAET,QAAA,WAAW,GAAG,CAAC,CAAC;AAI7B,MAAa,UAAU;IACJ,IAAI,CAAS;IACb,MAAM,GAAQ,EAAE,CAAC;IAElC,YAAY,IAAI,GAAG,EAAE;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAO;QACb,IAAI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AAC;IACjC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,EAAE,EAAE,CAAC;QACvB,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,GAAG,CAAC;IACb,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/build/lib/constants.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The name of the extension type for drivers
|
|
3
3
|
*/
|
|
4
|
-
export const DRIVER_TYPE
|
|
4
|
+
export declare const DRIVER_TYPE = "driver";
|
|
5
5
|
/**
|
|
6
6
|
* The name of the extension type for plugins
|
|
7
7
|
*/
|
|
8
|
-
export const PLUGIN_TYPE
|
|
8
|
+
export declare const PLUGIN_TYPE = "plugin";
|
|
9
9
|
/**
|
|
10
10
|
* The `server` command of the `appium` CLI
|
|
11
11
|
*/
|
|
12
|
-
export const SERVER_SUBCOMMAND
|
|
12
|
+
export declare const SERVER_SUBCOMMAND = "server";
|
|
13
13
|
/**
|
|
14
14
|
* The `setup` command of the `appium` CLI
|
|
15
15
|
*/
|
|
16
|
-
export const SETUP_SUBCOMMAND
|
|
16
|
+
export declare const SETUP_SUBCOMMAND = "setup";
|
|
17
17
|
/**
|
|
18
18
|
* The value of `--use-plugins` if _all_ plugins should be loaded
|
|
19
19
|
*/
|
|
20
|
-
export const USE_ALL_PLUGINS
|
|
21
|
-
export const KNOWN_PLUGINS: Readonly<{
|
|
20
|
+
export declare const USE_ALL_PLUGINS = "all";
|
|
21
|
+
export declare const KNOWN_PLUGINS: Readonly<{
|
|
22
22
|
readonly 'execute-driver': "@appium/execute-driver-plugin";
|
|
23
23
|
readonly images: "@appium/images-plugin";
|
|
24
24
|
readonly inspector: "appium-inspector-plugin";
|
|
@@ -26,21 +26,21 @@ export const KNOWN_PLUGINS: Readonly<{
|
|
|
26
26
|
readonly storage: "@appium/storage-plugin";
|
|
27
27
|
readonly 'universal-xml': "@appium/universal-xml-plugin";
|
|
28
28
|
}>;
|
|
29
|
-
export const MOBILE_DRIVERS: Readonly<{
|
|
29
|
+
export declare const MOBILE_DRIVERS: Readonly<{
|
|
30
30
|
readonly uiautomator2: "appium-uiautomator2-driver";
|
|
31
31
|
readonly xcuitest: "appium-xcuitest-driver";
|
|
32
32
|
readonly espresso: "appium-espresso-driver";
|
|
33
33
|
}>;
|
|
34
|
-
export const DESKTOP_DRIVERS: Readonly<{
|
|
34
|
+
export declare const DESKTOP_DRIVERS: Readonly<{
|
|
35
35
|
readonly mac2: "appium-mac2-driver";
|
|
36
36
|
readonly windows: "appium-windows-driver";
|
|
37
37
|
}>;
|
|
38
|
-
export const DESKTOP_BROWSERS: Readonly<{
|
|
38
|
+
export declare const DESKTOP_BROWSERS: Readonly<{
|
|
39
39
|
readonly safari: "appium-safari-driver";
|
|
40
40
|
readonly gecko: "appium-geckodriver";
|
|
41
41
|
readonly chromium: "appium-chromium-driver";
|
|
42
42
|
}>;
|
|
43
|
-
export const KNOWN_DRIVERS: Readonly<{
|
|
43
|
+
export declare const KNOWN_DRIVERS: Readonly<{
|
|
44
44
|
readonly safari: "appium-safari-driver";
|
|
45
45
|
readonly gecko: "appium-geckodriver";
|
|
46
46
|
readonly chromium: "appium-chromium-driver";
|
|
@@ -53,39 +53,39 @@ export const KNOWN_DRIVERS: Readonly<{
|
|
|
53
53
|
/**
|
|
54
54
|
* Relative path to directory containing any Appium internal files
|
|
55
55
|
*/
|
|
56
|
-
export const CACHE_DIR_RELATIVE_PATH: string;
|
|
56
|
+
export declare const CACHE_DIR_RELATIVE_PATH: string;
|
|
57
57
|
/**
|
|
58
58
|
* Relative path to hashfile (from `APPIUM_HOME`) of consuming project's `package.json` (if it exists)
|
|
59
59
|
*/
|
|
60
|
-
export const PKG_HASHFILE_RELATIVE_PATH: string;
|
|
61
|
-
export const EXT_SUBCOMMAND_LIST
|
|
62
|
-
export const EXT_SUBCOMMAND_INSTALL
|
|
63
|
-
export const EXT_SUBCOMMAND_UNINSTALL
|
|
64
|
-
export const EXT_SUBCOMMAND_UPDATE
|
|
65
|
-
export const EXT_SUBCOMMAND_RUN
|
|
66
|
-
export const EXT_SUBCOMMAND_DOCTOR
|
|
60
|
+
export declare const PKG_HASHFILE_RELATIVE_PATH: string;
|
|
61
|
+
export declare const EXT_SUBCOMMAND_LIST = "list";
|
|
62
|
+
export declare const EXT_SUBCOMMAND_INSTALL = "install";
|
|
63
|
+
export declare const EXT_SUBCOMMAND_UNINSTALL = "uninstall";
|
|
64
|
+
export declare const EXT_SUBCOMMAND_UPDATE = "update";
|
|
65
|
+
export declare const EXT_SUBCOMMAND_RUN = "run";
|
|
66
|
+
export declare const EXT_SUBCOMMAND_DOCTOR = "doctor";
|
|
67
67
|
/**
|
|
68
68
|
* Current revision of the manifest (`extensions.yaml`) schema
|
|
69
69
|
*/
|
|
70
|
-
export const CURRENT_SCHEMA_REV
|
|
70
|
+
export declare const CURRENT_SCHEMA_REV = 4;
|
|
71
71
|
/**
|
|
72
72
|
* The default number of stack frames to show in a "long" stack trace, when enabled via `--long-stacktrace`
|
|
73
73
|
* @remarks This value may be increased in the future.
|
|
74
74
|
* @privateRemarks A value like `Infinity` may provide to have deleterious effects on
|
|
75
75
|
* memory usage, perf, and/or log output, and higher limits may be difficult to scan.
|
|
76
76
|
*/
|
|
77
|
-
export const LONG_STACKTRACE_LIMIT
|
|
77
|
+
export declare const LONG_STACKTRACE_LIMIT = 100;
|
|
78
78
|
/**
|
|
79
79
|
* Where should the bidi websocket handler live on the server?
|
|
80
80
|
*/
|
|
81
|
-
export const BIDI_BASE_PATH
|
|
81
|
+
export declare const BIDI_BASE_PATH = "/bidi";
|
|
82
82
|
/**
|
|
83
83
|
* The name of the event for drivers to emit when they want to send bidi events to a client over
|
|
84
84
|
* a bidi socket
|
|
85
85
|
*/
|
|
86
|
-
export const BIDI_EVENT_NAME
|
|
86
|
+
export declare const BIDI_EVENT_NAME = "bidiEvent";
|
|
87
87
|
/**
|
|
88
88
|
* The name of the insecure feature that allows retrieving the list of active server sessions
|
|
89
89
|
*/
|
|
90
|
-
export const SESSION_DISCOVERY_FEATURE
|
|
90
|
+
export declare const SESSION_DISCOVERY_FEATURE = "session_discovery";
|
|
91
91
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../lib/constants.
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../lib/constants.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,WAAW,WAAW,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AAMrC,eAAO,MAAM,aAAa;;;;;;;EAOf,CAAC;AAEZ,eAAO,MAAM,cAAc;;;;EAIhB,CAAC;AAEZ,eAAO,MAAM,eAAe;;;EAGjB,CAAC;AAEZ,eAAO,MAAM,gBAAgB;;;;EAIlB,CAAC;AAMZ,eAAO,MAAM,aAAa;;;;;;;;;EAIf,CAAC;AAEZ;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAgD,CAAC;AAErF;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAqD,CAAC;AAE7F,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAC1C,eAAO,MAAM,sBAAsB,YAAY,CAAC;AAChD,eAAO,MAAM,wBAAwB,cAAc,CAAC;AACpD,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,kBAAkB,IAAI,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,yBAAyB,sBAAsB,CAAC"}
|