@appium/base-driver 8.3.1 → 8.4.2
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/build/lib/basedriver/capabilities.d.ts +80 -0
- package/build/lib/basedriver/capabilities.d.ts.map +1 -0
- package/build/lib/basedriver/capabilities.js +11 -10
- package/build/lib/basedriver/commands/event.d.ts +9 -0
- package/build/lib/basedriver/commands/event.d.ts.map +1 -0
- package/build/lib/basedriver/commands/event.js +21 -21
- package/build/lib/basedriver/commands/find.d.ts +11 -0
- package/build/lib/basedriver/commands/find.d.ts.map +1 -0
- package/build/lib/basedriver/commands/find.js +44 -37
- package/build/lib/basedriver/commands/index.d.ts +8 -0
- package/build/lib/basedriver/commands/index.d.ts.map +1 -0
- package/build/lib/basedriver/commands/index.js +17 -14
- package/build/lib/basedriver/commands/log.d.ts +12 -0
- package/build/lib/basedriver/commands/log.d.ts.map +1 -0
- package/build/lib/basedriver/commands/log.js +24 -26
- package/build/lib/basedriver/commands/session.d.ts +11 -0
- package/build/lib/basedriver/commands/session.d.ts.map +1 -0
- package/build/lib/basedriver/commands/session.js +21 -147
- package/build/lib/basedriver/commands/settings.d.ts +10 -0
- package/build/lib/basedriver/commands/settings.d.ts.map +1 -0
- package/build/lib/basedriver/commands/settings.js +19 -17
- package/build/lib/basedriver/commands/timeout.d.ts +8 -0
- package/build/lib/basedriver/commands/timeout.d.ts.map +1 -0
- package/build/lib/basedriver/commands/timeout.js +118 -137
- package/build/lib/basedriver/core.d.ts +235 -0
- package/build/lib/basedriver/core.d.ts.map +1 -0
- package/build/lib/basedriver/core.js +283 -0
- package/build/lib/basedriver/desired-caps.d.ts +5 -0
- package/build/lib/basedriver/desired-caps.d.ts.map +1 -0
- package/build/lib/basedriver/desired-caps.js +1 -1
- package/build/lib/basedriver/device-settings.d.ts +32 -0
- package/build/lib/basedriver/device-settings.d.ts.map +1 -0
- package/build/lib/basedriver/device-settings.js +19 -11
- package/build/lib/basedriver/driver.d.ts +83 -0
- package/build/lib/basedriver/driver.d.ts.map +1 -0
- package/build/lib/basedriver/driver.js +100 -266
- package/build/lib/basedriver/helpers.d.ts +132 -0
- package/build/lib/basedriver/helpers.d.ts.map +1 -0
- package/build/lib/basedriver/helpers.js +17 -1
- package/build/lib/basedriver/logger.d.ts +3 -0
- package/build/lib/basedriver/logger.d.ts.map +1 -0
- package/build/lib/constants.d.ts +9 -0
- package/build/lib/constants.d.ts.map +1 -0
- package/build/lib/express/crash.d.ts +3 -0
- package/build/lib/express/crash.d.ts.map +1 -0
- package/build/lib/express/express-logging.d.ts +3 -0
- package/build/lib/express/express-logging.d.ts.map +1 -0
- package/build/lib/express/idempotency.d.ts +2 -0
- package/build/lib/express/idempotency.d.ts.map +1 -0
- package/build/lib/express/logger.d.ts +3 -0
- package/build/lib/express/logger.d.ts.map +1 -0
- package/build/lib/express/middleware.d.ts +9 -0
- package/build/lib/express/middleware.d.ts.map +1 -0
- package/build/lib/express/server.d.ts +10 -0
- package/build/lib/express/server.d.ts.map +1 -0
- package/build/lib/express/static.d.ts +6 -0
- package/build/lib/express/static.d.ts.map +1 -0
- package/build/lib/express/websocket.d.ts +64 -0
- package/build/lib/express/websocket.d.ts.map +1 -0
- package/build/lib/express/websocket.js +39 -38
- package/build/lib/helpers/capabilities.d.ts +13 -0
- package/build/lib/helpers/capabilities.d.ts.map +1 -0
- package/build/lib/helpers/capabilities.js +41 -1
- package/build/lib/index.d.ts +183 -0
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.js +40 -20
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts +48 -0
- package/build/lib/jsonwp-proxy/protocol-converter.d.ts.map +1 -0
- package/build/lib/jsonwp-proxy/proxy.d.ts +41 -0
- package/build/lib/jsonwp-proxy/proxy.d.ts.map +1 -0
- package/build/lib/jsonwp-proxy/proxy.js +24 -6
- package/build/lib/jsonwp-status/status.d.ts +159 -0
- package/build/lib/jsonwp-status/status.d.ts.map +1 -0
- package/build/lib/protocol/errors.d.ts +310 -0
- package/build/lib/protocol/errors.d.ts.map +1 -0
- package/build/lib/protocol/errors.js +81 -2
- package/build/lib/protocol/helpers.d.ts +22 -0
- package/build/lib/protocol/helpers.d.ts.map +1 -0
- package/build/lib/protocol/index.d.ts +16 -0
- package/build/lib/protocol/index.d.ts.map +1 -0
- package/build/lib/protocol/index.js +7 -7
- package/build/lib/protocol/protocol.d.ts +11 -0
- package/build/lib/protocol/protocol.d.ts.map +1 -0
- package/build/lib/protocol/protocol.js +2 -6
- package/build/lib/protocol/routes.d.ts +6 -0
- package/build/lib/protocol/routes.d.ts.map +1 -0
- package/build/lib/protocol/routes.js +17 -1
- package/build/lib/protocol/validators.d.ts +8 -0
- package/build/lib/protocol/validators.d.ts.map +1 -0
- package/build/test/basedriver/driver-tests.js +30 -3
- package/build/test/e2e/basedriver/websockets.e2e.spec.js +12 -7
- package/build/test/unit/basedriver/commands/event.spec.js +7 -7
- package/build/test/unit/basedriver/commands/log.spec.js +31 -24
- package/build/test/unit/basedriver/timeout.spec.js +1 -1
- package/build/test/unit/protocol/routes.spec.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -0
- package/lib/basedriver/capabilities.js +49 -10
- package/lib/basedriver/commands/event.js +49 -31
- package/lib/basedriver/commands/find.js +108 -43
- package/lib/basedriver/commands/index.js +25 -19
- package/lib/basedriver/commands/log.js +60 -33
- package/lib/basedriver/commands/session.js +39 -141
- package/lib/basedriver/commands/settings.js +33 -13
- package/lib/basedriver/commands/timeout.js +153 -153
- package/lib/basedriver/core.js +497 -0
- package/lib/basedriver/desired-caps.js +1 -1
- package/lib/basedriver/device-settings.js +47 -12
- package/lib/basedriver/driver.js +273 -395
- package/lib/basedriver/helpers.js +18 -2
- package/lib/express/websocket.js +35 -32
- package/lib/helpers/capabilities.js +60 -1
- package/lib/index.js +16 -12
- package/lib/jsonwp-proxy/proxy.js +26 -6
- package/lib/protocol/errors.js +42 -42
- package/lib/protocol/index.js +4 -4
- package/lib/protocol/protocol.js +1 -3
- package/lib/protocol/routes.js +9 -0
- package/package.json +14 -11
- package/test/basedriver/driver-tests.js +31 -2
- package/index.d.ts +0 -386
package/lib/protocol/protocol.js
CHANGED
|
@@ -16,8 +16,6 @@ const CREATE_SESSION_COMMAND = 'createSession';
|
|
|
16
16
|
const DELETE_SESSION_COMMAND = 'deleteSession';
|
|
17
17
|
const GET_STATUS_COMMAND = 'getStatus';
|
|
18
18
|
|
|
19
|
-
class Protocol {}
|
|
20
|
-
|
|
21
19
|
function determineProtocol (createSessionArgs) {
|
|
22
20
|
return _.some(createSessionArgs, isW3cCaps) ? PROTOCOLS.W3C : PROTOCOLS.MJSONWP;
|
|
23
21
|
}
|
|
@@ -456,7 +454,7 @@ async function doJwpProxy (driver, req, res) {
|
|
|
456
454
|
|
|
457
455
|
|
|
458
456
|
export {
|
|
459
|
-
|
|
457
|
+
routeConfiguringFunction, isSessionCommand,
|
|
460
458
|
driverShouldDoJwpProxy, determineProtocol, CREATE_SESSION_COMMAND,
|
|
461
459
|
DELETE_SESSION_COMMAND, GET_STATUS_COMMAND,
|
|
462
460
|
};
|
package/lib/protocol/routes.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
1
3
|
import _ from 'lodash';
|
|
2
4
|
import { util } from '@appium/support';
|
|
3
5
|
import { PROTOCOLS, DEFAULT_BASE_PATH } from '../constants';
|
|
@@ -14,6 +16,7 @@ const SET_ALERT_TEXT_PAYLOAD_PARAMS = {
|
|
|
14
16
|
// define the routes, mapping of HTTP methods to particular driver commands,
|
|
15
17
|
// and any parameters that are expected in a request
|
|
16
18
|
// parameters can be `required` or `optional`
|
|
19
|
+
/** @type {import('@appium/types').MethodMap} */
|
|
17
20
|
const METHOD_MAP = {
|
|
18
21
|
'/status': {
|
|
19
22
|
GET: {command: 'getStatus'}
|
|
@@ -240,6 +243,12 @@ const METHOD_MAP = {
|
|
|
240
243
|
'/session/:sessionId/element/:elementId/shadow': {
|
|
241
244
|
GET: {command: 'elementShadowRoot'}
|
|
242
245
|
},
|
|
246
|
+
'/session/:sessionId/shadow/:shadowId/element': {
|
|
247
|
+
POST: {command: 'findElementFromShadowRoot', payloadParams: {required: ['using', 'value']}}
|
|
248
|
+
},
|
|
249
|
+
'/session/:sessionId/shadow/:shadowId/elements': {
|
|
250
|
+
POST: {command: 'findElementsFromShadowRoot', payloadParams: {required: ['using', 'value']}}
|
|
251
|
+
},
|
|
243
252
|
'/session/:sessionId/element/:elementId/css/:propertyName': {
|
|
244
253
|
GET: {command: 'getCssProperty'}
|
|
245
254
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appium/base-driver",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.2",
|
|
4
4
|
"description": "Base driver class for Appium drivers",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"!build/test/e2e/fixtures"
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
|
-
"build": "npm run build:
|
|
41
|
-
"build:
|
|
40
|
+
"build": "npm run build:distfiles && npm run build:test",
|
|
41
|
+
"build:distfiles": "babel lib --root-mode=upward --out-dir=build/lib",
|
|
42
42
|
"build:test": "babel test --root-mode=upward --out-dir=build/test --copy-files",
|
|
43
|
-
"dev": "
|
|
43
|
+
"dev": "run-p \"build:distfiles -- --watch\" \"build:test -- --watch\"",
|
|
44
44
|
"fix": "npm run lint -- --fix",
|
|
45
45
|
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore .",
|
|
46
46
|
"test": "npm run test:unit",
|
|
@@ -48,25 +48,27 @@
|
|
|
48
48
|
"test:unit": "mocha --require ../../test/setup-babel.js \"./test/unit/**/*.spec.js\""
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@appium/support": "^2.
|
|
52
|
-
"@babel/runtime": "7.17.
|
|
51
|
+
"@appium/support": "^2.57.1",
|
|
52
|
+
"@babel/runtime": "7.17.9",
|
|
53
53
|
"@colors/colors": "1.5.0",
|
|
54
54
|
"async-lock": "1.3.1",
|
|
55
55
|
"asyncbox": "2.9.2",
|
|
56
56
|
"axios": "0.26.1",
|
|
57
57
|
"bluebird": "3.7.2",
|
|
58
|
-
"body-parser": "1.
|
|
58
|
+
"body-parser": "1.20.0",
|
|
59
59
|
"es6-error": "4.1.1",
|
|
60
60
|
"express": "4.17.3",
|
|
61
61
|
"http-status-codes": "2.2.0",
|
|
62
62
|
"lodash": "4.17.21",
|
|
63
|
-
"lru-cache": "7.
|
|
63
|
+
"lru-cache": "7.8.1",
|
|
64
64
|
"method-override": "3.0.0",
|
|
65
65
|
"morgan": "1.10.0",
|
|
66
66
|
"serve-favicon": "2.5.0",
|
|
67
67
|
"source-map-support": "0.5.21",
|
|
68
|
-
"validate.js": "0.13.1"
|
|
69
|
-
|
|
68
|
+
"validate.js": "0.13.1"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"ws": "8.5.0"
|
|
70
72
|
},
|
|
71
73
|
"engines": {
|
|
72
74
|
"node": ">=12",
|
|
@@ -75,5 +77,6 @@
|
|
|
75
77
|
"publishConfig": {
|
|
76
78
|
"access": "public"
|
|
77
79
|
},
|
|
78
|
-
"
|
|
80
|
+
"types": "./build/lib/index.d.ts",
|
|
81
|
+
"gitHead": "319f7289e7019efaeac1271936b2d991041a02c2"
|
|
79
82
|
}
|
|
@@ -10,6 +10,35 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) {
|
|
|
10
10
|
// to display the driver under test in report
|
|
11
11
|
const className = DriverClass.name || '(unknown driver)';
|
|
12
12
|
|
|
13
|
+
describe('static property', function () {
|
|
14
|
+
describe('baseVersion', function () {
|
|
15
|
+
it('should exist', function () {
|
|
16
|
+
DriverClass.baseVersion.should.exist;
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
describe('Log prefix', function () {
|
|
22
|
+
|
|
23
|
+
it('should setup log prefix', async function () {
|
|
24
|
+
const d = new DriverClass();
|
|
25
|
+
const previousPrefix = d.log.prefix;
|
|
26
|
+
await d.createSession({
|
|
27
|
+
alwaysMatch: Object.assign({}, defaultCaps, {
|
|
28
|
+
platformName: 'Fake',
|
|
29
|
+
'appium:deviceName': 'Commodore 64',
|
|
30
|
+
}),
|
|
31
|
+
firstMatch: [{}],
|
|
32
|
+
});
|
|
33
|
+
try {
|
|
34
|
+
previousPrefix.should.not.eql(d.log.prefix);
|
|
35
|
+
} finally {
|
|
36
|
+
await d.deleteSession();
|
|
37
|
+
previousPrefix.should.eql(d.log.prefix);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
});
|
|
13
42
|
|
|
14
43
|
describe(`BaseDriver (as ${className})`, function () {
|
|
15
44
|
let d, w3cCaps;
|
|
@@ -183,8 +212,8 @@ function baseDriverUnitTests (DriverClass, defaultCaps = {}) {
|
|
|
183
212
|
throw new Error('multipass');
|
|
184
213
|
}.bind(d);
|
|
185
214
|
|
|
186
|
-
afterEach(function () {
|
|
187
|
-
d.clearNewCommandTimeout();
|
|
215
|
+
afterEach(async function () {
|
|
216
|
+
await d.clearNewCommandTimeout();
|
|
188
217
|
});
|
|
189
218
|
|
|
190
219
|
it('should queue commands and.executeCommand/respond in the order received', async function () {
|
package/index.d.ts
DELETED
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
declare class BaseDriver {
|
|
2
|
-
// class variables
|
|
3
|
-
static baseVersion: string;
|
|
4
|
-
static newMethodMap?: MethodMap;
|
|
5
|
-
|
|
6
|
-
constructor(opts?: {}, shouldValidateCaps?: boolean);
|
|
7
|
-
|
|
8
|
-
// fields
|
|
9
|
-
sessionId: string;
|
|
10
|
-
opts: DriverOpts;
|
|
11
|
-
initialOpts: DriverOpts;
|
|
12
|
-
caps?: {};
|
|
13
|
-
originalCaps?: {};
|
|
14
|
-
helpers: DriverHelpers;
|
|
15
|
-
basePath: string;
|
|
16
|
-
relaxedSecurityEnabled: boolean;
|
|
17
|
-
allowInsecure: string[];
|
|
18
|
-
denyInsecure: string[];
|
|
19
|
-
newCommandTimeoutMs: number;
|
|
20
|
-
implicitWaitMs: number;
|
|
21
|
-
locatorStrategies: string[];
|
|
22
|
-
webLocatorStrategies: string[];
|
|
23
|
-
settings: DeviceSettings;
|
|
24
|
-
protocol?: string;
|
|
25
|
-
supportedLogTypes: { [type: string]: LogType };
|
|
26
|
-
|
|
27
|
-
// getters/setters
|
|
28
|
-
get driverData(): {};
|
|
29
|
-
get isCommandsQueueEnabled(): boolean;
|
|
30
|
-
get eventHistory(): {};
|
|
31
|
-
get desiredCapConstraints(): Constraints;
|
|
32
|
-
|
|
33
|
-
set desiredCapConstraints(constraints: Constraints);
|
|
34
|
-
|
|
35
|
-
// non-command methods
|
|
36
|
-
onUnexpectedShutdown(handler: () => any): void;
|
|
37
|
-
logEvent(eventName: string): void;
|
|
38
|
-
getStatus(): Promise<{}>;
|
|
39
|
-
sessionExists(sessionId: string): boolean;
|
|
40
|
-
logExtraCaps(caps: {}): void;
|
|
41
|
-
validateDesiredCaps(caps: {}): boolean;
|
|
42
|
-
isFeatureEnabled(name: string): boolean;
|
|
43
|
-
ensureFeatureEnabled(name: string): void;
|
|
44
|
-
executeCommand(cmd: string, ...args: any[]): Promise<any>;
|
|
45
|
-
startUnexpectedShutdown(err?: Error): Promise<void>;
|
|
46
|
-
validateLocatorStrategy(strategy: string, webContext?: boolean): void;
|
|
47
|
-
proxyActive(): boolean;
|
|
48
|
-
getProxyAvoidList(): [string, RegExp][];
|
|
49
|
-
canProxy(): boolean;
|
|
50
|
-
proxyRouteIsAvoided(sessionId: string, method: string, url: string): boolean;
|
|
51
|
-
addManagedDriver(driver: BaseDriver): void;
|
|
52
|
-
getManagedDrivers(): BaseDriver[];
|
|
53
|
-
clearNewCommandTimeout(): Promise<void>;
|
|
54
|
-
startNewCommandTimeout(): Promise<void>;
|
|
55
|
-
implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
|
|
56
|
-
|
|
57
|
-
// Commands
|
|
58
|
-
findElOrEls(strategy: string, selector: string, mult: boolean, context: string): Promise<Element | Element[]>;
|
|
59
|
-
newCommandTimeout(ms: number): Promise<void>;
|
|
60
|
-
getLogTypes(): Promise<string[]>;
|
|
61
|
-
getLog(logType: string): Promise<{}[]>;
|
|
62
|
-
|
|
63
|
-
// WebDriver
|
|
64
|
-
createSession(jwpCaps: {}, jwpReqCaps: {}, w3cCaps: {}): Promise<[string, {}]>;
|
|
65
|
-
deleteSession(): Promise<void>;
|
|
66
|
-
getSessions(): Promise<{ id: string; capabilities: {} }[]>;
|
|
67
|
-
getSession(): Promise<{}>;
|
|
68
|
-
getTimeouts(): Promise<Record<string, number>>;
|
|
69
|
-
timeouts(type: string, ms: number, script: number, pageLoad: number, implicit: number): Promise<void>;
|
|
70
|
-
setUrl?(url: string): Promise<void>;
|
|
71
|
-
getUrl?(): Promise<string>;
|
|
72
|
-
back?(): Promise<void>;
|
|
73
|
-
forward?(): Promise<void>;
|
|
74
|
-
refresh?(): Promise<void>;
|
|
75
|
-
title?(): Promise<string>;
|
|
76
|
-
getWindowHandle?(): Promise<string>;
|
|
77
|
-
closeWindow?(): Promise<string[]>;
|
|
78
|
-
setWindow?(handle: string): Promise<void>;
|
|
79
|
-
getWindowHandles?(): Promise<string[]>;
|
|
80
|
-
setFrame?(id: null | number | string): Promise<void>;
|
|
81
|
-
getWindowRect?(): Promise<Rect>;
|
|
82
|
-
setWindowRect?(x: number, y: number, width: number, height: number): Promise<Rect>;
|
|
83
|
-
maximizeWindow?(): Promise<Rect>;
|
|
84
|
-
minimizeWindow?(): Promise<Rect>;
|
|
85
|
-
fullScreenWindow?(): Promise<Rect>;
|
|
86
|
-
active?(): Promise<Element>;
|
|
87
|
-
findElement(strategy: string, selector: string): Promise<Element>;
|
|
88
|
-
findElements(strategy: string, selector: string): Promise<Element[]>;
|
|
89
|
-
findElementFromElement(strategy: string, selector: string, elementId: string): Promise<Element>;
|
|
90
|
-
findElementsFromElement(strategy: string, selector: string, elementId: string): Promise<Element[]>;
|
|
91
|
-
elementSelected?(elementId: string): Promise<boolean>;
|
|
92
|
-
getAttribute?(name: string, elementId: string): Promise<string | null>;
|
|
93
|
-
getProperty?(name: string, elementId: string): Promise<string | null>;
|
|
94
|
-
getCssProperty?(name: string, elementId: string): Promise<string>;
|
|
95
|
-
getText?(elementId: string): Promise<string>;
|
|
96
|
-
getName?(elementId: string): Promise<string>;
|
|
97
|
-
getElementRect?(elementId: string): Promise<Rect>;
|
|
98
|
-
elementEnabled?(elementId: string): Promise<boolean>;
|
|
99
|
-
elementDisplayed?(elementId: string): Promise<boolean>;
|
|
100
|
-
click?(elementId: string): Promise<void>;
|
|
101
|
-
clear?(elementId: string): Promise<void>;
|
|
102
|
-
setValue?(text: string, elementId: string): Promise<void>;
|
|
103
|
-
getPageSource?(): Promise<string>;
|
|
104
|
-
execute?(script: string, args: unknown[]): Promise<unknown>;
|
|
105
|
-
executeAsync?(script: string, args: unknown[]): Promise<unknown>;
|
|
106
|
-
getCookies?(): Promise<Cookie[]>;
|
|
107
|
-
getCookie?(name: string): Promise<Cookie>;
|
|
108
|
-
setCookie?(cookie: Cookie): Promise<void>;
|
|
109
|
-
deleteCookie?(name: string): Promise<void>;
|
|
110
|
-
deleteCookies?(): Promise<void>;
|
|
111
|
-
performActions?(actions: Actions[]): Promise<void>;
|
|
112
|
-
releaseActions?(): Promise<void>;
|
|
113
|
-
postDismissAlert?(): Promise<void>;
|
|
114
|
-
postAcceptAlert?(): Promise<void>;
|
|
115
|
-
getAlertText?(): Promise<string | null>;
|
|
116
|
-
setAlertText?(text: string): Promise<void>;
|
|
117
|
-
getScreenshot?(): Promise<string>;
|
|
118
|
-
getElementScreenshot?(elementId: string): Promise<string>;
|
|
119
|
-
|
|
120
|
-
// Appium W3C WebDriver Extension
|
|
121
|
-
mobileShake?(): Promise<void>;
|
|
122
|
-
getDeviceTime?(format?: string): Promise<string>;
|
|
123
|
-
lock?(seconds?: number): Promise<void>;
|
|
124
|
-
unlock?(): Promise<void>;
|
|
125
|
-
isLocked?(): Promise<boolean>;
|
|
126
|
-
startRecordingScreen?(options?: ScreenRecordOptions): Promise<void>;
|
|
127
|
-
stopRecordingScreen?(options?: ScreenRecordOptions): Promise<string>;
|
|
128
|
-
getPerformanceDataTypes?(): Promise<string[]>;
|
|
129
|
-
getPerformanceData?(packageName: string, dataType: string, dataReadTimeout?: number): Promise<string[]>;
|
|
130
|
-
pressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
|
|
131
|
-
longPressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
|
|
132
|
-
fingerprint?(fingerprintId: number): Promise<void>;
|
|
133
|
-
sendSMS?(phoneNumber: string, message: string): Promise<void>;
|
|
134
|
-
gsmCall?(phoneNumber: string, action: string): Promise<void>;
|
|
135
|
-
gsmSignal?(signalStrength: string): Promise<void>;
|
|
136
|
-
gsmVoice?(state: string): Promise<void>;
|
|
137
|
-
powerCapacity?(percent: number): Promise<void>;
|
|
138
|
-
powerAC?(state: string): Promise<void>;
|
|
139
|
-
networkSpeed?(netspeed: string): Promise<void>;
|
|
140
|
-
keyevent?(keycode: string, metastate?: string): Promise<void>;
|
|
141
|
-
mobileRotation?(x: number, y: number, radius: number, rotation: number, touchCount: number, duration: string, elementId?: string): Promise<void>;
|
|
142
|
-
getCurrentActivity?(): Promise<string>;
|
|
143
|
-
getCurrentPackage?(): Promise<string>;
|
|
144
|
-
installApp?(appPath: string, options?: unknown): Promise<void>;
|
|
145
|
-
activateApp?(appId: string, options?: unknown): Promise<void>;
|
|
146
|
-
removeApp?(appId: string, options?: unknown): Promise<void>;
|
|
147
|
-
terminateApp?(appId: string, options?: unknown): Promise<void>;
|
|
148
|
-
isAppInstalled?(appId: string): Promise<boolean>;
|
|
149
|
-
queryAppState?(appId: string): Promise<number>;
|
|
150
|
-
hideKeyboard?(strategy?: string, key?: string, keyCode?: string, keyName?: string): Promise<void>;
|
|
151
|
-
isKeyboardShown?(): Promise<boolean>;
|
|
152
|
-
pushFile?(path: string, data: string): Promise<void>;
|
|
153
|
-
pullFile?(path: string): Promise<string>;
|
|
154
|
-
pullFolder?(path: string): Promise<string>;
|
|
155
|
-
toggleFlightMode?(): Promise<void>;
|
|
156
|
-
toggleData?(): Promise<void>;
|
|
157
|
-
toggleWiFi?(): Promise<void>;
|
|
158
|
-
toggleLocationServices?(): Promise<void>;
|
|
159
|
-
openNotifications?(): Promise<void>;
|
|
160
|
-
startActivity?(appPackage: string, appActivity: string, appWaitPackage?: string, appWaitActivity?: string, intentAction?: string, intentCategory?: string, intentFlags?: string, optionalIntentArguments?: string, dontStopAppOnReset?: boolean): Promise<void>;
|
|
161
|
-
getSystemBars?(): Promise<unknown[]>;
|
|
162
|
-
getDisplayDensity?(): Promise<number>;
|
|
163
|
-
touchId?(match: boolean): Promise<void>;
|
|
164
|
-
toggleEnrollTouchId?(enabled: boolean): Promise<void>;
|
|
165
|
-
launchApp?(): Promise<void>;
|
|
166
|
-
closeApp?(): Promise<void>;
|
|
167
|
-
reset(): Promise<void>;
|
|
168
|
-
background?(seconds: null | number): Promise<void>;
|
|
169
|
-
endCoverage?(intent: string, path: string): Promise<void>;
|
|
170
|
-
getStrings?(language?: string, stringFile?: string): Promise<Record<string, unknown>>;
|
|
171
|
-
setValueImmediate?(value: string, elementId: string): Promise<void>;
|
|
172
|
-
replaceValue?(value: string, elementId: string): Promise<void>;
|
|
173
|
-
updateSettings(newSettings: Record<string, unknown>): Promise<void>;
|
|
174
|
-
getSettings(): Promise<Record<string, unknown>>;
|
|
175
|
-
receiveAsyncResponse?(response: unknown): Promise<void>;
|
|
176
|
-
getLogEvents(type?: string | string[]): {};
|
|
177
|
-
logCustomEvent(vendor: string, event: string): void;
|
|
178
|
-
setClipboard?(content: string, contentType?: string, label?: string): Promise<void>;
|
|
179
|
-
getClipboard?(contentType?: string): Promise<string>;
|
|
180
|
-
|
|
181
|
-
// JSONWP
|
|
182
|
-
asyncScriptTimeout?(ms: number): Promise<void>;
|
|
183
|
-
implicitWait(ms: number): Promise<void>;
|
|
184
|
-
getWindowSize?(): Promise<Size>;
|
|
185
|
-
getLocation?(elementId: string): Promise<Position>;
|
|
186
|
-
getLocationInView?(elementId: string): Promise<Position>;
|
|
187
|
-
getSize?(elementId: string): Promise<Size>;
|
|
188
|
-
equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
|
|
189
|
-
submit?(elementId: string): Promise<void>;
|
|
190
|
-
keys?(value: string[]): Promise<void>;
|
|
191
|
-
availableIMEEngines?(): Promise<string[]>;
|
|
192
|
-
getActiveIMEEngine?(): Promise<string>;
|
|
193
|
-
isIMEActivated?(): Promise<boolean>;
|
|
194
|
-
deactivateIMEEngine?(): Promise<void>;
|
|
195
|
-
activateIMEEngine?(engine: string): Promise<void>;
|
|
196
|
-
getOrientation?(): Promise<string>;
|
|
197
|
-
setOrientation?(orientation: string): Promise<void>;
|
|
198
|
-
moveTo?(element?: null | string, xOffset?: number, yOffset?: number): Promise<void>;
|
|
199
|
-
buttonDown?(button?: number): Promise<void>;
|
|
200
|
-
buttonUp?(button?: number): Promise<void>;
|
|
201
|
-
clickCurrent?(button?: number): Promise<void>;
|
|
202
|
-
doubleClick?(): Promise<void>;
|
|
203
|
-
touchDown?(x: number, y: number): Promise<void>;
|
|
204
|
-
touchUp?(x: number, y: number): Promise<void>;
|
|
205
|
-
touchMove?(x: number, y: number): Promise<void>;
|
|
206
|
-
touchLongClick?(elementId: string): Promise<void>;
|
|
207
|
-
flick?(element?: string, xSpeed?: number, ySpeed?: number, xOffset?: number, yOffset?: number, speed?: number): Promise<void>;
|
|
208
|
-
getGeoLocation?(): Promise<Location>;
|
|
209
|
-
setGeoLocation?(location: Partial<Location>): Promise<void>;
|
|
210
|
-
|
|
211
|
-
// MJSONWIRE
|
|
212
|
-
getCurrentContext?(): Promise<string | null>;
|
|
213
|
-
setContext?(name: string): Promise<void>;
|
|
214
|
-
getContexts?(): Promise<string[]>;
|
|
215
|
-
getPageIndex?(elementId: string): Promise<string>;
|
|
216
|
-
getNetworkConnection?(): Promise<number>;
|
|
217
|
-
setNetworkConnection?(type: number): Promise<void>;
|
|
218
|
-
performTouch?(actions: unknown): Promise<void>;
|
|
219
|
-
performMultiAction?(actions: unknown, elementId: string): Promise<void>;
|
|
220
|
-
getRotation?(): Promise<Rotation>;
|
|
221
|
-
setRotation?(x: number, y: number, z: number): Promise<void>;
|
|
222
|
-
|
|
223
|
-
// Chromium DevTools
|
|
224
|
-
executeCdp?(cmd: string, params: unknown): Promise<unknown>;
|
|
225
|
-
|
|
226
|
-
// Web Authentication
|
|
227
|
-
addVirtualAuthenticator?(protocol: string, transport: string, hasResidentKey?: boolean, hasUserVerification?: boolean, isUserConsenting?: boolean, isUserVerified?: boolean): Promise<void>;
|
|
228
|
-
removeVirtualAuthenticator?(): Promise<void>;
|
|
229
|
-
addAuthCredential?(credentialId: string, isResidentCredential: boolean, rpId: string, privateKey: string, userHandle?: string, signCount?: number): Promise<void>;
|
|
230
|
-
getAuthCredential?(): Promise<Credential[]>;
|
|
231
|
-
removeAllAuthCredentials?(): Promise<void>;
|
|
232
|
-
removeAuthCredential?(): Promise<void>;
|
|
233
|
-
setUserAuthVerified?(isUserVerified: boolean): Promise<void>;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
declare type MethodMap = {
|
|
237
|
-
[path: string]: {
|
|
238
|
-
[method: string]: {
|
|
239
|
-
command?: string;
|
|
240
|
-
neverProxy?: boolean;
|
|
241
|
-
payloadParams?: {
|
|
242
|
-
wrap?: string;
|
|
243
|
-
unwrap?: string;
|
|
244
|
-
required?: string[] | string[][];
|
|
245
|
-
optional?: string[] | string[][];
|
|
246
|
-
validate?: (obj: any, protocol: string) => any;
|
|
247
|
-
makeArgs?: (obj: any) => any;
|
|
248
|
-
};
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
declare type Constraints = {
|
|
254
|
-
[key: string]: {
|
|
255
|
-
presence?: boolean;
|
|
256
|
-
isString?: boolean;
|
|
257
|
-
isNumber?: boolean;
|
|
258
|
-
isBoolean?: boolean;
|
|
259
|
-
isObject?: boolean;
|
|
260
|
-
isArray?: boolean;
|
|
261
|
-
deprecated?: boolean;
|
|
262
|
-
inclusion?: any[];
|
|
263
|
-
};
|
|
264
|
-
};
|
|
265
|
-
|
|
266
|
-
declare type DriverOpts = {
|
|
267
|
-
tmpDir: string;
|
|
268
|
-
[key: string]: any;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
declare type Element = {
|
|
272
|
-
'element-6066-11e4-a52e-4f735466cecf': string;
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
declare interface DriverHelpers {
|
|
276
|
-
configureApp: (app: string, supportedAppExtensions: string[]) => Promise<string>;
|
|
277
|
-
isPackageOrBundle: (app: string) => boolean;
|
|
278
|
-
duplicateKeys: <T>(input: T, firstKey: string, secondKey: string) => T;
|
|
279
|
-
parseCapsArray: (cap: string | string[]) => string[];
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
declare type SettingsUpdater = (
|
|
283
|
-
prop: string,
|
|
284
|
-
newValue: {},
|
|
285
|
-
curValue: {},
|
|
286
|
-
) => Promise<void>;
|
|
287
|
-
|
|
288
|
-
declare class DeviceSettings {
|
|
289
|
-
constructor(defaultSettings: {}, onSettingsUpdate: SettingsUpdater);
|
|
290
|
-
update(newSettings: {}): Promise<void>;
|
|
291
|
-
getSettings(): Record<string, unknown>;;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
declare type LogType = {
|
|
295
|
-
description: string;
|
|
296
|
-
getter: (driver: BaseDriver) => Promise<{}[]>;
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
// WebDriver
|
|
300
|
-
|
|
301
|
-
declare type Rect = {
|
|
302
|
-
x: number;
|
|
303
|
-
y: number;
|
|
304
|
-
width: number;
|
|
305
|
-
height: number;
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
declare type Cookie = {
|
|
309
|
-
name: string;
|
|
310
|
-
value: string;
|
|
311
|
-
path?: string;
|
|
312
|
-
domain?: string;
|
|
313
|
-
secure?: boolean;
|
|
314
|
-
httpOnly?: boolean;
|
|
315
|
-
expiry?: number;
|
|
316
|
-
sameSite?: 'Lax' | 'Strict';
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
declare type Actions = {
|
|
320
|
-
type?: string;
|
|
321
|
-
actions: Action[];
|
|
322
|
-
parameters?: {
|
|
323
|
-
pointerType?: string;
|
|
324
|
-
};
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
declare type Action = {
|
|
328
|
-
duration?: number;
|
|
329
|
-
type: string;
|
|
330
|
-
value?: string;
|
|
331
|
-
x?: number;
|
|
332
|
-
y?: number;
|
|
333
|
-
button?: number;
|
|
334
|
-
origin?: string;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
// Appium W3C WebDriver Extension
|
|
338
|
-
|
|
339
|
-
declare type ScreenRecordOptions = {
|
|
340
|
-
remotePath?: string;
|
|
341
|
-
username?: string;
|
|
342
|
-
password?: string;
|
|
343
|
-
method?: string;
|
|
344
|
-
forceRestart?: boolean;
|
|
345
|
-
timeLimit?: string;
|
|
346
|
-
videoType?: string;
|
|
347
|
-
videoQuality?: string;
|
|
348
|
-
videoFps?: string;
|
|
349
|
-
videoScale?: string;
|
|
350
|
-
bitRate?: string;
|
|
351
|
-
videoSize?: string;
|
|
352
|
-
bugReport?: string;
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
// JSONWP
|
|
356
|
-
|
|
357
|
-
declare type Size = Pick<Rect, 'width' | 'height'>;
|
|
358
|
-
|
|
359
|
-
declare type Position = Pick<Rect, 'x' | 'y'>;
|
|
360
|
-
|
|
361
|
-
declare type Location = {
|
|
362
|
-
latitude: number;
|
|
363
|
-
longitude: number;
|
|
364
|
-
altitude: number;
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
declare type Rotation = {
|
|
368
|
-
x: number;
|
|
369
|
-
y: number;
|
|
370
|
-
z: number;
|
|
371
|
-
};
|
|
372
|
-
|
|
373
|
-
// Web Authentication
|
|
374
|
-
|
|
375
|
-
declare type Credential = {
|
|
376
|
-
credentialId: string;
|
|
377
|
-
isResidentCredential: boolean;
|
|
378
|
-
rpId: string;
|
|
379
|
-
privateKey: string;
|
|
380
|
-
userHandle?: string;
|
|
381
|
-
signCount: number;
|
|
382
|
-
largeBlob?: string;
|
|
383
|
-
};
|
|
384
|
-
|
|
385
|
-
export { BaseDriver, DriverHelpers, DriverOpts, Element, LogType, MethodMap, Constraints, SettingsUpdater, DeviceSettings, Rect, Cookie, Actions, Action, ScreenRecordOptions, Size, Position, Location, Rotation, Credential };
|
|
386
|
-
export default BaseDriver;
|