appium 2.0.0-beta.5 → 2.0.0-beta.52
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 +156 -63
- package/build/lib/appium.d.ts +226 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +694 -439
- package/build/lib/appium.js.map +1 -0
- package/build/lib/cli/args.d.ts +17 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +253 -319
- package/build/lib/cli/args.js.map +1 -0
- package/build/lib/cli/driver-command.d.ts +102 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +126 -81
- package/build/lib/cli/driver-command.js.map +1 -0
- package/build/lib/cli/extension-command.d.ts +385 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +731 -383
- package/build/lib/cli/extension-command.js.map +1 -0
- package/build/lib/cli/extension.d.ts +23 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +71 -54
- package/build/lib/cli/extension.js.map +1 -0
- package/build/lib/cli/parser.d.ts +84 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +240 -128
- package/build/lib/cli/parser.js.map +1 -0
- package/build/lib/cli/plugin-command.d.ts +99 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +120 -81
- package/build/lib/cli/plugin-command.js.map +1 -0
- package/build/lib/cli/utils.d.ts +29 -0
- package/build/lib/cli/utils.d.ts.map +1 -0
- package/build/lib/cli/utils.js +72 -51
- package/build/lib/cli/utils.js.map +1 -0
- package/build/lib/config-file.d.ts +100 -0
- package/build/lib/config-file.d.ts.map +1 -0
- package/build/lib/config-file.js +207 -0
- package/build/lib/config-file.js.map +1 -0
- package/build/lib/config.d.ts +49 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +265 -201
- package/build/lib/config.js.map +1 -0
- package/build/lib/constants.d.ts +49 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +66 -0
- package/build/lib/constants.js.map +1 -0
- package/build/lib/extension/driver-config.d.ts +82 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +212 -0
- package/build/lib/extension/driver-config.js.map +1 -0
- package/build/lib/extension/extension-config.d.ts +249 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +581 -0
- package/build/lib/extension/extension-config.js.map +1 -0
- package/build/lib/extension/index.d.ts +48 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +105 -0
- package/build/lib/extension/index.js.map +1 -0
- package/build/lib/extension/manifest-migrations.d.ts +27 -0
- package/build/lib/extension/manifest-migrations.d.ts.map +1 -0
- package/build/lib/extension/manifest-migrations.js +118 -0
- package/build/lib/extension/manifest-migrations.js.map +1 -0
- package/build/lib/extension/manifest.d.ts +145 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +521 -0
- package/build/lib/extension/manifest.js.map +1 -0
- package/build/lib/extension/package-changed.d.ts +11 -0
- package/build/lib/extension/package-changed.d.ts.map +1 -0
- package/build/lib/extension/package-changed.js +62 -0
- package/build/lib/extension/package-changed.js.map +1 -0
- package/build/lib/extension/plugin-config.d.ts +56 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +102 -0
- package/build/lib/extension/plugin-config.js.map +1 -0
- package/build/lib/grid-register.d.ts +10 -0
- package/build/lib/grid-register.d.ts.map +1 -0
- package/build/lib/grid-register.js +122 -144
- package/build/lib/grid-register.js.map +1 -0
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +5 -17
- package/build/lib/logger.js.map +1 -0
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +190 -187
- package/build/lib/logsink.js.map +1 -0
- package/build/lib/main.d.ts +62 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +348 -228
- package/build/lib/main.js.map +1 -0
- package/build/lib/schema/arg-spec.d.ts +143 -0
- package/build/lib/schema/arg-spec.d.ts.map +1 -0
- package/build/lib/schema/arg-spec.js +164 -0
- package/build/lib/schema/arg-spec.js.map +1 -0
- package/build/lib/schema/cli-args.d.ts +19 -0
- package/build/lib/schema/cli-args.d.ts.map +1 -0
- package/build/lib/schema/cli-args.js +217 -0
- package/build/lib/schema/cli-args.js.map +1 -0
- package/build/lib/schema/cli-transformers.d.ts +5 -0
- package/build/lib/schema/cli-transformers.d.ts.map +1 -0
- package/build/lib/schema/cli-transformers.js +124 -0
- package/build/lib/schema/cli-transformers.js.map +1 -0
- package/build/lib/schema/index.d.ts +3 -0
- package/build/lib/schema/index.d.ts.map +1 -0
- package/build/lib/schema/index.js +19 -0
- package/build/lib/schema/index.js.map +1 -0
- package/build/lib/schema/keywords.d.ts +24 -0
- package/build/lib/schema/keywords.d.ts.map +1 -0
- package/build/lib/schema/keywords.js +128 -0
- package/build/lib/schema/keywords.js.map +1 -0
- package/build/lib/schema/schema.d.ts +259 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +615 -0
- package/build/lib/schema/schema.js.map +1 -0
- package/build/lib/utils.d.ts +121 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +351 -273
- package/build/lib/utils.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/types/cli.d.ts +134 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/cli.js +3 -0
- package/build/types/cli.js.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +19 -0
- package/build/types/index.js.map +1 -0
- package/build/types/manifest/base.d.ts +135 -0
- package/build/types/manifest/base.d.ts.map +1 -0
- package/build/types/manifest/base.js +3 -0
- package/build/types/manifest/base.js.map +1 -0
- package/build/types/manifest/index.d.ts +19 -0
- package/build/types/manifest/index.d.ts.map +1 -0
- package/build/types/manifest/index.js +40 -0
- package/build/types/manifest/index.js.map +1 -0
- package/build/types/manifest/v3.d.ts +139 -0
- package/build/types/manifest/v3.d.ts.map +1 -0
- package/build/types/manifest/v3.js +3 -0
- package/build/types/manifest/v3.js.map +1 -0
- package/driver.d.ts +1 -0
- package/driver.js +14 -0
- package/index.js +11 -0
- package/lib/appium.js +535 -186
- package/lib/cli/args.js +267 -422
- package/lib/cli/driver-command.js +126 -23
- package/lib/cli/extension-command.js +679 -271
- package/lib/cli/extension.js +48 -17
- package/lib/cli/parser.js +263 -83
- package/lib/cli/plugin-command.js +115 -20
- package/lib/cli/utils.js +24 -10
- package/lib/config-file.js +220 -0
- package/lib/config.js +244 -110
- package/lib/constants.js +71 -0
- package/lib/extension/driver-config.js +250 -0
- package/lib/extension/extension-config.js +682 -0
- package/lib/extension/index.js +116 -0
- package/lib/extension/manifest-migrations.js +120 -0
- package/lib/extension/manifest.js +573 -0
- package/lib/extension/package-changed.js +64 -0
- package/lib/extension/plugin-config.js +112 -0
- package/lib/grid-register.js +49 -35
- package/lib/logger.js +1 -2
- package/lib/logsink.js +64 -38
- package/lib/main.js +321 -101
- package/lib/schema/arg-spec.js +229 -0
- package/lib/schema/cli-args.js +238 -0
- package/lib/schema/cli-transformers.js +119 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +136 -0
- package/lib/schema/schema.js +722 -0
- package/lib/utils.js +291 -167
- package/package.json +83 -84
- package/plugin.d.ts +1 -0
- package/plugin.js +13 -0
- package/scripts/autoinstall-extensions.js +237 -0
- package/support.d.ts +1 -0
- package/support.js +13 -0
- package/tsconfig.json +25 -0
- package/types/cli.ts +189 -0
- package/types/index.ts +20 -0
- package/types/manifest/README.md +30 -0
- package/types/manifest/base.ts +158 -0
- package/types/manifest/index.ts +27 -0
- package/types/manifest/v3.ts +161 -0
- package/CHANGELOG.md +0 -3515
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/npm.js +0 -208
- 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 -253
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -14
- package/lib/cli/npm.js +0 -184
- 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 -209
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -10
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
+
"version": "2.0.0-beta.52",
|
|
3
4
|
"description": "Automation for Apps.",
|
|
4
|
-
"
|
|
5
|
+
"keywords": [
|
|
5
6
|
"automation",
|
|
6
7
|
"javascript",
|
|
7
8
|
"selenium",
|
|
@@ -11,102 +12,100 @@
|
|
|
11
12
|
"firefoxos",
|
|
12
13
|
"testing"
|
|
13
14
|
],
|
|
14
|
-
"
|
|
15
|
-
"author": "https://github.com/appium",
|
|
16
|
-
"license": "Apache-2.0",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/appium/appium.git"
|
|
20
|
-
},
|
|
15
|
+
"homepage": "https://appium.io",
|
|
21
16
|
"bugs": {
|
|
22
17
|
"url": "https://github.com/appium/appium/issues"
|
|
23
18
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/appium/appium.git",
|
|
22
|
+
"directory": "packages/appium"
|
|
27
23
|
},
|
|
28
|
-
"
|
|
24
|
+
"license": "Apache-2.0",
|
|
25
|
+
"author": "https://github.com/appium",
|
|
26
|
+
"types": "./build/lib/main.d.ts",
|
|
29
27
|
"bin": {
|
|
30
|
-
"appium": "
|
|
28
|
+
"appium": "index.js"
|
|
31
29
|
},
|
|
32
30
|
"directories": {
|
|
33
|
-
"lib": "./lib"
|
|
34
|
-
"doc": "./docs"
|
|
31
|
+
"lib": "./lib"
|
|
35
32
|
},
|
|
36
33
|
"files": [
|
|
37
|
-
"bin",
|
|
38
34
|
"lib",
|
|
39
|
-
"build
|
|
40
|
-
"
|
|
35
|
+
"build",
|
|
36
|
+
"index.js",
|
|
37
|
+
"driver.*",
|
|
38
|
+
"support.*",
|
|
39
|
+
"plugin.*",
|
|
40
|
+
"scripts/autoinstall-extensions.js",
|
|
41
|
+
"types",
|
|
42
|
+
"tsconfig.json"
|
|
41
43
|
],
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build:docs": "node docs/scripts/build-docs.js",
|
|
46
|
+
"build:docs:assets": "node docs/scripts/copy-assets.js",
|
|
47
|
+
"build:docs:cli": "node docs/scripts/gen-cli-args-docs.js",
|
|
48
|
+
"build:docs:reference": "node docs/scripts/build-reference.js",
|
|
49
|
+
"dev:docs": "npm run build:docs:assets && npm run dev:docs:en",
|
|
50
|
+
"dev:docs:en": "mkdocs serve -f ./docs/mkdocs-en.yml",
|
|
51
|
+
"dev:docs:ja": "mkdocs serve -f ./docs/mkdocs-ja.yml",
|
|
52
|
+
"dev:docs:zh": "mkdocs serve -f ./docs/mkdocs-zh.yml",
|
|
53
|
+
"postinstall": "node ./scripts/autoinstall-extensions.js",
|
|
54
|
+
"publish:docs": "cross-env APPIUM_DOCS_PUBLISH=1 npm run build:docs",
|
|
55
|
+
"test": "npm run test:unit",
|
|
56
|
+
"test:e2e": "mocha -p --timeout 1m --slow 30s \"./test/e2e/**/*.spec.js\"",
|
|
57
|
+
"test:smoke": "cross-env APPIUM_HOME=./local_appium_home node ./index.js driver install uiautomator2 && cross-env APPIUM_HOME=./local_appium_home node ./index.js driver list",
|
|
58
|
+
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
59
|
+
},
|
|
42
60
|
"dependencies": {
|
|
43
|
-
"@appium/base-
|
|
44
|
-
"@
|
|
45
|
-
"appium
|
|
46
|
-
"appium
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"bluebird": "3.
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
61
|
+
"@appium/base-driver": "^9.2.3",
|
|
62
|
+
"@appium/base-plugin": "^2.1.3",
|
|
63
|
+
"@appium/docutils": "^0.1.5",
|
|
64
|
+
"@appium/schema": "^0.2.3",
|
|
65
|
+
"@appium/support": "^3.1.3",
|
|
66
|
+
"@appium/types": "^0.8.3",
|
|
67
|
+
"@sidvind/better-ajv-errors": "2.1.0",
|
|
68
|
+
"@types/argparse": "2.0.10",
|
|
69
|
+
"@types/bluebird": "3.5.38",
|
|
70
|
+
"@types/fancy-log": "2.0.0",
|
|
71
|
+
"@types/semver": "7.3.13",
|
|
72
|
+
"@types/teen_process": "2.0.0",
|
|
73
|
+
"@types/wrap-ansi": "3.0.0",
|
|
74
|
+
"ajv": "8.12.0",
|
|
75
|
+
"ajv-formats": "2.1.1",
|
|
76
|
+
"argparse": "2.0.1",
|
|
77
|
+
"async-lock": "1.4.0",
|
|
78
|
+
"asyncbox": "2.9.4",
|
|
79
|
+
"axios": "1.2.2",
|
|
80
|
+
"bluebird": "3.7.2",
|
|
81
|
+
"cross-env": "7.0.3",
|
|
82
|
+
"find-up": "5.0.0",
|
|
83
|
+
"glob": "8.0.3",
|
|
84
|
+
"lilconfig": "2.0.6",
|
|
85
|
+
"lodash": "4.17.21",
|
|
86
|
+
"longjohn": "0.2.12",
|
|
87
|
+
"npmlog": "7.0.1",
|
|
88
|
+
"ora": "5.4.1",
|
|
89
|
+
"package-changed": "1.9.0",
|
|
90
|
+
"resolve-from": "5.0.0",
|
|
91
|
+
"semver": "7.3.8",
|
|
92
|
+
"source-map-support": "0.5.21",
|
|
93
|
+
"teen_process": "2.0.2",
|
|
94
|
+
"type-fest": "3.5.1",
|
|
95
|
+
"winston": "3.8.2",
|
|
96
|
+
"wrap-ansi": "7.0.0",
|
|
97
|
+
"yaml": "2.2.1"
|
|
65
98
|
},
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"prepublishOnly": "npm run prune-shrinkwrap && gulp fixShrinkwrap",
|
|
70
|
-
"postpublish": "npm run restore-shrinkwrap",
|
|
71
|
-
"prune-shrinkwrap": "!(test -e npm-shrinkwrap.json) || (npm ci --production --ignore-scripts && npm run backup-shrinkwrap && npm shrinkwrap && npm install --only=dev --no-shrinkwrap)",
|
|
72
|
-
"restore-shrinkwrap": "!(test -e npm-shrinkwrap.json) || (mv npm-shrinkwrap-backup.json npm-shrinkwrap.json)",
|
|
73
|
-
"backup-shrinkwrap": "mv npm-shrinkwrap.json npm-shrinkwrap-backup.json",
|
|
74
|
-
"check-pruned-shrinkwrap": "node check-pruned-shrinkwrap.js",
|
|
75
|
-
"test": "gulp once",
|
|
76
|
-
"e2e-test": "gulp e2e-test",
|
|
77
|
-
"watch": "gulp watch",
|
|
78
|
-
"build": "gulp transpile",
|
|
79
|
-
"mocha": "mocha",
|
|
80
|
-
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
|
|
81
|
-
"precommit-test": "REPORTER=dot gulp once",
|
|
82
|
-
"lint": "gulp lint",
|
|
83
|
-
"lint:fix": "gulp lint --fix",
|
|
84
|
-
"coverage": "gulp coveralls",
|
|
85
|
-
"generate-docs": "node ./build/commands-yml/parse.js",
|
|
86
|
-
"zip": "zip -qr appium.zip .",
|
|
87
|
-
"upload": "gulp github-upload",
|
|
88
|
-
"zip-and-upload": "npm run zip && npm run upload",
|
|
89
|
-
"authorize-ios": "authorize-ios"
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
|
101
|
+
"npm": ">=8"
|
|
90
102
|
},
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
"
|
|
98
|
-
"appium-gulp-plugins": "^5.2.1",
|
|
99
|
-
"chai": "4.x",
|
|
100
|
-
"chai-as-promised": "7.x",
|
|
101
|
-
"eslint-config-appium": "^4.0.1",
|
|
102
|
-
"fancy-log": "^1.3.2",
|
|
103
|
-
"gulp": "^4.0.0",
|
|
104
|
-
"handlebars": "^4.2.0",
|
|
105
|
-
"mocha": "^8.0.1",
|
|
106
|
-
"pre-commit": "1.x",
|
|
107
|
-
"sinon": "^9.0.0",
|
|
108
|
-
"validate.js": "^0.13.0",
|
|
109
|
-
"wd": "^1.10.0",
|
|
110
|
-
"yaml-js": "^0.2.0"
|
|
103
|
+
"publishConfig": {
|
|
104
|
+
"access": "public",
|
|
105
|
+
"tag": "next"
|
|
106
|
+
},
|
|
107
|
+
"gitHead": "67c9bdfbceeb049aa134bf1d9b107543ff0a80b0",
|
|
108
|
+
"typedoc": {
|
|
109
|
+
"entryPoint": "./lib/main.js"
|
|
111
110
|
}
|
|
112
111
|
}
|
package/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@appium/base-plugin';
|
package/plugin.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// @ts-check
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This module is here to re-export `@appium/base-plugin` for Appium extensions.
|
|
7
|
+
*
|
|
8
|
+
* @see https://npm.im/@appium/base-plugin
|
|
9
|
+
* @example
|
|
10
|
+
* const { BasePlugin } = require('appium/plugin');
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
module.exports = require('@appium/base-plugin');
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/* eslint-disable no-console, promise/prefer-await-to-then */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This script is intended to be run as a `postinstall` lifecycle script,
|
|
7
|
+
* and will automatically install extensions if requested by the user.
|
|
8
|
+
*
|
|
9
|
+
* If the current working directory is within a project which has `appium`
|
|
10
|
+
* as a dependency, this script does nothing; extensions must be managed
|
|
11
|
+
* via `npm` or another package manager.
|
|
12
|
+
*
|
|
13
|
+
* If `CI=1` is in the environment, this script will exit with a non-zero
|
|
14
|
+
* code upon failure (which will typically break a build). Otherwise, it
|
|
15
|
+
* will always exit with code 0, even if errors occur.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
* @example
|
|
19
|
+
* `npm install -g appium --drivers=uiautomator2,xcuitest --plugins=images`
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const {exec} = require('teen_process');
|
|
24
|
+
const B = require('bluebird');
|
|
25
|
+
|
|
26
|
+
B.config({
|
|
27
|
+
cancellation: true,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This is only used if we're actually in the monorepo
|
|
32
|
+
*/
|
|
33
|
+
const MONOREPO_ROOT = path.join(__dirname, '..', '..', '..');
|
|
34
|
+
|
|
35
|
+
/** @type {import('../lib/cli/extension').runExtensionCommand} */
|
|
36
|
+
let runExtensionCommand;
|
|
37
|
+
/** @type {import('../lib/constants').DRIVER_TYPE} */
|
|
38
|
+
let DRIVER_TYPE;
|
|
39
|
+
/** @type {import('../lib/constants').PLUGIN_TYPE} */
|
|
40
|
+
let PLUGIN_TYPE;
|
|
41
|
+
/** @type {import('../lib/extension').loadExtensions} */
|
|
42
|
+
let loadExtensions;
|
|
43
|
+
|
|
44
|
+
const _ = require('lodash');
|
|
45
|
+
const wrap = _.partial(
|
|
46
|
+
require('wrap-ansi'),
|
|
47
|
+
_,
|
|
48
|
+
process.stderr.columns ?? process.stdout.columns ?? 80
|
|
49
|
+
);
|
|
50
|
+
const ora = require('ora');
|
|
51
|
+
|
|
52
|
+
let env, util, logger;
|
|
53
|
+
|
|
54
|
+
function log(message) {
|
|
55
|
+
console.error(wrap(`[Appium] ${message}`));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function init() {
|
|
59
|
+
/** @type {import('ora').Ora} */
|
|
60
|
+
let spinner;
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
({env, util, logger} = require('@appium/support'));
|
|
64
|
+
require('..');
|
|
65
|
+
} catch {
|
|
66
|
+
spinner = ora({
|
|
67
|
+
text: 'Building Appium dev environment...',
|
|
68
|
+
prefixText: '[Appium]',
|
|
69
|
+
}).start();
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
const {stderr, code} = await exec('npm', ['run', 'build'], {
|
|
73
|
+
cwd: MONOREPO_ROOT,
|
|
74
|
+
encoding: 'utf8',
|
|
75
|
+
});
|
|
76
|
+
if (!code) {
|
|
77
|
+
spinner.succeed('Appium build successfully.');
|
|
78
|
+
} else {
|
|
79
|
+
spinner.fail(`Building Appium failed!`);
|
|
80
|
+
log(stderr);
|
|
81
|
+
}
|
|
82
|
+
} catch (err) {
|
|
83
|
+
spinner.fail(`Building Appium failed!`);
|
|
84
|
+
log(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
spinner = ora({
|
|
89
|
+
text: 'Checking Appium installation...',
|
|
90
|
+
prefixText: '[Appium]',
|
|
91
|
+
}).start();
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
({env, util, logger} = require('@appium/support'));
|
|
95
|
+
({runExtensionCommand} = require('../build/lib/cli/extension'));
|
|
96
|
+
({DRIVER_TYPE, PLUGIN_TYPE} = require('../build/lib/constants'));
|
|
97
|
+
({loadExtensions} = require('../build/lib/extension'));
|
|
98
|
+
spinner.succeed('Appium installation OK');
|
|
99
|
+
// suppress logs from Appium, which mess up the script output
|
|
100
|
+
logger.getLogger('Appium').level = 'error';
|
|
101
|
+
} catch (e) {
|
|
102
|
+
spinner.fail(`Could not load required module(s); has Appium been built? (${e.message})`);
|
|
103
|
+
if (process.env.CI) {
|
|
104
|
+
log('Detected CI environment, exiting with code 1');
|
|
105
|
+
process.exitCode = 1;
|
|
106
|
+
} else {
|
|
107
|
+
process.exitCode = 0;
|
|
108
|
+
}
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function main() {
|
|
116
|
+
if (!(await init())) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// if we're doing `npm install -g appium` then we will assume we don't have a local appium.
|
|
121
|
+
if (!process.env.npm_config_global && (await env.hasAppiumDependency())) {
|
|
122
|
+
log(`Found local Appium installation; skipping automatic installation of extensions.`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const driverEnv = process.env.npm_config_drivers;
|
|
127
|
+
const pluginEnv = process.env.npm_config_plugins;
|
|
128
|
+
|
|
129
|
+
const spinner = ora({
|
|
130
|
+
text: 'Looking for extensions to automatically install...',
|
|
131
|
+
prefixText: '[Appium]',
|
|
132
|
+
}).start();
|
|
133
|
+
|
|
134
|
+
if (!driverEnv && !pluginEnv) {
|
|
135
|
+
spinner.succeed(
|
|
136
|
+
wrap(`No drivers or plugins to automatically install.
|
|
137
|
+
If desired, provide arguments with comma-separated values "--drivers=<known_driver>[,known_driver...]" and/or "--plugins=<known_plugin>[,known_plugin...]" to the "npm install appium" command. The specified extensions will be installed automatically with Appium. Note: to see the list of known extensions, run "appium <driver|plugin> list".`)
|
|
138
|
+
);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const specs = [
|
|
143
|
+
[DRIVER_TYPE, driverEnv],
|
|
144
|
+
[PLUGIN_TYPE, pluginEnv],
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
spinner.start('Resolving Appium home directory...');
|
|
148
|
+
const appiumHome = await env.resolveAppiumHome();
|
|
149
|
+
spinner.succeed(`Found Appium home: ${appiumHome}`);
|
|
150
|
+
|
|
151
|
+
spinner.start(`Loading extension data...`);
|
|
152
|
+
const {driverConfig, pluginConfig} = await loadExtensions(appiumHome);
|
|
153
|
+
spinner.succeed(`Loaded extension data.`);
|
|
154
|
+
|
|
155
|
+
const installedStats = {[DRIVER_TYPE]: 0, [PLUGIN_TYPE]: 0};
|
|
156
|
+
for (const [type, extEnv] of specs) {
|
|
157
|
+
if (extEnv) {
|
|
158
|
+
for await (let ext of extEnv.split(',')) {
|
|
159
|
+
ext = ext.trim();
|
|
160
|
+
try {
|
|
161
|
+
await checkAndInstallExtension({
|
|
162
|
+
runExtensionCommand,
|
|
163
|
+
appiumHome,
|
|
164
|
+
type,
|
|
165
|
+
ext,
|
|
166
|
+
driverConfig,
|
|
167
|
+
pluginConfig,
|
|
168
|
+
spinner,
|
|
169
|
+
});
|
|
170
|
+
installedStats[type]++;
|
|
171
|
+
} catch (e) {
|
|
172
|
+
spinner.fail(`Could not install ${type} "${ext}": ${e.message}`);
|
|
173
|
+
if (process.env.CI) {
|
|
174
|
+
process.exitCode = 1;
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
spinner.succeed(
|
|
182
|
+
`Done. ${installedStats[DRIVER_TYPE]} ${util.pluralize(
|
|
183
|
+
'driver',
|
|
184
|
+
installedStats[DRIVER_TYPE]
|
|
185
|
+
)} and ${installedStats[PLUGIN_TYPE]} ${util.pluralize(
|
|
186
|
+
'plugin',
|
|
187
|
+
installedStats[PLUGIN_TYPE]
|
|
188
|
+
)} are installed.`
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
async function checkAndInstallExtension({
|
|
193
|
+
runExtensionCommand,
|
|
194
|
+
appiumHome,
|
|
195
|
+
type,
|
|
196
|
+
ext,
|
|
197
|
+
driverConfig,
|
|
198
|
+
pluginConfig,
|
|
199
|
+
spinner,
|
|
200
|
+
}) {
|
|
201
|
+
const extList = await runExtensionCommand(
|
|
202
|
+
{
|
|
203
|
+
appiumHome,
|
|
204
|
+
[`${type}Command`]: 'list',
|
|
205
|
+
showInstalled: true,
|
|
206
|
+
suppressOutput: true,
|
|
207
|
+
},
|
|
208
|
+
type === DRIVER_TYPE ? driverConfig : pluginConfig
|
|
209
|
+
);
|
|
210
|
+
if (extList[ext]) {
|
|
211
|
+
spinner.info(`The ${type} "${ext}" is already installed.`);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
spinner.start(`Installing ${type} "${ext}"...`);
|
|
215
|
+
await runExtensionCommand(
|
|
216
|
+
{
|
|
217
|
+
appiumHome,
|
|
218
|
+
[`${type}Command`]: 'install',
|
|
219
|
+
suppressOutput: true,
|
|
220
|
+
[type]: ext,
|
|
221
|
+
},
|
|
222
|
+
type === DRIVER_TYPE ? driverConfig : pluginConfig
|
|
223
|
+
);
|
|
224
|
+
spinner.succeed(`Installed ${type} "${ext}".`);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (require.main === module) {
|
|
228
|
+
main().catch((e) => {
|
|
229
|
+
log(e);
|
|
230
|
+
if (process.env.CI) {
|
|
231
|
+
log('Detected CI environment, exiting with code 1');
|
|
232
|
+
process.exitCode = 1;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
module.exports = main;
|
package/support.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@appium/support';
|
package/support.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// @ts-check
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This module is here to re-export `@appium/support` for Appium extensions.
|
|
7
|
+
*
|
|
8
|
+
* @see https://npm.im/@appium/support
|
|
9
|
+
* @example
|
|
10
|
+
* const { fs, npm } = require('appium/support');
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
module.exports = require('@appium/support');
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@appium/tsconfig/tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"rootDir": ".",
|
|
5
|
+
"outDir": "build",
|
|
6
|
+
"paths": {
|
|
7
|
+
"@appium/support": ["../support"],
|
|
8
|
+
"@appium/base-driver": ["../base-driver"],
|
|
9
|
+
"@appium/base-plugin": ["../base-plugin"],
|
|
10
|
+
"@appium/types": ["../types"],
|
|
11
|
+
"@appium/schema": ["../schema"],
|
|
12
|
+
"appium": ["."]
|
|
13
|
+
},
|
|
14
|
+
"checkJs": true
|
|
15
|
+
},
|
|
16
|
+
"include": ["lib", "types"],
|
|
17
|
+
"references": [
|
|
18
|
+
{"path": "../schema"},
|
|
19
|
+
{"path": "../types"},
|
|
20
|
+
{"path": "../support"},
|
|
21
|
+
{"path": "../base-driver"},
|
|
22
|
+
{"path": "../base-plugin"},
|
|
23
|
+
{"path": "../test-support"}
|
|
24
|
+
]
|
|
25
|
+
}
|
package/types/cli.ts
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {DriverType, PluginType, ServerArgs} from '@appium/types';
|
|
2
|
+
import {SetOptional} from 'type-fest';
|
|
3
|
+
import {InstallType} from './manifest';
|
|
4
|
+
export type ServerCommand = 'server';
|
|
5
|
+
export type DriverCommand = DriverType;
|
|
6
|
+
export type PluginCommand = PluginType;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Extension-specific commands
|
|
10
|
+
*/
|
|
11
|
+
export type CliExtensionCommand = DriverCommand | PluginCommand;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Possible commands for the `appium` CLI.
|
|
15
|
+
*/
|
|
16
|
+
export type CliCommand = ServerCommand | CliExtensionCommand;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Possible subcommands of {@linkcode DriverCommand} or
|
|
20
|
+
* {@linkcode PluginCommand}.
|
|
21
|
+
*/
|
|
22
|
+
export type CliExtensionSubcommand = 'install' | 'list' | 'run' | 'uninstall' | 'update';
|
|
23
|
+
|
|
24
|
+
export interface CliExtensionSubcommandListArgs {
|
|
25
|
+
showInstalled?: boolean;
|
|
26
|
+
showUpdates?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CliExtensionSubcommandInstallArgs {
|
|
30
|
+
installType: InstallType;
|
|
31
|
+
packageName?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface CliExtensionSubcommandUpdateArgs {
|
|
35
|
+
unsafe?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Random stuff that may appear in the parsed args which has no equivalent in a
|
|
40
|
+
* config file.
|
|
41
|
+
*/
|
|
42
|
+
export interface MoreArgs {
|
|
43
|
+
/**
|
|
44
|
+
* Possible subcommands. If empty, defaults to {@linkcode ServerCommand}.
|
|
45
|
+
*/
|
|
46
|
+
subcommand?: CliCommand;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Path to config file, if any. Does not make sense for this to be allowed in a config file!
|
|
50
|
+
*/
|
|
51
|
+
configFile?: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* If true, show the config and exit
|
|
55
|
+
*/
|
|
56
|
+
showConfig?: boolean;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* If true, open a REPL
|
|
60
|
+
*/
|
|
61
|
+
shell?: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* These arguments are _not_ supported by the CLI, but only via programmatic usage / tests.
|
|
66
|
+
*/
|
|
67
|
+
export interface ProgrammaticArgs {
|
|
68
|
+
/**
|
|
69
|
+
* If `true`, throw on error instead of exit.
|
|
70
|
+
*/
|
|
71
|
+
throwInsteadOfExit?: boolean;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Seems to only be used in tests or standalone driver calls
|
|
75
|
+
*/
|
|
76
|
+
logHandler?: (...args: any[]) => void;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Alternate way to set `APPIUM_HOME` for tests. Since we don't want to muck about
|
|
80
|
+
* with the environment, we just set it here.
|
|
81
|
+
*
|
|
82
|
+
* Setting this means that any discovery of the proper `APPIUM_HOME` path is bypassed
|
|
83
|
+
* and is equivalent to setting `APPIUM_HOME` in the environment.
|
|
84
|
+
*/
|
|
85
|
+
appiumHome?: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* If true, show the {@link BuildInfo build info} and exit
|
|
89
|
+
*/
|
|
90
|
+
showBuildInfo?: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* If true, show config and exit
|
|
94
|
+
*/
|
|
95
|
+
showConfig?: boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface DriverExtArgs {
|
|
99
|
+
driverCommand: CliExtensionSubcommand;
|
|
100
|
+
driver?: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface PluginExtArgs {
|
|
104
|
+
pluginCommand: CliExtensionSubcommand;
|
|
105
|
+
plugin?: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* These are args which the user will specify if using an extension command
|
|
110
|
+
*/
|
|
111
|
+
export interface BaseExtArgs<Cmd extends CliExtensionCommand> {
|
|
112
|
+
subcommand: Cmd;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Output JSON instead of human-readable text
|
|
116
|
+
*/
|
|
117
|
+
json?: boolean;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Output nothing
|
|
121
|
+
*/
|
|
122
|
+
suppressOutput?: boolean;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Extra args to pass to extension scripts
|
|
126
|
+
*/
|
|
127
|
+
extraArgs?: string[];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Args for extension commands; includes a subcommand
|
|
132
|
+
*/
|
|
133
|
+
export type ExtArgs<
|
|
134
|
+
Cmd extends CliExtensionCommand,
|
|
135
|
+
SubCmd extends CliExtensionSubcommand
|
|
136
|
+
> = BaseExtArgs<Cmd> &
|
|
137
|
+
(Cmd extends DriverCommand ? DriverExtArgs : Cmd extends PluginCommand ? PluginExtArgs : never) &
|
|
138
|
+
(SubCmd extends 'install'
|
|
139
|
+
? CliExtensionSubcommandInstallArgs
|
|
140
|
+
: SubCmd extends 'list'
|
|
141
|
+
? CliExtensionSubcommandListArgs
|
|
142
|
+
: SubCmd extends 'update'
|
|
143
|
+
? CliExtensionSubcommandUpdateArgs
|
|
144
|
+
: never);
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Some generic bits of arguments; should not be used outside this declaration
|
|
148
|
+
*/
|
|
149
|
+
export type CommonArgs<
|
|
150
|
+
Cmd extends CliCommand = ServerCommand,
|
|
151
|
+
SubCmd extends CliExtensionSubcommand | void = void
|
|
152
|
+
> = MoreArgs &
|
|
153
|
+
ProgrammaticArgs &
|
|
154
|
+
(Cmd extends ServerCommand
|
|
155
|
+
? ServerArgs
|
|
156
|
+
: Cmd extends CliExtensionCommand
|
|
157
|
+
? SubCmd extends CliExtensionSubcommand
|
|
158
|
+
? ExtArgs<Cmd, SubCmd>
|
|
159
|
+
: never
|
|
160
|
+
: never);
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Fully-parsed arguments, containing defaults, computed args, and config file values.
|
|
164
|
+
*/
|
|
165
|
+
export type ParsedArgs<
|
|
166
|
+
Cmd extends CliCommand = ServerCommand,
|
|
167
|
+
SubCmd extends CliExtensionSubcommand | void = void
|
|
168
|
+
> = CommonArgs<Cmd, SubCmd>;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Like {@linkcode ParsedArgs} except server arguments are all optional.
|
|
172
|
+
*
|
|
173
|
+
* _May_ have defaults applied; _may_ contain config values; _may_ contain computed args.
|
|
174
|
+
*/
|
|
175
|
+
export type Args<
|
|
176
|
+
Cmd extends CliCommand = ServerCommand,
|
|
177
|
+
SubCmd extends CliExtensionSubcommand | void = void
|
|
178
|
+
> = Cmd extends ServerCommand
|
|
179
|
+
? SetOptional<CommonArgs<Cmd>, keyof ServerArgs>
|
|
180
|
+
: ParsedArgs<Cmd, SubCmd>;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Shown by `appium --build-info`
|
|
184
|
+
*/
|
|
185
|
+
export type BuildInfo = {
|
|
186
|
+
version: string;
|
|
187
|
+
'git-sha'?: string;
|
|
188
|
+
built?: string;
|
|
189
|
+
};
|