@appium/base-driver 9.3.2 → 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/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 -52
- 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 +2 -4
- package/build/lib/basedriver/core.d.ts.map +1 -1
- package/build/lib/basedriver/core.js +0 -2
- 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/express/server.d.ts +3 -15
- package/build/lib/express/server.d.ts.map +1 -1
- 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 +0 -3
- package/lib/basedriver/driver.js +8 -11
- package/package.json +6 -6
- 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.
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.
|
|
1
|
+
{"version":3,"file":"find.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/find.ts"],"names":[],"mappings":";;AACA,6CAAsC;AAEtC,mCAA8B;AAM9B,MAAM,YAAY,GAAkB;IAClC,KAAK,CAAC,WAAW,CAA6C,QAAQ,EAAE,QAAQ;QAC9E,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACzE,CAAC;IAED,KAAK,CAAC,YAAY,CAA6C,QAAQ,EAAE,QAAQ;QAC/E,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,sBAAsB,CAE1B,QAAgB,EAChB,QAAgB,EAChB,SAAiB;QAEjB,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACpF,CAAC;IAED,KAAK,CAAC,uBAAuB,CAE3B,QAAgB,EAChB,QAAgB,EAChB,SAAiB;QAEjB,OAAO,MAAM,IAAI,CAAC,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACnF,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAEf,QAAgB,EAChB,QAAgB,EAChB,IAAU,EACV,OAAY;QAEZ,MAAM,IAAI,iBAAM,CAAC,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,iBAAM,CAAC,mBAAmB,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,yBAAyB,CAE7B,QAAgB,EAChB,QAAgB,EAChB,IAAU,EACV,OAAa;QAEb,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI;YACF,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;SAClE;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,IAAI,CAAC,IAAI,CAAC,4BAA4B,EAAE;gBAC1C,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;gBACvC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,wBAAwB,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1E,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;gBAChF,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACrB;YACD,gCAAgC;YAChC,MAAM,GAAG,CAAC;SACX;IACH,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,YAAY,CAAC,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './event';
|
|
2
|
+
export * from './find';
|
|
3
|
+
export * from './log';
|
|
4
|
+
export * from './session';
|
|
5
|
+
export * from './settings';
|
|
6
|
+
export * from './timeout';
|
|
7
|
+
export * from './execute';
|
|
4
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const settings_1 = require("./settings");
|
|
14
|
-
const timeout_1 = require("./timeout");
|
|
15
|
-
const execute_1 = require("./execute");
|
|
16
|
-
/**
|
|
17
|
-
* Applies all the mixins to the `BaseDriverBase` class; returns a `BaseDriver` class definition.
|
|
18
|
-
* Each mixin is applied in the order it is listed here, and each type is a union with the previous.
|
|
19
|
-
*
|
|
20
|
-
* @template {Constraints} C
|
|
21
|
-
* @param {BaseDriverBase<C>} Base
|
|
22
|
-
*/
|
|
23
|
-
exports.createBaseDriverClass = lodash_1.default.flow(timeout_1.TimeoutMixin, event_1.EventMixin, find_1.FindMixin, log_1.LogMixin, settings_1.SettingsMixin, session_1.SessionMixin, execute_1.ExecuteMixin);
|
|
24
|
-
/**
|
|
25
|
-
* @template {Constraints} C
|
|
26
|
-
* @typedef {import('../driver').BaseDriverBase<C>} BaseDriverBase
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* @typedef {import('@appium/types').Constraints} Constraints
|
|
30
|
-
*/
|
|
17
|
+
__exportStar(require("./event"), exports);
|
|
18
|
+
__exportStar(require("./find"), exports);
|
|
19
|
+
__exportStar(require("./log"), exports);
|
|
20
|
+
__exportStar(require("./session"), exports);
|
|
21
|
+
__exportStar(require("./settings"), exports);
|
|
22
|
+
__exportStar(require("./timeout"), exports);
|
|
23
|
+
__exportStar(require("./execute"), exports);
|
|
31
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,yCAAuB;AACvB,wCAAsB;AACtB,4CAA0B;AAC1B,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export function LogMixin<C extends Readonly<Record<string, import("@appium/types").Constraint>>>(Base: import("./find").FindBase<C>): LogBase<C>;
|
|
7
|
-
export type Constraints = import('@appium/types').Constraints;
|
|
8
|
-
export type StringRecord = import('@appium/types').StringRecord;
|
|
9
|
-
export type ILogCommands<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('@appium/types').ILogCommands<C>;
|
|
10
|
-
export type LogBase<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 & ILogCommands<C>>;
|
|
1
|
+
import { ILogCommands } from '@appium/types';
|
|
2
|
+
declare module '../driver' {
|
|
3
|
+
interface BaseDriver<C extends Constraints> extends ILogCommands {
|
|
4
|
+
}
|
|
5
|
+
}
|
|
11
6
|
//# sourceMappingURL=log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAe,MAAM,eAAe,CAAC;AAK9E,OAAO,QAAQ,WAAW,CAAC;IACzB,UAAU,UAAU,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,YAAY;KAAG;CACpE"}
|
|
@@ -1,58 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable require-await */
|
|
3
|
-
// @ts-check
|
|
4
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
4
|
};
|
|
7
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.LogMixin = void 0;
|
|
9
6
|
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
const mixin_1 = require("./mixin");
|
|
8
|
+
const LogCommands = {
|
|
9
|
+
supportedLogTypes: {},
|
|
10
|
+
async getLogTypes() {
|
|
11
|
+
this.log.debug('Retrieving supported log types');
|
|
12
|
+
return Object.keys(this.supportedLogTypes);
|
|
13
|
+
},
|
|
14
|
+
async getLog(logType) {
|
|
15
|
+
this.log.debug(`Retrieving '${String(logType)}' logs`);
|
|
16
|
+
if (!(logType in this.supportedLogTypes)) {
|
|
17
|
+
const logsTypesWithDescriptions = lodash_1.default.mapValues(this.supportedLogTypes, 'description');
|
|
18
|
+
throw new Error(`Unsupported log type '${String(logType)}'. ` +
|
|
19
|
+
`Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @this {import('@appium/types').Driver<C>}
|
|
30
|
-
* @param {keyof typeof this.supportedLogTypes} logType
|
|
31
|
-
* @returns {Promise<import('type-fest').AsyncReturnType<typeof this.supportedLogTypes[keyof typeof this.supportedLogTypes]['getter']>>}
|
|
32
|
-
*/
|
|
33
|
-
async getLog(logType) {
|
|
34
|
-
this.log.debug(`Retrieving '${String(logType)}' logs`);
|
|
35
|
-
if (!(logType in this.supportedLogTypes)) {
|
|
36
|
-
const logsTypesWithDescriptions = lodash_1.default.mapValues(this.supportedLogTypes, 'description');
|
|
37
|
-
throw new Error(`Unsupported log type '${String(logType)}'. ` +
|
|
38
|
-
`Supported types: ${JSON.stringify(logsTypesWithDescriptions)}`);
|
|
39
|
-
}
|
|
40
|
-
return await this.supportedLogTypes[logType].getter(this);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return LogCommands;
|
|
44
|
-
}
|
|
45
|
-
exports.LogMixin = LogMixin;
|
|
46
|
-
/**
|
|
47
|
-
* @typedef {import('@appium/types').Constraints} Constraints
|
|
48
|
-
* @typedef {import('@appium/types').StringRecord} StringRecord
|
|
49
|
-
*/
|
|
50
|
-
/**
|
|
51
|
-
* @template {Constraints} C
|
|
52
|
-
* @typedef {import('@appium/types').ILogCommands<C>} ILogCommands
|
|
53
|
-
*/
|
|
54
|
-
/**
|
|
55
|
-
* @template {Constraints} C
|
|
56
|
-
* @typedef {import('../driver').BaseDriverBase<C, import('@appium/types').ITimeoutCommands & import('@appium/types').IEventCommands & import('@appium/types').IFindCommands & ILogCommands<C>>} LogBase
|
|
57
|
-
*/
|
|
21
|
+
return await this.supportedLogTypes[logType].getter(this);
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
(0, mixin_1.mixin)(LogCommands);
|
|
58
25
|
//# sourceMappingURL=log.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.
|
|
1
|
+
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../../../lib/basedriver/commands/log.ts"],"names":[],"mappings":";;;;;AACA,oDAAuB;AAEvB,mCAA8B;AAM9B,MAAM,WAAW,GAAiB;IAChC,iBAAiB,EAAgB,EAAE;IAEnC,KAAK,CAAC,WAAW;QACf,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACjD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,MAAM,CAEV,OAAgD;QAEhD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEvD,IAAI,CAAC,CAAC,OAAO,IAAI,IAAI,CAAC,iBAAiB,CAAC,EAAE;YACxC,MAAM,yBAAyB,GAAG,gBAAC,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;YACrF,MAAM,IAAI,KAAK,CACb,yBAAyB,MAAM,CAAC,OAAO,CAAC,KAAK;gBAC3C,oBAAoB,IAAI,CAAC,SAAS,CAAC,yBAAyB,CAAC,EAAE,CAClE,CAAC;SACH;QAED,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC;AAEF,IAAA,aAAK,EAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Constraints } from '@appium/types';
|
|
2
|
+
import { BaseDriver } from '../driver';
|
|
3
|
+
/**
|
|
4
|
+
* This function assigns a mixin `T` to the `FakeDriver` class' prototype.
|
|
5
|
+
* While each mixin has its own interface which is (in isolation) unrelated to `FakeDriver`, the constraint
|
|
6
|
+
* on this generic type `T` is that it must be a partial of `FakeDriver`'s interface. This enforces
|
|
7
|
+
* that it does not conflict with the existing interface of `FakeDriver`. In that way, you can
|
|
8
|
+
* think of it as a type guard.
|
|
9
|
+
* @param mixin Mixin implementation
|
|
10
|
+
*/
|
|
11
|
+
export declare function mixin<C extends Constraints, T extends Partial<BaseDriver<C>>>(mixin: T): void;
|
|
12
|
+
//# sourceMappingURL=mixin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixin.d.ts","sourceRoot":"","sources":["../../../../lib/basedriver/commands/mixin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AAErC;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAE7F"}
|