appium 2.0.0-beta.2 → 2.0.0-beta.20
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 +9 -9
- package/build/lib/appium-config.schema.json +0 -0
- package/build/lib/appium.js +157 -53
- package/build/lib/cli/argparse-actions.js +104 -0
- package/build/lib/cli/args.js +115 -279
- package/build/lib/cli/driver-command.js +11 -1
- package/build/lib/cli/extension-command.js +60 -8
- package/build/lib/cli/extension.js +30 -7
- package/build/lib/cli/npm.js +17 -14
- package/build/lib/cli/parser.js +152 -89
- package/build/lib/cli/plugin-command.js +11 -1
- package/build/lib/cli/utils.js +29 -3
- package/build/lib/config-file.js +141 -0
- package/build/lib/config.js +76 -61
- package/build/lib/driver-config.js +42 -19
- package/build/lib/drivers.js +8 -4
- package/build/lib/ext-config-io.js +165 -0
- package/build/lib/extension-config.js +130 -61
- package/build/lib/grid-register.js +22 -24
- package/build/lib/logger.js +3 -3
- package/build/lib/logsink.js +11 -13
- package/build/lib/main.js +197 -77
- package/build/lib/plugin-config.js +20 -10
- package/build/lib/plugins.js +4 -2
- package/build/lib/schema/appium-config-schema.js +252 -0
- package/build/lib/schema/arg-spec.js +120 -0
- package/build/lib/schema/cli-args.js +173 -0
- package/build/lib/schema/cli-transformers.js +76 -0
- package/build/lib/schema/index.js +36 -0
- package/build/lib/schema/keywords.js +62 -0
- package/build/lib/schema/schema.js +357 -0
- package/build/lib/utils.js +44 -99
- package/lib/appium-config.schema.json +277 -0
- package/lib/appium.js +201 -65
- package/lib/cli/argparse-actions.js +77 -0
- package/lib/cli/args.js +174 -375
- package/lib/cli/driver-command.js +4 -0
- package/lib/cli/extension-command.js +70 -5
- package/lib/cli/extension.js +25 -5
- package/lib/cli/npm.js +18 -12
- package/lib/cli/parser.js +254 -79
- package/lib/cli/plugin-command.js +4 -0
- package/lib/cli/utils.js +21 -1
- package/lib/config-file.js +227 -0
- package/lib/config.js +109 -62
- package/lib/driver-config.js +66 -11
- package/lib/drivers.js +4 -1
- package/lib/ext-config-io.js +287 -0
- package/lib/extension-config.js +225 -67
- package/lib/grid-register.js +27 -24
- package/lib/logger.js +1 -1
- package/lib/logsink.js +10 -7
- package/lib/main.js +211 -77
- package/lib/plugin-config.js +34 -5
- package/lib/plugins.js +1 -0
- package/lib/schema/appium-config-schema.js +286 -0
- package/lib/schema/arg-spec.js +218 -0
- package/lib/schema/cli-args.js +273 -0
- package/lib/schema/cli-transformers.js +123 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +119 -0
- package/lib/schema/schema.js +577 -0
- package/lib/utils.js +42 -88
- package/package.json +55 -80
- package/postinstall.js +71 -0
- package/types/appium-config.d.ts +197 -0
- package/types/types.d.ts +201 -0
- package/CHANGELOG.md +0 -3515
- package/build/lib/cli/parser-helpers.js +0 -82
- package/lib/cli/parser-helpers.js +0 -79
package/lib/utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import logger from './logger';
|
|
3
|
-
import { processCapabilities, PROTOCOLS } from 'appium
|
|
4
|
-
import
|
|
3
|
+
import { processCapabilities, PROTOCOLS } from '@appium/base-driver';
|
|
4
|
+
import { fs } from '@appium/support';
|
|
5
5
|
|
|
6
6
|
const W3C_APPIUM_PREFIX = 'appium';
|
|
7
7
|
|
|
@@ -47,19 +47,19 @@ function parseCapsForInnerDriver (jsonwpCapabilities, w3cCapabilities, constrain
|
|
|
47
47
|
const hasW3CCaps = _.isPlainObject(w3cCapabilities) &&
|
|
48
48
|
(_.has(w3cCapabilities, 'alwaysMatch') || _.has(w3cCapabilities, 'firstMatch'));
|
|
49
49
|
const hasJSONWPCaps = _.isPlainObject(jsonwpCapabilities);
|
|
50
|
-
let protocol = null;
|
|
51
50
|
let desiredCaps = {};
|
|
52
51
|
let processedW3CCapabilities = null;
|
|
53
52
|
let processedJsonwpCapabilities = null;
|
|
54
53
|
|
|
55
|
-
if (!
|
|
54
|
+
if (!hasW3CCaps) {
|
|
56
55
|
return {
|
|
57
56
|
protocol: PROTOCOLS.W3C,
|
|
58
|
-
error: new Error('
|
|
57
|
+
error: new Error('W3C capabilities should be provided'),
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
const {W3C
|
|
61
|
+
const {W3C} = PROTOCOLS;
|
|
62
|
+
const protocol = W3C;
|
|
63
63
|
|
|
64
64
|
// Make sure we don't mutate the original arguments
|
|
65
65
|
jsonwpCapabilities = _.cloneDeep(jsonwpCapabilities);
|
|
@@ -101,56 +101,24 @@ function parseCapsForInnerDriver (jsonwpCapabilities, w3cCapabilities, constrain
|
|
|
101
101
|
|
|
102
102
|
// Get MJSONWP caps
|
|
103
103
|
if (hasJSONWPCaps) {
|
|
104
|
-
protocol = MJSONWP;
|
|
105
|
-
desiredCaps = jsonwpCapabilities;
|
|
106
104
|
processedJsonwpCapabilities = {...jsonwpCapabilities};
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
// Get W3C caps
|
|
110
108
|
if (hasW3CCaps) {
|
|
111
|
-
protocol = W3C;
|
|
112
109
|
// Call the process capabilities algorithm to find matching caps on the W3C
|
|
113
110
|
// (see: https://github.com/jlipps/simple-wd-spec#processing-capabilities)
|
|
114
|
-
let isFixingNeededForW3cCaps = false;
|
|
115
111
|
try {
|
|
116
112
|
desiredCaps = processCapabilities(w3cCapabilities, constraints, true);
|
|
117
113
|
} catch (error) {
|
|
118
|
-
if (!hasJSONWPCaps) {
|
|
119
|
-
return {
|
|
120
|
-
desiredCaps,
|
|
121
|
-
processedJsonwpCapabilities,
|
|
122
|
-
processedW3CCapabilities,
|
|
123
|
-
protocol,
|
|
124
|
-
error,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
114
|
logger.info(`Could not parse W3C capabilities: ${error.message}`);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
`in W3C capabilities: ${JSON.stringify(differingKeys)}`);
|
|
136
|
-
isFixingNeededForW3cCaps = true;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (isFixingNeededForW3cCaps && hasJSONWPCaps) {
|
|
141
|
-
logger.info('Trying to fix W3C capabilities by merging them with JSONWP caps');
|
|
142
|
-
w3cCapabilities = fixW3cCapabilities(w3cCapabilities, jsonwpCapabilities);
|
|
143
|
-
try {
|
|
144
|
-
desiredCaps = processCapabilities(w3cCapabilities, constraints, true);
|
|
145
|
-
} catch (error) {
|
|
146
|
-
logger.warn(`Could not parse fixed W3C capabilities: ${error.message}. Falling back to JSONWP protocol`);
|
|
147
|
-
return {
|
|
148
|
-
desiredCaps: processedJsonwpCapabilities,
|
|
149
|
-
processedJsonwpCapabilities,
|
|
150
|
-
processedW3CCapabilities: null,
|
|
151
|
-
protocol: MJSONWP,
|
|
152
|
-
};
|
|
153
|
-
}
|
|
115
|
+
return {
|
|
116
|
+
desiredCaps,
|
|
117
|
+
processedJsonwpCapabilities,
|
|
118
|
+
processedW3CCapabilities,
|
|
119
|
+
protocol,
|
|
120
|
+
error,
|
|
121
|
+
};
|
|
154
122
|
}
|
|
155
123
|
|
|
156
124
|
// Create a new w3c capabilities payload that contains only the matching caps in `alwaysMatch`
|
|
@@ -163,47 +131,6 @@ function parseCapsForInnerDriver (jsonwpCapabilities, w3cCapabilities, constrain
|
|
|
163
131
|
return {desiredCaps, processedJsonwpCapabilities, processedW3CCapabilities, protocol};
|
|
164
132
|
}
|
|
165
133
|
|
|
166
|
-
/**
|
|
167
|
-
* This helper method tries to fix corrupted W3C capabilities by
|
|
168
|
-
* merging them to existing JSONWP capabilities.
|
|
169
|
-
*
|
|
170
|
-
* @param {Object} w3cCaps W3C capabilities
|
|
171
|
-
* @param {Object} jsonwpCaps JSONWP capabilities
|
|
172
|
-
* @return {Object} Fixed W3C capabilities
|
|
173
|
-
*/
|
|
174
|
-
function fixW3cCapabilities (w3cCaps, jsonwpCaps) {
|
|
175
|
-
const result = {
|
|
176
|
-
firstMatch: w3cCaps.firstMatch || [],
|
|
177
|
-
alwaysMatch: w3cCaps.alwaysMatch || {},
|
|
178
|
-
};
|
|
179
|
-
const keysToInsert = _.keys(jsonwpCaps);
|
|
180
|
-
const removeMatchingKeys = (match) => {
|
|
181
|
-
_.pull(keysToInsert, match);
|
|
182
|
-
const colonIndex = match.indexOf(':');
|
|
183
|
-
if (colonIndex >= 0 && match.length > colonIndex) {
|
|
184
|
-
_.pull(keysToInsert, match.substring(colonIndex + 1));
|
|
185
|
-
}
|
|
186
|
-
if (keysToInsert.includes(`${W3C_APPIUM_PREFIX}:${match}`)) {
|
|
187
|
-
_.pull(keysToInsert, `${W3C_APPIUM_PREFIX}:${match}`);
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
for (const firstMatchEntry of result.firstMatch) {
|
|
192
|
-
for (const pair of _.toPairs(firstMatchEntry)) {
|
|
193
|
-
removeMatchingKeys(pair[0]);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
for (const pair of _.toPairs(result.alwaysMatch)) {
|
|
198
|
-
removeMatchingKeys(pair[0]);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
for (const key of keysToInsert) {
|
|
202
|
-
result.alwaysMatch[key] = jsonwpCaps[key];
|
|
203
|
-
}
|
|
204
|
-
return result;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
134
|
/**
|
|
208
135
|
* Takes a capabilities objects and prefixes capabilities with `appium:`
|
|
209
136
|
* @param {Object} caps Desired capabilities object
|
|
@@ -289,9 +216,36 @@ function pullSettings (caps) {
|
|
|
289
216
|
return result;
|
|
290
217
|
}
|
|
291
218
|
|
|
292
|
-
const rootDir = findRoot(__dirname);
|
|
219
|
+
const rootDir = fs.findRoot(__dirname);
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* A Map where you can set properties, but only once. And you can't remove anything. So there.
|
|
224
|
+
* @template K,V
|
|
225
|
+
* @extends {Map<K,V>}
|
|
226
|
+
*/
|
|
227
|
+
class ReadonlyMap extends Map {
|
|
228
|
+
/**
|
|
229
|
+
* @param {K} key
|
|
230
|
+
* @param {V} value
|
|
231
|
+
*/
|
|
232
|
+
set (key, value) {
|
|
233
|
+
if (this.has(key)) {
|
|
234
|
+
throw new Error(`${key} is already set`);
|
|
235
|
+
}
|
|
236
|
+
return super.set(key, value);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
delete (key) {
|
|
240
|
+
throw new Error(`${key} cannot be deleted`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
clear () {
|
|
244
|
+
throw new Error(`Cannot clear ReadonlyMap`);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
293
247
|
|
|
294
248
|
export {
|
|
295
249
|
inspectObject, parseCapsForInnerDriver, insertAppiumPrefixes, rootDir,
|
|
296
|
-
getPackageVersion, pullSettings, removeAppiumPrefixes,
|
|
250
|
+
getPackageVersion, pullSettings, removeAppiumPrefixes, ReadonlyMap
|
|
297
251
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
+
"version": "2.0.0-beta.20",
|
|
3
4
|
"description": "Automation for Apps.",
|
|
4
|
-
"
|
|
5
|
+
"keywords": [
|
|
5
6
|
"automation",
|
|
6
7
|
"javascript",
|
|
7
8
|
"selenium",
|
|
@@ -11,102 +12,76 @@
|
|
|
11
12
|
"firefoxos",
|
|
12
13
|
"testing"
|
|
13
14
|
],
|
|
14
|
-
"version": "2.0.0-beta.2",
|
|
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
|
-
},
|
|
21
15
|
"bugs": {
|
|
22
16
|
"url": "https://github.com/appium/appium/issues"
|
|
23
17
|
},
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/appium/appium.git"
|
|
27
21
|
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"author": "https://github.com/appium",
|
|
28
24
|
"main": "./build/lib/main.js",
|
|
29
25
|
"bin": {
|
|
30
26
|
"appium": "./build/lib/main.js"
|
|
31
27
|
},
|
|
32
28
|
"directories": {
|
|
33
|
-
"lib": "./lib"
|
|
34
|
-
"doc": "./docs"
|
|
29
|
+
"lib": "./lib"
|
|
35
30
|
},
|
|
36
31
|
"files": [
|
|
37
32
|
"bin",
|
|
38
33
|
"lib",
|
|
39
34
|
"build/lib",
|
|
40
|
-
"
|
|
35
|
+
"postinstall.js",
|
|
36
|
+
"types"
|
|
41
37
|
],
|
|
42
|
-
"dependencies": {
|
|
43
|
-
"@appium/base-plugin": "^1.0.0",
|
|
44
|
-
"@babel/runtime": "^7.6.0",
|
|
45
|
-
"appium-base-driver": "^7.0.0",
|
|
46
|
-
"appium-support": "2.x",
|
|
47
|
-
"argparse": "^1.0.10",
|
|
48
|
-
"async-lock": "^1.0.0",
|
|
49
|
-
"asyncbox": "2.x",
|
|
50
|
-
"axios": "^0.20.0",
|
|
51
|
-
"bluebird": "3.x",
|
|
52
|
-
"continuation-local-storage": "3.x",
|
|
53
|
-
"dateformat": "^3.0.3",
|
|
54
|
-
"find-root": "^1.1.0",
|
|
55
|
-
"lodash": "^4.17.11",
|
|
56
|
-
"longjohn": "^0.2.12",
|
|
57
|
-
"npmlog": "4.x",
|
|
58
|
-
"ora": "^4.0.4",
|
|
59
|
-
"semver": "^7.0.0",
|
|
60
|
-
"source-map-support": "0.x",
|
|
61
|
-
"teen_process": "1.x",
|
|
62
|
-
"winston": "3.x",
|
|
63
|
-
"word-wrap": "^1.2.3",
|
|
64
|
-
"yaml": "^1.7.2"
|
|
65
|
-
},
|
|
66
38
|
"scripts": {
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
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 .",
|
|
39
|
+
"generate-docs": "gulp transpile && node ./build/commands-yml/parse.js",
|
|
40
|
+
"postinstall": "node ./postinstall.js",
|
|
41
|
+
"install-fake-driver": "node . driver install --source=local ../fake-driver",
|
|
87
42
|
"upload": "gulp github-upload",
|
|
88
|
-
"zip
|
|
89
|
-
"
|
|
43
|
+
"zip": "zip -qr appium.zip .",
|
|
44
|
+
"zip-and-upload": "npm run zip && npm run upload"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@appium/base-driver": "^8.2.0",
|
|
48
|
+
"@appium/base-plugin": "1.8.0",
|
|
49
|
+
"@appium/support": "^2.55.1",
|
|
50
|
+
"@babel/runtime": "7.16.3",
|
|
51
|
+
"@sidvind/better-ajv-errors": "0.9.2",
|
|
52
|
+
"ajv": "8.8.0",
|
|
53
|
+
"ajv-formats": "2.1.1",
|
|
54
|
+
"argparse": "2.0.1",
|
|
55
|
+
"async-lock": "1.3.0",
|
|
56
|
+
"asyncbox": "2.9.2",
|
|
57
|
+
"axios": "0.24.0",
|
|
58
|
+
"bluebird": "3.7.2",
|
|
59
|
+
"continuation-local-storage": "3.2.1",
|
|
60
|
+
"find-up": "5.0.0",
|
|
61
|
+
"lilconfig": "2.0.4",
|
|
62
|
+
"lodash": "4.17.21",
|
|
63
|
+
"longjohn": "0.2.12",
|
|
64
|
+
"npmlog": "5.0.1",
|
|
65
|
+
"ora": "5.4.1",
|
|
66
|
+
"semver": "7.3.5",
|
|
67
|
+
"source-map-support": "0.5.20",
|
|
68
|
+
"teen_process": "1.16.0",
|
|
69
|
+
"winston": "3.3.3",
|
|
70
|
+
"word-wrap": "1.2.3",
|
|
71
|
+
"yaml": "1.10.2"
|
|
90
72
|
},
|
|
91
|
-
"pre-commit": [
|
|
92
|
-
"precommit-msg",
|
|
93
|
-
"precommit-test"
|
|
94
|
-
],
|
|
95
73
|
"devDependencies": {
|
|
96
|
-
"@appium/fake-
|
|
97
|
-
"appium-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
"wd": "^1.10.0",
|
|
110
|
-
"yaml-js": "^0.2.0"
|
|
111
|
-
}
|
|
74
|
+
"@appium/fake-driver": "^3.2.0",
|
|
75
|
+
"@appium/gulp-plugins": "^5.5.5"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=12",
|
|
79
|
+
"npm": ">=6"
|
|
80
|
+
},
|
|
81
|
+
"publishConfig": {
|
|
82
|
+
"access": "public",
|
|
83
|
+
"tag": "next"
|
|
84
|
+
},
|
|
85
|
+
"homepage": "https://appium.io",
|
|
86
|
+
"gitHead": "d7882a15eeca9992c5310b53811855f9ccaae36b"
|
|
112
87
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable no-console, promise/prefer-await-to-then */
|
|
3
|
+
|
|
4
|
+
async function main () {
|
|
5
|
+
const driverEnv = process.env.npm_config_drivers;
|
|
6
|
+
const pluginEnv = process.env.npm_config_plugins;
|
|
7
|
+
|
|
8
|
+
if (!driverEnv && !pluginEnv) {
|
|
9
|
+
console.log('Not auto-installing any drivers or plugins');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let extension;
|
|
14
|
+
try {
|
|
15
|
+
extension = require('./build/lib/cli/extension');
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw new Error(`Could not load extension CLI file; has the project been transpiled? ` +
|
|
18
|
+
`(${e.message})`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const {DEFAULT_APPIUM_HOME, DRIVER_TYPE, PLUGIN_TYPE} = require('./build/lib/extension-config');
|
|
22
|
+
const {runExtensionCommand} = extension;
|
|
23
|
+
const appiumHome = process.env.npm_config_appium_home || DEFAULT_APPIUM_HOME;
|
|
24
|
+
const specs = [[DRIVER_TYPE, driverEnv], [PLUGIN_TYPE, pluginEnv]];
|
|
25
|
+
|
|
26
|
+
for (const [type, extEnv] of specs) {
|
|
27
|
+
if (extEnv) {
|
|
28
|
+
for (const ext of extEnv.split(',')) {
|
|
29
|
+
try {
|
|
30
|
+
await checkAndInstallExtension({runExtensionCommand, appiumHome, type, ext});
|
|
31
|
+
} catch (e) {
|
|
32
|
+
console.log(`There was an error checking and installing ${type} ${ext}: ${e.message}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function checkAndInstallExtension ({
|
|
40
|
+
runExtensionCommand,
|
|
41
|
+
appiumHome,
|
|
42
|
+
type,
|
|
43
|
+
ext,
|
|
44
|
+
}) {
|
|
45
|
+
const extList = await runExtensionCommand({
|
|
46
|
+
appiumHome,
|
|
47
|
+
[`${type}Command`]: 'list',
|
|
48
|
+
showInstalled: true,
|
|
49
|
+
suppressOutput: true,
|
|
50
|
+
}, type);
|
|
51
|
+
if (extList[ext]) {
|
|
52
|
+
console.log(`The ${type} ${ext} was already installed, skipping...`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
console.log(`Installing the ${type} ${ext}...`);
|
|
56
|
+
await runExtensionCommand({
|
|
57
|
+
appiumHome,
|
|
58
|
+
[`${type}Command`]: 'install',
|
|
59
|
+
[type]: ext,
|
|
60
|
+
suppressOutput: true,
|
|
61
|
+
}, type);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (require.main === module) {
|
|
65
|
+
main().then(() => {
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}).catch((e) => {
|
|
68
|
+
console.error(e);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file was automatically generated by json-schema-to-typescript.
|
|
4
|
+
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
|
|
5
|
+
* and run json-schema-to-typescript to regenerate this file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* IP address to listen on
|
|
10
|
+
*/
|
|
11
|
+
export type AddressConfig = string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the Appium server should allow web browser connections from any host
|
|
14
|
+
*/
|
|
15
|
+
export type AllowCorsConfig = boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Set which insecure features are allowed to run in this server's sessions. Features are defined on a driver level; see documentation for more details. Note that features defined via "deny-insecure" will be disabled, even if also listed here. If string, a path to a text file containing policy or a comma-delimited list.
|
|
18
|
+
*/
|
|
19
|
+
export type AllowInsecureConfig = string[];
|
|
20
|
+
/**
|
|
21
|
+
* Base path to use as the prefix for all webdriver routes running on the server
|
|
22
|
+
*/
|
|
23
|
+
export type BasePathConfig = string;
|
|
24
|
+
/**
|
|
25
|
+
* Callback IP address (default: same as "address")
|
|
26
|
+
*/
|
|
27
|
+
export type CallbackAddressConfig = string;
|
|
28
|
+
/**
|
|
29
|
+
* Callback port (default: same as "port")
|
|
30
|
+
*/
|
|
31
|
+
export type CallbackPortConfig = number;
|
|
32
|
+
/**
|
|
33
|
+
* Add exaggerated spacing in logs to help with visual inspection
|
|
34
|
+
*/
|
|
35
|
+
export type DebugLogSpacingConfig = boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Set which insecure features are not allowed to run in this server's sessions. Features are defined on a driver level; see documentation for more details. Features listed here will not be enabled even if also listed in "allow-insecure", and even if "relaxed-security" is enabled. If string, a path to a text file containing policy or a comma-delimited list.
|
|
38
|
+
*/
|
|
39
|
+
export type DenyInsecureConfig = string[];
|
|
40
|
+
/**
|
|
41
|
+
* Number of seconds the Appium server should apply as both the keep-alive timeout and the connection timeout for all requests. A value of 0 disables the timeout.
|
|
42
|
+
*/
|
|
43
|
+
export type KeepAliveTimeoutConfig = number;
|
|
44
|
+
/**
|
|
45
|
+
* Use local timezone for timestamps
|
|
46
|
+
*/
|
|
47
|
+
export type LocalTimezoneConfig = boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Also send log output to this file
|
|
50
|
+
*/
|
|
51
|
+
export type LogConfig = string;
|
|
52
|
+
/**
|
|
53
|
+
* One or more log filtering rules
|
|
54
|
+
*/
|
|
55
|
+
export type LogFiltersConfig = string[];
|
|
56
|
+
/**
|
|
57
|
+
* Log level (console[:file])
|
|
58
|
+
*/
|
|
59
|
+
export type LogLevelConfig =
|
|
60
|
+
| "info"
|
|
61
|
+
| "info:debug"
|
|
62
|
+
| "info:info"
|
|
63
|
+
| "info:warn"
|
|
64
|
+
| "info:error"
|
|
65
|
+
| "warn"
|
|
66
|
+
| "warn:debug"
|
|
67
|
+
| "warn:info"
|
|
68
|
+
| "warn:warn"
|
|
69
|
+
| "warn:error"
|
|
70
|
+
| "error"
|
|
71
|
+
| "error:debug"
|
|
72
|
+
| "error:info"
|
|
73
|
+
| "error:warn"
|
|
74
|
+
| "error:error"
|
|
75
|
+
| "debug"
|
|
76
|
+
| "debug:debug"
|
|
77
|
+
| "debug:info"
|
|
78
|
+
| "debug:warn"
|
|
79
|
+
| "debug:error";
|
|
80
|
+
/**
|
|
81
|
+
* Do not use color in console output
|
|
82
|
+
*/
|
|
83
|
+
export type LogNoColorsConfig = boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Show timestamps in console output
|
|
86
|
+
*/
|
|
87
|
+
export type LogTimestampConfig = boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Add long stack traces to log entries. Recommended for debugging only.
|
|
90
|
+
*/
|
|
91
|
+
export type LongStacktraceConfig = boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Do not check that needed files are readable and/or writable
|
|
94
|
+
*/
|
|
95
|
+
export type NoPermsCheckConfig = boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Port to listen on
|
|
98
|
+
*/
|
|
99
|
+
export type PortConfig = number;
|
|
100
|
+
/**
|
|
101
|
+
* Disable additional security checks, so it is possible to use some advanced features, provided by drivers supporting this option. Only enable it if all the clients are in the trusted network and it's not the case if a client could potentially break out of the session sandbox. Specific features can be overridden by using "deny-insecure"
|
|
102
|
+
*/
|
|
103
|
+
export type RelaxedSecurityConfig = boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Enables session override (clobbering)
|
|
106
|
+
*/
|
|
107
|
+
export type SessionOverrideConfig = boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Cause sessions to fail if desired caps are sent in that Appium does not recognize as valid for the selected device
|
|
110
|
+
*/
|
|
111
|
+
export type StrictCapsConfig = boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Absolute path to directory Appium can use to manage temp files. Defaults to C:\Windows\Temp on Windows and /tmp otherwise.
|
|
114
|
+
*/
|
|
115
|
+
export type TmpConfig = string;
|
|
116
|
+
/**
|
|
117
|
+
* Absolute path to directory Appium can use to save iOS instrument traces; defaults to <tmp>/appium-instruments
|
|
118
|
+
*/
|
|
119
|
+
export type TraceDirConfig = string;
|
|
120
|
+
/**
|
|
121
|
+
* A list of drivers to activate. By default, all installed drivers will be activated.
|
|
122
|
+
*/
|
|
123
|
+
export type UseDriversConfig = string[];
|
|
124
|
+
/**
|
|
125
|
+
* A list of plugins to activate. To activate all plugins, the value should be an array with a single item "all".
|
|
126
|
+
*/
|
|
127
|
+
export type UsePluginsConfig = string[];
|
|
128
|
+
/**
|
|
129
|
+
* Also send log output to this http listener
|
|
130
|
+
*/
|
|
131
|
+
export type WebhookConfig = string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* A schema for Appium configuration files
|
|
135
|
+
*/
|
|
136
|
+
export interface AppiumConfiguration {
|
|
137
|
+
server?: ServerConfig;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Configuration when running Appium as a server
|
|
141
|
+
*/
|
|
142
|
+
export interface ServerConfig {
|
|
143
|
+
address?: AddressConfig;
|
|
144
|
+
"allow-cors"?: AllowCorsConfig;
|
|
145
|
+
"allow-insecure"?: AllowInsecureConfig;
|
|
146
|
+
"base-path"?: BasePathConfig;
|
|
147
|
+
"callback-address"?: CallbackAddressConfig;
|
|
148
|
+
"callback-port"?: CallbackPortConfig;
|
|
149
|
+
"debug-log-spacing"?: DebugLogSpacingConfig;
|
|
150
|
+
"default-capabilities"?: DefaultCapabilitiesConfig;
|
|
151
|
+
"deny-insecure"?: DenyInsecureConfig;
|
|
152
|
+
driver?: DriverConfig;
|
|
153
|
+
"keep-alive-timeout"?: KeepAliveTimeoutConfig;
|
|
154
|
+
"local-timezone"?: LocalTimezoneConfig;
|
|
155
|
+
log?: LogConfig;
|
|
156
|
+
"log-filters"?: LogFiltersConfig;
|
|
157
|
+
"log-level"?: LogLevelConfig;
|
|
158
|
+
"log-no-colors"?: LogNoColorsConfig;
|
|
159
|
+
"log-timestamp"?: LogTimestampConfig;
|
|
160
|
+
"long-stacktrace"?: LongStacktraceConfig;
|
|
161
|
+
"no-perms-check"?: NoPermsCheckConfig;
|
|
162
|
+
nodeconfig?: NodeconfigConfig;
|
|
163
|
+
plugin?: PluginConfig;
|
|
164
|
+
port?: PortConfig;
|
|
165
|
+
"relaxed-security"?: RelaxedSecurityConfig;
|
|
166
|
+
"session-override"?: SessionOverrideConfig;
|
|
167
|
+
"strict-caps"?: StrictCapsConfig;
|
|
168
|
+
tmp?: TmpConfig;
|
|
169
|
+
"trace-dir"?: TraceDirConfig;
|
|
170
|
+
"use-drivers"?: UseDriversConfig;
|
|
171
|
+
"use-plugins"?: UsePluginsConfig;
|
|
172
|
+
webhook?: WebhookConfig;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Set the default desired capabilities, which will be set on each session unless overridden by received capabilities. If a string, a path to a JSON file containing the capabilities, or raw JSON.
|
|
176
|
+
*/
|
|
177
|
+
export interface DefaultCapabilitiesConfig {
|
|
178
|
+
[k: string]: unknown;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Driver-specific configuration. Keys should correspond to driver package names
|
|
182
|
+
*/
|
|
183
|
+
export interface DriverConfig {
|
|
184
|
+
[k: string]: unknown;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Path to configuration JSON file to register Appium as a node with Selenium Grid 3; otherwise the configuration itself
|
|
188
|
+
*/
|
|
189
|
+
export interface NodeconfigConfig {
|
|
190
|
+
[k: string]: unknown;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Plugin-specific configuration. Keys should correspond to plugin package names
|
|
194
|
+
*/
|
|
195
|
+
export interface PluginConfig {
|
|
196
|
+
[k: string]: unknown;
|
|
197
|
+
}
|