@appium/base-driver 9.3.1 → 9.3.3
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/LICENSE +1 -1
- package/build/lib/basedriver/capabilities.d.ts +10 -0
- package/build/lib/basedriver/capabilities.d.ts.map +1 -1
- package/build/lib/basedriver/capabilities.js +57 -44
- package/build/lib/basedriver/capabilities.js.map +1 -1
- package/build/lib/basedriver/commands/event.d.ts +5 -9
- package/build/lib/basedriver/commands/event.d.ts.map +1 -1
- package/build/lib/basedriver/commands/event.js +28 -49
- package/build/lib/basedriver/commands/event.js.map +1 -1
- package/build/lib/basedriver/commands/execute.d.ts +5 -11
- package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
- package/build/lib/basedriver/commands/execute.js +15 -39
- package/build/lib/basedriver/commands/execute.js.map +1 -1
- package/build/lib/basedriver/commands/find.d.ts +5 -12
- package/build/lib/basedriver/commands/find.d.ts.map +1 -1
- package/build/lib/basedriver/commands/find.js +38 -98
- package/build/lib/basedriver/commands/find.js.map +1 -1
- package/build/lib/basedriver/commands/index.d.ts +7 -3
- package/build/lib/basedriver/commands/index.d.ts.map +1 -1
- package/build/lib/basedriver/commands/index.js +20 -27
- package/build/lib/basedriver/commands/index.js.map +1 -1
- package/build/lib/basedriver/commands/log.d.ts +5 -10
- package/build/lib/basedriver/commands/log.d.ts.map +1 -1
- package/build/lib/basedriver/commands/log.js +17 -50
- package/build/lib/basedriver/commands/log.js.map +1 -1
- package/build/lib/basedriver/commands/mixin.d.ts +12 -0
- package/build/lib/basedriver/commands/mixin.d.ts.map +1 -0
- package/build/lib/basedriver/commands/mixin.js +17 -0
- package/build/lib/basedriver/commands/mixin.js.map +1 -0
- package/build/lib/basedriver/commands/session.d.ts +5 -11
- package/build/lib/basedriver/commands/session.d.ts.map +1 -1
- package/build/lib/basedriver/commands/session.js +20 -45
- package/build/lib/basedriver/commands/session.js.map +1 -1
- package/build/lib/basedriver/commands/settings.d.ts +5 -9
- package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
- package/build/lib/basedriver/commands/settings.js +14 -34
- package/build/lib/basedriver/commands/settings.js.map +1 -1
- package/build/lib/basedriver/commands/timeout.d.ts +5 -9
- package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
- package/build/lib/basedriver/commands/timeout.js +107 -126
- package/build/lib/basedriver/commands/timeout.js.map +1 -1
- package/build/lib/basedriver/core.d.ts +12 -5
- package/build/lib/basedriver/core.d.ts.map +1 -1
- package/build/lib/basedriver/core.js +10 -45
- package/build/lib/basedriver/core.js.map +1 -1
- package/build/lib/basedriver/driver.d.ts +12 -12
- package/build/lib/basedriver/driver.d.ts.map +1 -1
- package/build/lib/basedriver/driver.js +22 -14
- package/build/lib/basedriver/driver.js.map +1 -1
- package/build/lib/basedriver/helpers.d.ts.map +1 -1
- package/build/lib/basedriver/helpers.js +9 -3
- package/build/lib/basedriver/helpers.js.map +1 -1
- package/build/lib/express/server.d.ts +3 -15
- package/build/lib/express/server.d.ts.map +1 -1
- package/build/lib/index.d.ts +1 -1
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +2 -1
- package/build/lib/index.js.map +1 -1
- package/lib/basedriver/capabilities.js +68 -54
- package/lib/basedriver/commands/event.ts +48 -0
- package/lib/basedriver/commands/execute.ts +39 -0
- package/lib/basedriver/commands/find.ts +79 -0
- package/lib/basedriver/commands/index.ts +7 -0
- package/lib/basedriver/commands/log.ts +36 -0
- package/lib/basedriver/commands/mixin.ts +14 -0
- package/lib/basedriver/commands/session.ts +34 -0
- package/lib/basedriver/commands/settings.ts +25 -0
- package/lib/basedriver/commands/timeout.ts +155 -0
- package/lib/basedriver/core.js +41 -20
- package/lib/basedriver/driver.js +9 -12
- package/lib/basedriver/helpers.js +9 -3
- package/lib/index.js +1 -0
- package/package.json +8 -8
- package/lib/basedriver/commands/event.js +0 -63
- package/lib/basedriver/commands/execute.js +0 -45
- package/lib/basedriver/commands/find.js +0 -108
- package/lib/basedriver/commands/index.js +0 -35
- package/lib/basedriver/commands/log.js +0 -64
- package/lib/basedriver/commands/session.js +0 -57
- package/lib/basedriver/commands/settings.js +0 -38
- package/lib/basedriver/commands/timeout.js +0 -168
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright OpenJS Foundation and other contributors, https://openjsf.org/
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
|
@@ -7,6 +7,7 @@ export type Constraints = import('@appium/types').Constraints;
|
|
|
7
7
|
export type Constraint = import('@appium/types').Constraint;
|
|
8
8
|
export type StringRecord = import('@appium/types').StringRecord;
|
|
9
9
|
export type BaseDriverCapConstraints = import('@appium/types').BaseDriverCapConstraints;
|
|
10
|
+
export type ConstraintsToCaps<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('@appium/types').ConstraintsToCaps<C>;
|
|
10
11
|
export type ValidateCapsOpts = {
|
|
11
12
|
/**
|
|
12
13
|
* - if true, skip the presence constraint
|
|
@@ -89,5 +90,14 @@ export function stripAppiumPrefixes<C extends Readonly<Record<string, import("@a
|
|
|
89
90
|
* @return {import('@appium/types').W3CCapabilities<C>} the capabilities with 'options' promoted if necessary
|
|
90
91
|
*/
|
|
91
92
|
export function promoteAppiumOptions<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(originalCaps: import("@appium/types").W3CCapabilities<C, void>): import("@appium/types").W3CCapabilities<C, void>;
|
|
93
|
+
/**
|
|
94
|
+
* Return a copy of a "bare" (single-level, non-W3C) capabilities object which has taken everything
|
|
95
|
+
* within the 'appium:options' capability and promoted it to the top level.
|
|
96
|
+
*
|
|
97
|
+
* @template {Constraints} C
|
|
98
|
+
* @param {NSCapabilities<C>} obj
|
|
99
|
+
* @return {NSCapabilities<C>} the capabilities with 'options' promoted if necessary
|
|
100
|
+
*/
|
|
101
|
+
export function promoteAppiumOptionsForObject<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(obj: Partial<import("@appium/types").CapsToNSCaps<import("@appium/types").ConstraintsToCaps<C> & void, "appium">>): Partial<import("@appium/types").CapsToNSCaps<import("@appium/types").ConstraintsToCaps<C> & void, "appium">>;
|
|
92
102
|
export const PREFIXED_APPIUM_OPTS_CAP: string;
|
|
93
103
|
//# sourceMappingURL=capabilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/capabilities.js"],"names":[],"mappings":"AA0FA;;;GAGG;AACH,8FAeE;
|
|
1
|
+
{"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/capabilities.js"],"names":[],"mappings":"AA0FA;;;GAGG;AACH,8FAeE;0BAuUW,OAAO,eAAe,EAAE,WAAW;yBACnC,OAAO,eAAe,EAAE,UAAU;2BAClC,OAAO,eAAe,EAAE,YAAY;uCACpC,OAAO,eAAe,EAAE,wBAAwB;wGAKhD,OAAO,eAAe,EAAE,iBAAiB,CAAC,CAAC,CAAC;;;;;;;qOAW5C,OAAO,eAAe,EAAE,cAAc,CAAC,CAAC,EAAE,KAAK,CAAC;mOAMhD,OAAO,eAAe,EAAE,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC;sOAM9C,OAAO,eAAe,EAAE,eAAe,CAAC,CAAC,EAAE,KAAK,CAAC;0BAKjD,OAAO,WAAW,EAAE,KAAK,CAAC,CAAC,EAAC,CAAC,CAAC;6BAI9B,OAAO,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;AA3R/C;;;;;;;GAOG;AACH;;;;;;EAmGC;AAGD;;;;;;GAMG;AACH,4SAuBC;AApSD;;;;;;GAMG;AACH,8SAwCC;AA7ED;;;;;;;;GAQG;AACH,62NAkBC;AA9BD,6CAAuC;AAuKvC;;;;GAIG;AACH,0MAWC;AA9ED;;;GAGG;AACH,mCAHW,MAAM,GACJ,OAAO,CAInB;AAED;;;;;;;GAOG;AACH,mSA4CC;AAgOD;;;;;;;GAOG;AACH,+NAcC;AApFD;;;;;;;GAOG;AACH,uVAoDC;AAlYD,8CAAkE"}
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.PREFIXED_APPIUM_OPTS_CAP = exports.promoteAppiumOptions = exports.stripAppiumPrefixes = exports.isStandardCap = exports.findNonPrefixedCaps = exports.APPIUM_VENDOR_PREFIX = exports.mergeCaps = exports.validateCaps = exports.processCapabilities = exports.parseCaps = exports.STANDARD_CAPS = void 0;
|
|
7
|
+
exports.PREFIXED_APPIUM_OPTS_CAP = exports.promoteAppiumOptionsForObject = exports.promoteAppiumOptions = exports.stripAppiumPrefixes = exports.isStandardCap = exports.findNonPrefixedCaps = exports.APPIUM_VENDOR_PREFIX = exports.mergeCaps = exports.validateCaps = exports.processCapabilities = exports.parseCaps = exports.STANDARD_CAPS = void 0;
|
|
8
8
|
const lodash_1 = __importDefault(require("lodash"));
|
|
9
9
|
const desired_caps_1 = require("./desired-caps");
|
|
10
10
|
const support_1 = require("@appium/support");
|
|
@@ -270,6 +270,55 @@ function processCapabilities(w3cCaps, constraints = /** @type {C} */ ({}), shoul
|
|
|
270
270
|
return /** @type {Capabilities<C>} */ (matchedCaps ?? {});
|
|
271
271
|
}
|
|
272
272
|
exports.processCapabilities = processCapabilities;
|
|
273
|
+
/**
|
|
274
|
+
* Return a copy of a "bare" (single-level, non-W3C) capabilities object which has taken everything
|
|
275
|
+
* within the 'appium:options' capability and promoted it to the top level.
|
|
276
|
+
*
|
|
277
|
+
* @template {Constraints} C
|
|
278
|
+
* @param {NSCapabilities<C>} obj
|
|
279
|
+
* @return {NSCapabilities<C>} the capabilities with 'options' promoted if necessary
|
|
280
|
+
*/
|
|
281
|
+
function promoteAppiumOptionsForObject(obj) {
|
|
282
|
+
const appiumOptions = obj[PREFIXED_APPIUM_OPTS_CAP];
|
|
283
|
+
if (!appiumOptions) {
|
|
284
|
+
return obj;
|
|
285
|
+
}
|
|
286
|
+
if (!lodash_1.default.isPlainObject(appiumOptions)) {
|
|
287
|
+
throw new errors_1.errors.SessionNotCreatedError(`The ${PREFIXED_APPIUM_OPTS_CAP} capability must be an object`);
|
|
288
|
+
}
|
|
289
|
+
if (lodash_1.default.isEmpty(appiumOptions)) {
|
|
290
|
+
return obj;
|
|
291
|
+
}
|
|
292
|
+
logger_1.default.debug(`Found ${PREFIXED_APPIUM_OPTS_CAP} capability present; will promote items inside to caps`);
|
|
293
|
+
/**
|
|
294
|
+
* @param {string} capName
|
|
295
|
+
*/
|
|
296
|
+
const shouldAddVendorPrefix = (capName) => !capName.startsWith(APPIUM_VENDOR_PREFIX);
|
|
297
|
+
const verifyIfAcceptable = (/** @type {string} */ capName) => {
|
|
298
|
+
if (!lodash_1.default.isString(capName)) {
|
|
299
|
+
throw new errors_1.errors.SessionNotCreatedError(`Capability names in ${PREFIXED_APPIUM_OPTS_CAP} must be strings. '${capName}' is unexpected`);
|
|
300
|
+
}
|
|
301
|
+
if (isStandardCap(capName)) {
|
|
302
|
+
throw new errors_1.errors.SessionNotCreatedError(`${PREFIXED_APPIUM_OPTS_CAP} must only contain vendor-specific capabilties. '${capName}' is unexpected`);
|
|
303
|
+
}
|
|
304
|
+
return capName;
|
|
305
|
+
};
|
|
306
|
+
const preprocessedOptions = (0, lodash_1.default)(appiumOptions)
|
|
307
|
+
.mapKeys((value, /** @type {string} */ key) => verifyIfAcceptable(key))
|
|
308
|
+
.mapKeys((value, key) => (shouldAddVendorPrefix(key) ? `${APPIUM_VENDOR_PREFIX}${key}` : key))
|
|
309
|
+
.value();
|
|
310
|
+
// warn if we are going to overwrite any keys on the base caps object
|
|
311
|
+
const overwrittenKeys = lodash_1.default.intersection(Object.keys(obj), Object.keys(preprocessedOptions));
|
|
312
|
+
if (overwrittenKeys.length > 0) {
|
|
313
|
+
logger_1.default.warn(`Found capabilities inside ${PREFIXED_APPIUM_OPTS_CAP} that will overwrite ` +
|
|
314
|
+
`capabilities at the top level: ${JSON.stringify(overwrittenKeys)}`);
|
|
315
|
+
}
|
|
316
|
+
return lodash_1.default.cloneDeep({
|
|
317
|
+
... /** @type {NSCapabilities<C>} */(lodash_1.default.omit(obj, PREFIXED_APPIUM_OPTS_CAP)),
|
|
318
|
+
...preprocessedOptions,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
exports.promoteAppiumOptionsForObject = promoteAppiumOptionsForObject;
|
|
273
322
|
/**
|
|
274
323
|
* Return a copy of a capabilities object which has taken everything within the 'options'
|
|
275
324
|
* capability and promoted it to the top level.
|
|
@@ -279,56 +328,16 @@ exports.processCapabilities = processCapabilities;
|
|
|
279
328
|
* @return {import('@appium/types').W3CCapabilities<C>} the capabilities with 'options' promoted if necessary
|
|
280
329
|
*/
|
|
281
330
|
function promoteAppiumOptions(originalCaps) {
|
|
282
|
-
const promoteForObject = (obj) => {
|
|
283
|
-
const appiumOptions = obj[PREFIXED_APPIUM_OPTS_CAP];
|
|
284
|
-
if (!appiumOptions) {
|
|
285
|
-
return obj;
|
|
286
|
-
}
|
|
287
|
-
if (!lodash_1.default.isPlainObject(appiumOptions)) {
|
|
288
|
-
throw new errors_1.errors.SessionNotCreatedError(`The ${PREFIXED_APPIUM_OPTS_CAP} capability must be an object`);
|
|
289
|
-
}
|
|
290
|
-
if (lodash_1.default.isEmpty(appiumOptions)) {
|
|
291
|
-
return obj;
|
|
292
|
-
}
|
|
293
|
-
logger_1.default.debug(`Found ${PREFIXED_APPIUM_OPTS_CAP} capability present; will promote items inside to caps`);
|
|
294
|
-
/**
|
|
295
|
-
* @param {string} capName
|
|
296
|
-
*/
|
|
297
|
-
const shouldAddVendorPrefix = (capName) => !capName.startsWith(APPIUM_VENDOR_PREFIX);
|
|
298
|
-
const verifyIfAcceptable = (capName) => {
|
|
299
|
-
if (!lodash_1.default.isString(capName)) {
|
|
300
|
-
throw new errors_1.errors.SessionNotCreatedError(`Capability names in ${PREFIXED_APPIUM_OPTS_CAP} must be strings. '${capName}' is unexpected`);
|
|
301
|
-
}
|
|
302
|
-
if (isStandardCap(capName)) {
|
|
303
|
-
throw new errors_1.errors.SessionNotCreatedError(`${PREFIXED_APPIUM_OPTS_CAP} must only contain vendor-specific capabilties. '${capName}' is unexpected`);
|
|
304
|
-
}
|
|
305
|
-
return capName;
|
|
306
|
-
};
|
|
307
|
-
const preprocessedOptions = (0, lodash_1.default)(appiumOptions)
|
|
308
|
-
.mapKeys((value, key) => verifyIfAcceptable(key))
|
|
309
|
-
.mapKeys((value, key) => (shouldAddVendorPrefix(key) ? `${APPIUM_VENDOR_PREFIX}${key}` : key))
|
|
310
|
-
.value();
|
|
311
|
-
// warn if we are going to overwrite any keys on the base caps object
|
|
312
|
-
const overwrittenKeys = lodash_1.default.intersection(Object.keys(obj), Object.keys(preprocessedOptions));
|
|
313
|
-
if (overwrittenKeys.length > 0) {
|
|
314
|
-
logger_1.default.warn(`Found capabilities inside ${PREFIXED_APPIUM_OPTS_CAP} that will overwrite ` +
|
|
315
|
-
`capabilities at the top level: ${JSON.stringify(overwrittenKeys)}`);
|
|
316
|
-
}
|
|
317
|
-
return lodash_1.default.cloneDeep({
|
|
318
|
-
...lodash_1.default.omit(obj, PREFIXED_APPIUM_OPTS_CAP),
|
|
319
|
-
...preprocessedOptions,
|
|
320
|
-
});
|
|
321
|
-
};
|
|
322
|
-
const { alwaysMatch, firstMatch } = originalCaps;
|
|
323
331
|
const result = {};
|
|
332
|
+
const { alwaysMatch, firstMatch } = originalCaps;
|
|
324
333
|
if (lodash_1.default.isPlainObject(alwaysMatch)) {
|
|
325
|
-
result.alwaysMatch =
|
|
334
|
+
result.alwaysMatch = promoteAppiumOptionsForObject(alwaysMatch);
|
|
326
335
|
}
|
|
327
336
|
else if ('alwaysMatch' in originalCaps) {
|
|
328
337
|
result.alwaysMatch = alwaysMatch;
|
|
329
338
|
}
|
|
330
339
|
if (lodash_1.default.isArray(firstMatch)) {
|
|
331
|
-
result.firstMatch = firstMatch.map(
|
|
340
|
+
result.firstMatch = firstMatch.map(promoteAppiumOptionsForObject);
|
|
332
341
|
}
|
|
333
342
|
else if ('firstMatch' in originalCaps) {
|
|
334
343
|
result.firstMatch = firstMatch;
|
|
@@ -342,6 +351,10 @@ exports.promoteAppiumOptions = promoteAppiumOptions;
|
|
|
342
351
|
* @typedef {import('@appium/types').StringRecord} StringRecord
|
|
343
352
|
* @typedef {import('@appium/types').BaseDriverCapConstraints} BaseDriverCapConstraints
|
|
344
353
|
*/
|
|
354
|
+
/**
|
|
355
|
+
* @template {Constraints} C
|
|
356
|
+
* @typedef {import('@appium/types').ConstraintsToCaps<C>} ConstraintsToCaps
|
|
357
|
+
*/
|
|
345
358
|
/**
|
|
346
359
|
* @typedef ValidateCapsOpts
|
|
347
360
|
* @property {boolean} [skipPresenceConstraint] - if true, skip the presence constraint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../lib/basedriver/capabilities.js"],"names":[],"mappings":";AAAA,YAAY;;;;;;AAEZ,oDAAuB;AACvB,iDAAyC;AACzC,6CAAqC;AACrC,sDAA2B;AAC3B,+CAA0C;AAE1C,MAAM,oBAAoB,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../../../lib/basedriver/capabilities.js"],"names":[],"mappings":";AAAA,YAAY;;;;;;AAEZ,oDAAuB;AACvB,iDAAyC;AACzC,6CAAqC;AACrC,sDAA2B;AAC3B,+CAA0C;AAE1C,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAkarC,oDAAoB;AAjatB,MAAM,wBAAwB,GAAG,GAAG,oBAAoB,SAAS,CAAC;AAuahE,4DAAwB;AAra1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EAAC,GAAG,YAAY,CAAC;IAC/C,IAAI,gBAAC,CAAC,aAAa,CAAC,WAAW,CAAC,EAAE;QAChC,MAAM,CAAC,WAAW,GAAG,6BAA6B,CAAC,WAAW,CAAC,CAAC;KACjE;SAAM,IAAI,aAAa,IAAI,YAAY,EAAE;QACxC,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC;KAClC;IACD,IAAI,gBAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACzB,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;KACnE;SAAM,IAAI,YAAY,IAAI,YAAY,EAAE;QACvC,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAWC,oDAAoB;AAKtB;;;;;GAKG;AAEH;;;GAGG;AAEH;;;GAGG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;GAIG;AAEH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function EventMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./timeout").TimeoutBase<C>): EventBase<C>;
|
|
7
|
-
export type Constraints = import('@appium/types').Constraints;
|
|
8
|
-
export type IEventCommands = import('@appium/types').IEventCommands;
|
|
9
|
-
export type EventBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & IEventCommands>;
|
|
1
|
+
import { IEventCommands } from '@appium/types';
|
|
2
|
+
declare module '../driver' {
|
|
3
|
+
interface BaseDriver<C extends Constraints> extends IEventCommands {
|
|
4
|
+
}
|
|
5
|
+
}
|
|
10
6
|
//# sourceMappingURL=event.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,cAAc,EAAC,MAAM,eAAe,CAAC;AAI1D,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,cAAc;KAAG;CACtE"}
|
|
@@ -3,58 +3,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EventMixin = void 0;
|
|
7
|
-
/* eslint-disable require-await */
|
|
8
|
-
// @ts-check
|
|
9
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @param {import('./timeout').TimeoutBase<C>} Base
|
|
13
|
-
* @returns {EventBase<C>}
|
|
14
|
-
*/
|
|
15
|
-
function EventMixin(Base) {
|
|
7
|
+
const mixin_1 = require("./mixin");
|
|
8
|
+
const EventCommands = {
|
|
16
9
|
/**
|
|
17
|
-
*
|
|
10
|
+
* Log a user-defined event in the event log.
|
|
11
|
+
*
|
|
12
|
+
* @param vendor - a vendor prefix for the user, to ensure namespace
|
|
13
|
+
* separation
|
|
14
|
+
* @param event - the event name
|
|
18
15
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
async logCustomEvent(vendor, event) {
|
|
17
|
+
this.logEvent(`${vendor}:${event}`);
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Get the event log
|
|
21
|
+
* @param type - the event type to filter with.
|
|
22
|
+
* It returns all events if the type is not provided or empty string/array.
|
|
23
|
+
* @returns the event history log object
|
|
24
|
+
*/
|
|
25
|
+
async getLogEvents(type) {
|
|
26
|
+
if (lodash_1.default.isEmpty(type)) {
|
|
27
|
+
return this.eventHistory;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* @returns {Promise<import('@appium/types').EventHistory|Record<string,number>>} - the event history log object
|
|
35
|
-
*/
|
|
36
|
-
async getLogEvents(type) {
|
|
37
|
-
if (lodash_1.default.isEmpty(type)) {
|
|
38
|
-
return this.eventHistory;
|
|
29
|
+
const typeList = lodash_1.default.castArray(type);
|
|
30
|
+
return lodash_1.default.reduce(this.eventHistory, (acc, eventTimes, eventType) => {
|
|
31
|
+
if (typeList.includes(eventType)) {
|
|
32
|
+
acc[eventType] = eventTimes;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return acc;
|
|
46
|
-
}, {});
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return EventCommands;
|
|
50
|
-
}
|
|
51
|
-
exports.EventMixin = EventMixin;
|
|
52
|
-
/**
|
|
53
|
-
* @typedef {import('@appium/types').Constraints} Constraints
|
|
54
|
-
* @typedef {import('@appium/types').IEventCommands} IEventCommands
|
|
55
|
-
*/
|
|
56
|
-
/**
|
|
57
|
-
* @template {Constraints} C
|
|
58
|
-
* @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & IEventCommands>} EventBase
|
|
59
|
-
*/
|
|
34
|
+
return acc;
|
|
35
|
+
}, {});
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
(0, mixin_1.mixin)(EventCommands);
|
|
60
39
|
//# sourceMappingURL=event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/event.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AAEvB,mCAA8B;AAO9B,MAAM,aAAa,GAAmB;IACpC;;;;;;OAMG;IACH,KAAK,CAAC,cAAc,CAA6C,MAAc,EAAE,KAAa;QAC5F,IAAI,CAAC,QAAQ,CAAC,GAAG,MAAM,IAAI,KAAK,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY,CAA6C,IAAuB;QACpF,IAAI,gBAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,OAAO,IAAI,CAAC,YAAY,CAAC;SAC1B;QAED,MAAM,QAAQ,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,gBAAC,CAAC,MAAM,CACb,IAAI,CAAC,YAAY,EACjB,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,EAAE,EAAE;YAC7B,IAAI,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;gBAChC,GAAG,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;aAC7B;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EACD,EAAE,CACH,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC"}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function ExecuteMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./session").SessionBase<C>): ExecuteBase<C>;
|
|
7
|
-
export type IExecuteCommands = import('@appium/types').IExecuteCommands;
|
|
8
|
-
export type Driver = import('@appium/types').Driver;
|
|
9
|
-
export type DriverClass = import('@appium/types').DriverClass;
|
|
10
|
-
export type Constraints = import('@appium/types').Constraints;
|
|
11
|
-
export type ExecuteBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>;
|
|
1
|
+
import { IExecuteCommands } from '@appium/types';
|
|
2
|
+
declare module '../driver' {
|
|
3
|
+
interface BaseDriver<C extends Constraints> extends IExecuteCommands {
|
|
4
|
+
}
|
|
5
|
+
}
|
|
12
6
|
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AAIvB,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,gBAAgB;KAAG;CACxE"}
|
|
@@ -3,46 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ExecuteMixin = void 0;
|
|
7
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
8
7
|
const protocol_1 = require("../../protocol");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class ExecuteCommands extends Base {
|
|
19
|
-
/**
|
|
20
|
-
* @param {string} script
|
|
21
|
-
* @param {[Record<string, any>]|[]} protoArgs
|
|
22
|
-
*/
|
|
23
|
-
async executeMethod(script, protoArgs) {
|
|
24
|
-
const Driver = /** @type {DriverClass} */ (this.constructor);
|
|
25
|
-
const commandMetadata = { ...Driver.executeMethodMap?.[script] };
|
|
26
|
-
if (!commandMetadata.command) {
|
|
27
|
-
const availableScripts = lodash_1.default.keys(Driver.executeMethodMap);
|
|
28
|
-
throw new protocol_1.errors.UnsupportedOperationError(`Unsupported execute method '${script}'. Available methods ` +
|
|
29
|
-
`are: ${availableScripts.join(', ')}`);
|
|
30
|
-
}
|
|
31
|
-
const args = (0, protocol_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
|
|
32
|
-
return await this[commandMetadata.command](...args);
|
|
8
|
+
const mixin_1 = require("./mixin");
|
|
9
|
+
const ExecuteCommands = {
|
|
10
|
+
async executeMethod(script, protoArgs) {
|
|
11
|
+
const Driver = this.constructor;
|
|
12
|
+
const commandMetadata = { ...Driver.executeMethodMap?.[script] };
|
|
13
|
+
if (!commandMetadata.command) {
|
|
14
|
+
const availableScripts = lodash_1.default.keys(Driver.executeMethodMap);
|
|
15
|
+
throw new protocol_1.errors.UnsupportedOperationError(`Unsupported execute method '${script}'. Available methods ` +
|
|
16
|
+
`are: ${availableScripts.join(', ')}`);
|
|
33
17
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* @typedef {import('@appium/types').Driver} Driver
|
|
41
|
-
* @typedef {import('@appium/types').DriverClass} DriverClass
|
|
42
|
-
* @typedef {import('@appium/types').Constraints} Constraints
|
|
43
|
-
*/
|
|
44
|
-
/**
|
|
45
|
-
* @template {Constraints} C
|
|
46
|
-
* @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & import('@appium/types').ILogCommands<C> & import('@appium/types').ISettingsCommands & import('@appium/types').ISessionCommands & IExecuteCommands>} ExecuteBase
|
|
47
|
-
*/
|
|
18
|
+
const args = (0, protocol_1.validateExecuteMethodParams)(protoArgs, commandMetadata.params);
|
|
19
|
+
const command = this[commandMetadata.command];
|
|
20
|
+
return await command.call(this, ...args);
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
(0, mixin_1.mixin)(ExecuteCommands);
|
|
48
24
|
//# sourceMappingURL=execute.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/execute.ts"],"names":[],"mappings":";;;;;AAAA,oDAAuB;AACvB,6CAAmE;AASnE,mCAA8B;AAO9B,MAAM,eAAe,GAAqB;IACxC,KAAK,CAAC,aAAa,CAEjB,MAAc,EACd,SAAiC;QAEjC,MAAM,MAAM,GAAG,IAAI,CAAC,WAAqC,CAAC;QAC1D,MAAM,eAAe,GAAG,EAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAC,CAAC;QAC/D,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE;YAC5B,MAAM,gBAAgB,GAAG,gBAAC,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YACzD,MAAM,IAAI,iBAAM,CAAC,yBAAyB,CACxC,+BAA+B,MAAM,uBAAuB;gBAC1D,QAAQ,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxC,CAAC;SACH;QACD,MAAM,IAAI,GAAG,IAAA,sCAA2B,EAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAkB,CAAC;QAC/D,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,eAAe,CAAC,CAAC"}
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function FindMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./event").EventBase<C>): FindBase<C>;
|
|
7
|
-
export type Element = import('@appium/types').Element;
|
|
8
|
-
export type Constraints = import('@appium/types').Constraints;
|
|
9
|
-
export type IFindCommands = import('@appium/types').IFindCommands;
|
|
10
|
-
export type ITimeoutCommands = import('@appium/types').ITimeoutCommands;
|
|
11
|
-
export type IEventCommands = import('@appium/types').IEventCommands;
|
|
12
|
-
export type FindBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>;
|
|
1
|
+
import { IFindCommands } from '@appium/types';
|
|
2
|
+
declare module '../driver' {
|
|
3
|
+
interface BaseDriver<C extends Constraints> extends IFindCommands {
|
|
4
|
+
}
|
|
5
|
+
}
|
|
13
6
|
//# sourceMappingURL=find.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.
|
|
1
|
+
{"version":3,"file":"find.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAAa,EAAC,MAAM,eAAe,CAAC;AAKzD,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,aAAa;KAAG;CACrE"}
|
|
@@ -1,107 +1,47 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FindMixin = void 0;
|
|
4
|
-
/* eslint-disable no-unused-vars */
|
|
5
|
-
/* eslint-disable require-await */
|
|
6
|
-
// @ts-check
|
|
7
3
|
const protocol_1 = require("../../protocol");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
const mixin_1 = require("./mixin");
|
|
5
|
+
const FindCommands = {
|
|
6
|
+
async findElement(strategy, selector) {
|
|
7
|
+
return await this.findElOrElsWithProcessing(strategy, selector, false);
|
|
8
|
+
},
|
|
9
|
+
async findElements(strategy, selector) {
|
|
10
|
+
return await this.findElOrElsWithProcessing(strategy, selector, true);
|
|
11
|
+
},
|
|
12
|
+
async findElementFromElement(strategy, selector, elementId) {
|
|
13
|
+
return await this.findElOrElsWithProcessing(strategy, selector, false, elementId);
|
|
14
|
+
},
|
|
15
|
+
async findElementsFromElement(strategy, selector, elementId) {
|
|
16
|
+
return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
|
|
17
|
+
},
|
|
14
18
|
/**
|
|
15
|
-
*
|
|
19
|
+
* Returns an object which adheres to the way the JSON Wire Protocol represents elements:
|
|
20
|
+
*
|
|
21
|
+
* Override this for your own driver!
|
|
16
22
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
async findElOrEls(strategy, selector, mult, context) {
|
|
24
|
+
throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
|
|
25
|
+
},
|
|
26
|
+
async getPageSource() {
|
|
27
|
+
throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
|
|
28
|
+
},
|
|
29
|
+
async findElOrElsWithProcessing(strategy, selector, mult, context) {
|
|
30
|
+
this.validateLocatorStrategy(strategy);
|
|
31
|
+
try {
|
|
32
|
+
return await this.findElOrEls(strategy, selector, mult, context);
|
|
24
33
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
*
|
|
34
|
-
* @returns {Promise<Element>}
|
|
35
|
-
*/
|
|
36
|
-
async findElementFromElement(strategy, selector, elementId) {
|
|
37
|
-
return await this.findElOrElsWithProcessing(strategy, selector, false, elementId);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
*
|
|
41
|
-
* @returns {Promise<Element[]>}
|
|
42
|
-
*/
|
|
43
|
-
async findElementsFromElement(strategy, selector, elementId) {
|
|
44
|
-
return await this.findElOrElsWithProcessing(strategy, selector, true, elementId);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Returns an object which adheres to the way the JSON Wire Protocol represents elements:
|
|
48
|
-
*
|
|
49
|
-
* Override this for your own driver!
|
|
50
|
-
* @template {boolean} Mult
|
|
51
|
-
* @template [Ctx=any]
|
|
52
|
-
* @param {string} strategy
|
|
53
|
-
* @param {string} selector
|
|
54
|
-
* @param {Mult} mult
|
|
55
|
-
* @param {Ctx} [context]
|
|
56
|
-
* @returns {Promise<Mult extends true ? Element[] : Element>}
|
|
57
|
-
*/
|
|
58
|
-
async findElOrEls(strategy, selector, mult, context) {
|
|
59
|
-
throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @returns {Promise<string>}
|
|
63
|
-
*/
|
|
64
|
-
async getPageSource() {
|
|
65
|
-
throw new protocol_1.errors.NotImplementedError('Not implemented yet for find.');
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @template {boolean} Mult
|
|
69
|
-
* @template [Ctx=any]
|
|
70
|
-
* @param {string} strategy
|
|
71
|
-
* @param {string} selector
|
|
72
|
-
* @param {Mult} mult
|
|
73
|
-
* @param {Ctx} [context]
|
|
74
|
-
* @returns {Promise<Mult extends true ? Element[] : Element>}
|
|
75
|
-
*/
|
|
76
|
-
async findElOrElsWithProcessing(strategy, selector, mult, context) {
|
|
77
|
-
this.validateLocatorStrategy(strategy);
|
|
78
|
-
try {
|
|
79
|
-
return await this.findElOrEls(strategy, selector, mult, context);
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
if (this.opts.printPageSourceOnFindFailure) {
|
|
83
|
-
const src = await this.getPageSource();
|
|
84
|
-
this.log.debug(`Error finding element${mult ? 's' : ''}: ${err.message}`);
|
|
85
|
-
this.log.debug(`Page source requested through 'printPageSourceOnFindFailure':`);
|
|
86
|
-
this.log.debug(src);
|
|
87
|
-
}
|
|
88
|
-
// still want the error to occur
|
|
89
|
-
throw err;
|
|
34
|
+
catch (err) {
|
|
35
|
+
if (this.opts.printPageSourceOnFindFailure) {
|
|
36
|
+
const src = await this.getPageSource();
|
|
37
|
+
this.log.debug(`Error finding element${mult ? 's' : ''}: ${err.message}`);
|
|
38
|
+
this.log.debug(`Page source requested through 'printPageSourceOnFindFailure':`);
|
|
39
|
+
this.log.debug(src);
|
|
90
40
|
}
|
|
41
|
+
// still want the error to occur
|
|
42
|
+
throw err;
|
|
91
43
|
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
exports.FindMixin = FindMixin;
|
|
96
|
-
/**
|
|
97
|
-
* @typedef {import('@appium/types').Element} Element
|
|
98
|
-
* @typedef {import('@appium/types').Constraints} Constraints
|
|
99
|
-
* @typedef {import('@appium/types').IFindCommands} IFindCommands
|
|
100
|
-
* @typedef {import('@appium/types').ITimeoutCommands} ITimeoutCommands
|
|
101
|
-
* @typedef {import('@appium/types').IEventCommands} IEventCommands
|
|
102
|
-
*/
|
|
103
|
-
/**
|
|
104
|
-
* @template {Constraints} C
|
|
105
|
-
* @typedef {import('../driver').BaseDriverBase<C, ITimeoutCommands & IEventCommands & IFindCommands>} FindBase
|
|
106
|
-
*/
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
(0, mixin_1.mixin)(FindCommands);
|
|
107
47
|
//# sourceMappingURL=find.js.map
|