appium 2.0.0-beta.3 → 2.0.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -11
- package/build/lib/appium.d.ts +215 -0
- package/build/lib/appium.d.ts.map +1 -0
- package/build/lib/appium.js +241 -132
- package/build/lib/cli/args.d.ts +20 -0
- package/build/lib/cli/args.d.ts.map +1 -0
- package/build/lib/cli/args.js +96 -282
- package/build/lib/cli/driver-command.d.ts +36 -0
- package/build/lib/cli/driver-command.d.ts.map +1 -0
- package/build/lib/cli/driver-command.js +19 -12
- package/build/lib/cli/extension-command.d.ts +345 -0
- package/build/lib/cli/extension-command.d.ts.map +1 -0
- package/build/lib/cli/extension-command.js +171 -96
- package/build/lib/cli/extension.d.ts +14 -0
- package/build/lib/cli/extension.d.ts.map +1 -0
- package/build/lib/cli/extension.js +31 -16
- package/build/lib/cli/parser.d.ts +80 -0
- package/build/lib/cli/parser.d.ts.map +1 -0
- package/build/lib/cli/parser.js +152 -95
- package/build/lib/cli/plugin-command.d.ts +39 -0
- package/build/lib/cli/plugin-command.d.ts.map +1 -0
- package/build/lib/cli/plugin-command.js +18 -13
- package/build/lib/cli/utils.d.ts +29 -0
- package/build/lib/cli/utils.d.ts.map +1 -0
- package/build/lib/cli/utils.js +27 -3
- package/build/lib/config-file.d.ts +100 -0
- package/build/lib/config-file.d.ts.map +1 -0
- package/build/lib/config-file.js +136 -0
- package/build/lib/config.d.ts +41 -0
- package/build/lib/config.d.ts.map +1 -0
- package/build/lib/config.js +92 -67
- package/build/lib/constants.d.ts +48 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/constants.js +60 -0
- package/build/lib/extension/driver-config.d.ts +84 -0
- package/build/lib/extension/driver-config.d.ts.map +1 -0
- package/build/lib/extension/driver-config.js +190 -0
- package/build/lib/extension/extension-config.d.ts +170 -0
- package/build/lib/extension/extension-config.d.ts.map +1 -0
- package/build/lib/extension/extension-config.js +297 -0
- package/build/lib/extension/index.d.ts +39 -0
- package/build/lib/extension/index.d.ts.map +1 -0
- package/build/lib/extension/index.js +77 -0
- package/build/lib/extension/manifest.d.ts +174 -0
- package/build/lib/extension/manifest.d.ts.map +1 -0
- package/build/lib/extension/manifest.js +246 -0
- package/build/lib/extension/package-changed.d.ts +11 -0
- package/build/lib/extension/package-changed.d.ts.map +1 -0
- package/build/lib/extension/package-changed.js +68 -0
- package/build/lib/extension/plugin-config.d.ts +62 -0
- package/build/lib/extension/plugin-config.d.ts.map +1 -0
- package/build/lib/extension/plugin-config.js +87 -0
- package/build/lib/grid-register.d.ts +10 -0
- package/build/lib/grid-register.d.ts.map +1 -0
- package/build/lib/grid-register.js +21 -25
- package/build/lib/logger.d.ts +3 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +4 -6
- package/build/lib/logsink.d.ts +4 -0
- package/build/lib/logsink.d.ts.map +1 -0
- package/build/lib/logsink.js +12 -16
- package/build/lib/main.d.ts +54 -0
- package/build/lib/main.d.ts.map +1 -0
- package/build/lib/main.js +189 -90
- package/build/lib/schema/arg-spec.d.ts +143 -0
- package/build/lib/schema/arg-spec.d.ts.map +1 -0
- package/build/lib/schema/arg-spec.js +119 -0
- package/build/lib/schema/cli-args.d.ts +19 -0
- package/build/lib/schema/cli-args.d.ts.map +1 -0
- package/build/lib/schema/cli-args.js +180 -0
- package/build/lib/schema/cli-transformers.d.ts +5 -0
- package/build/lib/schema/cli-transformers.d.ts.map +1 -0
- package/build/lib/schema/cli-transformers.js +74 -0
- package/build/lib/schema/index.d.ts +3 -0
- package/build/lib/schema/index.d.ts.map +1 -0
- package/build/lib/schema/index.js +34 -0
- package/build/lib/schema/keywords.d.ts +24 -0
- package/build/lib/schema/keywords.d.ts.map +1 -0
- package/build/lib/schema/keywords.js +70 -0
- package/build/lib/schema/schema.d.ts +259 -0
- package/build/lib/schema/schema.d.ts.map +1 -0
- package/build/lib/schema/schema.js +452 -0
- package/build/lib/utils.d.ts +66 -0
- package/build/lib/utils.d.ts.map +1 -0
- package/build/lib/utils.js +35 -139
- package/build/tsconfig.tsbuildinfo +1 -0
- package/build/types/appium-manifest.d.ts +40 -0
- package/build/types/appium-manifest.d.ts.map +1 -0
- package/build/types/cli.d.ts +112 -0
- package/build/types/cli.d.ts.map +1 -0
- package/build/types/extension.d.ts +43 -0
- package/build/types/extension.d.ts.map +1 -0
- package/build/types/external-manifest.d.ts +47 -0
- package/build/types/external-manifest.d.ts.map +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.d.ts.map +1 -0
- package/index.js +11 -0
- package/lib/appium-config.schema.json +278 -0
- package/lib/appium.js +402 -155
- package/lib/cli/args.js +174 -377
- package/lib/cli/driver-command.js +22 -7
- package/lib/cli/extension-command.js +372 -177
- package/lib/cli/extension.js +32 -10
- package/lib/cli/parser.js +253 -83
- package/lib/cli/plugin-command.js +19 -6
- package/lib/cli/utils.js +22 -2
- package/lib/config-file.js +223 -0
- package/lib/config.js +170 -69
- package/lib/constants.js +78 -0
- package/lib/extension/driver-config.js +249 -0
- package/lib/extension/extension-config.js +458 -0
- package/lib/extension/index.js +102 -0
- package/lib/extension/manifest.js +484 -0
- package/lib/extension/package-changed.js +63 -0
- package/lib/extension/plugin-config.js +113 -0
- package/lib/grid-register.js +25 -22
- package/lib/logger.js +1 -1
- package/lib/logsink.js +14 -7
- package/lib/main.js +255 -90
- package/lib/schema/arg-spec.js +232 -0
- package/lib/schema/cli-args.js +261 -0
- package/lib/schema/cli-transformers.js +122 -0
- package/lib/schema/index.js +2 -0
- package/lib/schema/keywords.js +134 -0
- package/lib/schema/schema.js +734 -0
- package/lib/utils.js +85 -129
- package/package.json +68 -85
- package/scripts/postinstall.js +71 -0
- package/types/appium-manifest.ts +61 -0
- package/types/cli.ts +153 -0
- package/types/extension.ts +56 -0
- package/types/external-manifest.ts +58 -0
- package/types/index.ts +14 -0
- package/CHANGELOG.md +0 -3515
- package/bin/ios-webkit-debug-proxy-launcher.js +0 -71
- package/build/lib/cli/npm.js +0 -206
- package/build/lib/cli/parser-helpers.js +0 -82
- package/build/lib/driver-config.js +0 -77
- package/build/lib/drivers.js +0 -96
- package/build/lib/extension-config.js +0 -251
- package/build/lib/plugin-config.js +0 -59
- package/build/lib/plugins.js +0 -14
- package/lib/cli/npm.js +0 -183
- package/lib/cli/parser-helpers.js +0 -79
- package/lib/driver-config.js +0 -46
- package/lib/drivers.js +0 -81
- package/lib/extension-config.js +0 -208
- package/lib/plugin-config.js +0 -34
- package/lib/plugins.js +0 -10
package/lib/utils.js
CHANGED
|
@@ -1,65 +1,64 @@
|
|
|
1
|
+
|
|
1
2
|
import _ from 'lodash';
|
|
2
3
|
import logger from './logger';
|
|
3
|
-
import { processCapabilities, PROTOCOLS } from 'appium
|
|
4
|
-
import
|
|
4
|
+
import { processCapabilities, PROTOCOLS } from '@appium/base-driver';
|
|
5
|
+
import { inspect as dump } from 'util';
|
|
5
6
|
|
|
6
7
|
const W3C_APPIUM_PREFIX = 'appium';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* If `stdout` is a TTY, this is `true`.
|
|
12
|
+
*
|
|
13
|
+
* Used for tighter control over log output.
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
*/
|
|
16
|
+
const isStdoutTTY = process.stdout.isTTY;
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
for (let [arg, value] of _.toPairs(args)) {
|
|
28
|
-
value = getValueArray(value);
|
|
29
|
-
logger.info(` ${arg}: ${value.shift()}`);
|
|
30
|
-
for (let val of value) {
|
|
31
|
-
logger.info(val);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
18
|
+
/**
|
|
19
|
+
* Dumps to value to the console using `info` logger.
|
|
20
|
+
*
|
|
21
|
+
* @todo May want to force color to be `false` if {@link isStdoutTTY} is `false`.
|
|
22
|
+
*/
|
|
23
|
+
const inspect = _.flow(
|
|
24
|
+
_.partialRight(
|
|
25
|
+
/** @type {(object: any, options: import('util').InspectOptions) => string} */(dump),
|
|
26
|
+
{colors: true, depth: null, compact: !isStdoutTTY}
|
|
27
|
+
),
|
|
28
|
+
(...args) => {
|
|
29
|
+
logger.info(...args);
|
|
30
|
+
});
|
|
35
31
|
|
|
36
32
|
/**
|
|
37
33
|
* Takes the caps that were provided in the request and translates them
|
|
38
34
|
* into caps that can be used by the inner drivers.
|
|
39
35
|
*
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
42
|
-
* @param {
|
|
43
|
-
* @param {
|
|
36
|
+
* @param {any} jsonwpCapabilities
|
|
37
|
+
* @param {W3CCapabilities} w3cCapabilities
|
|
38
|
+
* @param {import('@appium/types').Constraints} constraints
|
|
39
|
+
* @param {import('@appium/types').DefaultCapabilitiesConfig} [defaultCapabilities]
|
|
40
|
+
* @returns {ParsedDriverCaps|InvalidCaps}
|
|
44
41
|
*/
|
|
45
42
|
function parseCapsForInnerDriver (jsonwpCapabilities, w3cCapabilities, constraints = {}, defaultCapabilities = {}) {
|
|
46
43
|
// Check if the caller sent JSONWP caps, W3C caps, or both
|
|
47
44
|
const hasW3CCaps = _.isPlainObject(w3cCapabilities) &&
|
|
48
45
|
(_.has(w3cCapabilities, 'alwaysMatch') || _.has(w3cCapabilities, 'firstMatch'));
|
|
49
46
|
const hasJSONWPCaps = _.isPlainObject(jsonwpCapabilities);
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
let processedW3CCapabilities
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
let desiredCaps = /** @type {ParsedDriverCaps['desiredCaps']} */({});
|
|
48
|
+
/** @type {ParsedDriverCaps['processedW3CCapabilities']} */
|
|
49
|
+
let processedW3CCapabilities;
|
|
50
|
+
/** @type {ParsedDriverCaps['processedJsonwpCapabilities']} */
|
|
51
|
+
let processedJsonwpCapabilities;
|
|
52
|
+
|
|
53
|
+
if (!hasW3CCaps) {
|
|
54
|
+
return /** @type {InvalidCaps} */({
|
|
57
55
|
protocol: PROTOCOLS.W3C,
|
|
58
|
-
error: new Error('
|
|
59
|
-
};
|
|
56
|
+
error: new Error('W3C capabilities should be provided'),
|
|
57
|
+
});
|
|
60
58
|
}
|
|
61
59
|
|
|
62
|
-
const {W3C
|
|
60
|
+
const {W3C} = PROTOCOLS;
|
|
61
|
+
const protocol = W3C;
|
|
63
62
|
|
|
64
63
|
// Make sure we don't mutate the original arguments
|
|
65
64
|
jsonwpCapabilities = _.cloneDeep(jsonwpCapabilities);
|
|
@@ -95,62 +94,30 @@ function parseCapsForInnerDriver (jsonwpCapabilities, w3cCapabilities, constrain
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
if (hasJSONWPCaps) {
|
|
98
|
-
jsonwpCapabilities =
|
|
97
|
+
jsonwpCapabilities = {...removeAppiumPrefixes(defaultCapabilities), ...jsonwpCapabilities};
|
|
99
98
|
}
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
// Get MJSONWP caps
|
|
103
102
|
if (hasJSONWPCaps) {
|
|
104
|
-
protocol = MJSONWP;
|
|
105
|
-
desiredCaps = jsonwpCapabilities;
|
|
106
103
|
processedJsonwpCapabilities = {...jsonwpCapabilities};
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
// Get W3C caps
|
|
110
107
|
if (hasW3CCaps) {
|
|
111
|
-
protocol = W3C;
|
|
112
108
|
// Call the process capabilities algorithm to find matching caps on the W3C
|
|
113
109
|
// (see: https://github.com/jlipps/simple-wd-spec#processing-capabilities)
|
|
114
|
-
let isFixingNeededForW3cCaps = false;
|
|
115
110
|
try {
|
|
116
111
|
desiredCaps = processCapabilities(w3cCapabilities, constraints, true);
|
|
117
112
|
} catch (error) {
|
|
118
|
-
if (!hasJSONWPCaps) {
|
|
119
|
-
return {
|
|
120
|
-
desiredCaps,
|
|
121
|
-
processedJsonwpCapabilities,
|
|
122
|
-
processedW3CCapabilities,
|
|
123
|
-
protocol,
|
|
124
|
-
error,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
113
|
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
|
-
}
|
|
114
|
+
return /** @type {InvalidCaps} */({
|
|
115
|
+
desiredCaps,
|
|
116
|
+
processedJsonwpCapabilities,
|
|
117
|
+
processedW3CCapabilities,
|
|
118
|
+
protocol,
|
|
119
|
+
error,
|
|
120
|
+
});
|
|
154
121
|
}
|
|
155
122
|
|
|
156
123
|
// Create a new w3c capabilities payload that contains only the matching caps in `alwaysMatch`
|
|
@@ -160,53 +127,13 @@ function parseCapsForInnerDriver (jsonwpCapabilities, w3cCapabilities, constrain
|
|
|
160
127
|
};
|
|
161
128
|
}
|
|
162
129
|
|
|
163
|
-
return {desiredCaps, processedJsonwpCapabilities, processedW3CCapabilities, protocol};
|
|
164
|
-
}
|
|
165
|
-
|
|
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;
|
|
130
|
+
return /** @type {ParsedDriverCaps} */({desiredCaps, processedJsonwpCapabilities, processedW3CCapabilities, protocol});
|
|
205
131
|
}
|
|
206
132
|
|
|
207
133
|
/**
|
|
208
134
|
* Takes a capabilities objects and prefixes capabilities with `appium:`
|
|
209
|
-
* @param {
|
|
135
|
+
* @param {Capabilities} caps Desired capabilities object
|
|
136
|
+
* @returns {AppiumW3CCapabilities}
|
|
210
137
|
*/
|
|
211
138
|
function insertAppiumPrefixes (caps) {
|
|
212
139
|
// Standard, non-prefixed capabilities (see https://www.w3.org/TR/webdriver/#dfn-table-of-standard-capabilities)
|
|
@@ -233,11 +160,17 @@ function insertAppiumPrefixes (caps) {
|
|
|
233
160
|
return prefixedCaps;
|
|
234
161
|
}
|
|
235
162
|
|
|
163
|
+
/**
|
|
164
|
+
*
|
|
165
|
+
* @param {AppiumW3CCapabilities} caps
|
|
166
|
+
* @returns {Capabilities}
|
|
167
|
+
*/
|
|
236
168
|
function removeAppiumPrefixes (caps) {
|
|
237
169
|
if (!_.isPlainObject(caps)) {
|
|
238
170
|
return caps;
|
|
239
171
|
}
|
|
240
172
|
|
|
173
|
+
/** @type {Capabilities} */
|
|
241
174
|
const fixedCaps = {};
|
|
242
175
|
for (let [name, value] of _.toPairs(caps)) {
|
|
243
176
|
fixedCaps[removeAppiumPrefix(name)] = value;
|
|
@@ -289,9 +222,32 @@ function pullSettings (caps) {
|
|
|
289
222
|
return result;
|
|
290
223
|
}
|
|
291
224
|
|
|
292
|
-
const rootDir = findRoot(__dirname);
|
|
293
|
-
|
|
294
225
|
export {
|
|
295
|
-
|
|
296
|
-
getPackageVersion, pullSettings, removeAppiumPrefixes
|
|
226
|
+
inspect, parseCapsForInnerDriver, insertAppiumPrefixes,
|
|
227
|
+
getPackageVersion, pullSettings, removeAppiumPrefixes
|
|
297
228
|
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* @todo protocol is more specific
|
|
232
|
+
* @typedef ParsedDriverCaps
|
|
233
|
+
* @property {Capabilities} desiredCaps
|
|
234
|
+
* @property {string} protocol
|
|
235
|
+
* @property {any} [processedJsonwpCapabilities]
|
|
236
|
+
* @property {W3CCapabilities} [processedW3CCapabilities]
|
|
237
|
+
*/
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* @todo protocol is more specific
|
|
241
|
+
* @typedef InvalidCaps
|
|
242
|
+
* @property {Error} error
|
|
243
|
+
* @property {string} protocol
|
|
244
|
+
* @property {Capabilities} [desiredCaps]
|
|
245
|
+
* @property {any} [processedJsonwpCapabilities]
|
|
246
|
+
* @property {W3CCapabilities} [processedW3CCapabilities]
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* @typedef {import('@appium/types').W3CCapabilities} W3CCapabilities
|
|
251
|
+
* @typedef {import('@appium/types').Capabilities} Capabilities
|
|
252
|
+
* @typedef {import('@appium/types').AppiumW3CCapabilities} AppiumW3CCapabilities
|
|
253
|
+
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appium",
|
|
3
|
+
"version": "2.0.0-beta.34",
|
|
3
4
|
"description": "Automation for Apps.",
|
|
4
|
-
"
|
|
5
|
+
"keywords": [
|
|
5
6
|
"automation",
|
|
6
7
|
"javascript",
|
|
7
8
|
"selenium",
|
|
@@ -11,102 +12,84 @@
|
|
|
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",
|
|
29
26
|
"bin": {
|
|
30
|
-
"appium": "
|
|
27
|
+
"appium": "index.js"
|
|
31
28
|
},
|
|
32
29
|
"directories": {
|
|
33
|
-
"lib": "./lib"
|
|
34
|
-
"doc": "./docs"
|
|
30
|
+
"lib": "./lib"
|
|
35
31
|
},
|
|
36
32
|
"files": [
|
|
37
|
-
"bin",
|
|
38
33
|
"lib",
|
|
39
|
-
"build
|
|
40
|
-
"
|
|
34
|
+
"build",
|
|
35
|
+
"index.js",
|
|
36
|
+
"scripts/postinstall.js",
|
|
37
|
+
"types"
|
|
41
38
|
],
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "babel lib --root-mode=upward --out-dir=build/lib",
|
|
41
|
+
"dev": "npm run build -- --watch",
|
|
42
|
+
"fix": "npm run lint -- --fix",
|
|
43
|
+
"build:docs": "node docs/scripts/build-docs.js",
|
|
44
|
+
"build:docs:assets": "node docs/scripts/copy-assets.js",
|
|
45
|
+
"dev:docs": "npm run build:docs:assets && npm run dev:docs:en",
|
|
46
|
+
"dev:docs:en": "mkdocs serve -f ./docs/mkdocs-en.yml",
|
|
47
|
+
"dev:docs:ja": "mkdocs serve -f ./docs/mkdocs-ja.yml",
|
|
48
|
+
"publish:docs": "APPIUM_DOCS_PUBLISH=1 npm run build:docs",
|
|
49
|
+
"postinstall": "node ./scripts/postinstall.js",
|
|
50
|
+
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
51
|
+
"test": "npm run test:unit",
|
|
52
|
+
"test:e2e": "mocha --timeout 30s --slow 15s \"./test/e2e/**/*.spec.js\"",
|
|
53
|
+
"test:unit": "mocha \"./test/unit/**/*.spec.js\""
|
|
54
|
+
},
|
|
42
55
|
"dependencies": {
|
|
43
|
-
"@appium/base-
|
|
44
|
-
"@
|
|
45
|
-
"appium
|
|
46
|
-
"appium
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
56
|
+
"@appium/base-driver": "^8.5.3",
|
|
57
|
+
"@appium/base-plugin": "^1.8.5",
|
|
58
|
+
"@appium/docutils": "^0.0.4",
|
|
59
|
+
"@appium/schema": "^0.0.5",
|
|
60
|
+
"@appium/support": "^2.58.0",
|
|
61
|
+
"@babel/runtime": "7.17.9",
|
|
62
|
+
"@sidvind/better-ajv-errors": "1.1.1",
|
|
63
|
+
"ajv": "8.11.0",
|
|
64
|
+
"ajv-formats": "2.1.1",
|
|
65
|
+
"argparse": "2.0.1",
|
|
66
|
+
"async-lock": "1.3.1",
|
|
67
|
+
"asyncbox": "2.9.2",
|
|
68
|
+
"axios": "0.27.2",
|
|
69
|
+
"bluebird": "3.7.2",
|
|
70
|
+
"find-up": "5.0.0",
|
|
71
|
+
"lilconfig": "2.0.5",
|
|
72
|
+
"lodash": "4.17.21",
|
|
73
|
+
"longjohn": "0.2.12",
|
|
74
|
+
"npmlog": "6.0.2",
|
|
75
|
+
"ora": "5.4.1",
|
|
76
|
+
"package-changed": "1.9.0",
|
|
77
|
+
"resolve-from": "5.0.0",
|
|
78
|
+
"semver": "7.3.7",
|
|
79
|
+
"source-map-support": "0.5.21",
|
|
80
|
+
"teen_process": "1.16.0",
|
|
81
|
+
"winston": "3.7.2",
|
|
82
|
+
"word-wrap": "1.2.3",
|
|
83
|
+
"yaml": "2.0.1"
|
|
65
84
|
},
|
|
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"
|
|
85
|
+
"engines": {
|
|
86
|
+
"node": ">=12",
|
|
87
|
+
"npm": ">=6"
|
|
90
88
|
},
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
"appium-fake-driver": "^1.0.1",
|
|
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"
|
|
111
|
-
}
|
|
89
|
+
"publishConfig": {
|
|
90
|
+
"access": "public",
|
|
91
|
+
"tag": "next"
|
|
92
|
+
},
|
|
93
|
+
"types": "./build/lib/main.d.ts",
|
|
94
|
+
"gitHead": "5482c921bc187ed8807922c00bd2355585f4971a"
|
|
112
95
|
}
|
|
@@ -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,61 @@
|
|
|
1
|
+
import { CommonMetadata, ExtMetadata, SchemaMetadata } from './external-manifest';
|
|
2
|
+
import { ExtensionType, DriverType, PluginType } from '.';
|
|
3
|
+
|
|
4
|
+
export type InstallType = 'npm' | 'git' | 'local' | 'github';
|
|
5
|
+
|
|
6
|
+
export interface InternalMetadata {
|
|
7
|
+
pkgName: string;
|
|
8
|
+
version: string;
|
|
9
|
+
installType: InstallType;
|
|
10
|
+
/**
|
|
11
|
+
* Whatever the user typed as the extension to install. May be derived from `package.json`
|
|
12
|
+
*/
|
|
13
|
+
installSpec: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Combination of external + internal extension data with `driverName`/`pluginName` removed (it becomes a key in an {@linkcode ExtRecord} object).
|
|
18
|
+
* Part of `extensions.yaml`.
|
|
19
|
+
*/
|
|
20
|
+
export type ExtManifest<ExtType extends ExtensionType> = Omit<
|
|
21
|
+
ExtMetadata<ExtType>,
|
|
22
|
+
ExtType extends DriverType
|
|
23
|
+
? 'driverName'
|
|
24
|
+
: ExtType extends PluginType
|
|
25
|
+
? 'pluginName'
|
|
26
|
+
: never
|
|
27
|
+
> &
|
|
28
|
+
InternalMetadata &
|
|
29
|
+
CommonMetadata; // XXX: ExtMetadata should be a union with CommonMetadata. why is this needed?
|
|
30
|
+
|
|
31
|
+
export type WithSchemaManifest = {
|
|
32
|
+
schema: SchemaMetadata;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* This is just a {@linkcode ExtManifest} except it _for sure_ has a `schema` prop.
|
|
37
|
+
*/
|
|
38
|
+
export type ExtManifestWithSchema<ExtType extends ExtensionType> =
|
|
39
|
+
ExtManifest<ExtType> & WithSchemaManifest;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Generic type for an object keyed by extension name, with values of type {@linkcode ExtData}
|
|
43
|
+
*/
|
|
44
|
+
export type ExtRecord<ExtType extends ExtensionType> = Record<
|
|
45
|
+
string,
|
|
46
|
+
ExtManifest<ExtType>
|
|
47
|
+
>;
|
|
48
|
+
|
|
49
|
+
export type DriverRecord = ExtRecord<DriverType>;
|
|
50
|
+
export type PluginRecord = ExtRecord<PluginType>;
|
|
51
|
+
|
|
52
|
+
export type ExtName<ExtType extends ExtensionType> = keyof ExtRecord<ExtType>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Represents an entire YAML manifest (`extensions.yaml`)
|
|
56
|
+
*/
|
|
57
|
+
export interface ManifestData {
|
|
58
|
+
drivers: DriverRecord;
|
|
59
|
+
plugins: PluginRecord;
|
|
60
|
+
schemaRev?: number;
|
|
61
|
+
}
|