@appium/base-driver 9.3.3 → 9.3.5
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 +59 -36
- package/build/lib/basedriver/capabilities.d.ts.map +1 -1
- package/build/lib/basedriver/capabilities.js +57 -45
- package/build/lib/basedriver/capabilities.js.map +1 -1
- package/build/lib/basedriver/commands/event.d.ts +1 -1
- package/build/lib/basedriver/commands/event.d.ts.map +1 -1
- package/build/lib/basedriver/commands/event.js.map +1 -1
- package/build/lib/basedriver/commands/execute.d.ts +1 -1
- package/build/lib/basedriver/commands/execute.d.ts.map +1 -1
- package/build/lib/basedriver/commands/execute.js.map +1 -1
- package/build/lib/basedriver/commands/find.d.ts +1 -1
- package/build/lib/basedriver/commands/find.d.ts.map +1 -1
- package/build/lib/basedriver/commands/find.js.map +1 -1
- package/build/lib/basedriver/commands/index.d.ts +7 -7
- package/build/lib/basedriver/commands/index.d.ts.map +1 -1
- package/build/lib/basedriver/commands/index.js +7 -21
- package/build/lib/basedriver/commands/index.js.map +1 -1
- package/build/lib/basedriver/commands/log.d.ts +1 -1
- package/build/lib/basedriver/commands/log.d.ts.map +1 -1
- package/build/lib/basedriver/commands/log.js.map +1 -1
- package/build/lib/basedriver/commands/mixin.d.ts +4 -4
- package/build/lib/basedriver/commands/mixin.d.ts.map +1 -1
- package/build/lib/basedriver/commands/mixin.js +5 -4
- package/build/lib/basedriver/commands/mixin.js.map +1 -1
- package/build/lib/basedriver/commands/session.d.ts +1 -1
- package/build/lib/basedriver/commands/session.d.ts.map +1 -1
- package/build/lib/basedriver/commands/session.js +1 -4
- package/build/lib/basedriver/commands/session.js.map +1 -1
- package/build/lib/basedriver/commands/settings.d.ts +1 -1
- package/build/lib/basedriver/commands/settings.d.ts.map +1 -1
- package/build/lib/basedriver/commands/settings.js.map +1 -1
- package/build/lib/basedriver/commands/timeout.d.ts +1 -1
- package/build/lib/basedriver/commands/timeout.d.ts.map +1 -1
- package/build/lib/basedriver/commands/timeout.js +1 -4
- package/build/lib/basedriver/commands/timeout.js.map +1 -1
- package/build/lib/basedriver/core.d.ts +13 -17
- package/build/lib/basedriver/core.d.ts.map +1 -1
- package/build/lib/basedriver/core.js +32 -20
- package/build/lib/basedriver/core.js.map +1 -1
- package/build/lib/basedriver/device-settings.d.ts +11 -11
- package/build/lib/basedriver/device-settings.d.ts.map +1 -1
- package/build/lib/basedriver/device-settings.js +7 -8
- package/build/lib/basedriver/device-settings.js.map +1 -1
- package/build/lib/basedriver/driver.d.ts +23 -108
- package/build/lib/basedriver/driver.d.ts.map +1 -1
- package/build/lib/basedriver/driver.js +21 -126
- package/build/lib/basedriver/driver.js.map +1 -1
- package/build/lib/basedriver/helpers.d.ts +21 -98
- package/build/lib/basedriver/helpers.d.ts.map +1 -1
- package/build/lib/basedriver/helpers.js +178 -182
- package/build/lib/basedriver/helpers.js.map +1 -1
- package/build/lib/express/server.d.ts +3 -3
- package/build/lib/express/server.d.ts.map +1 -1
- package/build/lib/express/server.js +4 -2
- package/build/lib/express/server.js.map +1 -1
- package/build/lib/express/websocket.d.ts +5 -44
- package/build/lib/express/websocket.d.ts.map +1 -1
- package/build/lib/express/websocket.js +10 -39
- package/build/lib/express/websocket.js.map +1 -1
- package/build/lib/helpers/capabilities.d.ts +2 -2
- package/build/lib/helpers/capabilities.d.ts.map +1 -1
- package/build/lib/helpers/capabilities.js +2 -3
- package/build/lib/helpers/capabilities.js.map +1 -1
- package/build/lib/protocol/protocol.d.ts +1 -1
- package/build/lib/protocol/protocol.d.ts.map +1 -1
- package/build/lib/protocol/protocol.js +10 -2
- package/build/lib/protocol/protocol.js.map +1 -1
- package/build/lib/protocol/routes.d.ts +1 -0
- package/build/lib/protocol/routes.d.ts.map +1 -1
- package/build/lib/protocol/routes.js +12 -10
- package/build/lib/protocol/routes.js.map +1 -1
- package/lib/basedriver/capabilities.js +70 -56
- package/lib/basedriver/commands/event.ts +3 -2
- package/lib/basedriver/commands/execute.ts +2 -1
- package/lib/basedriver/commands/find.ts +1 -0
- package/lib/basedriver/commands/index.ts +7 -7
- package/lib/basedriver/commands/log.ts +2 -4
- package/lib/basedriver/commands/mixin.ts +5 -4
- package/lib/basedriver/commands/session.ts +9 -7
- package/lib/basedriver/commands/settings.ts +1 -0
- package/lib/basedriver/commands/timeout.ts +17 -17
- package/lib/basedriver/core.js +11 -25
- package/lib/basedriver/device-settings.js +9 -11
- package/lib/basedriver/{driver.js → driver.ts} +69 -175
- package/lib/basedriver/helpers.js +214 -212
- package/lib/express/server.js +4 -2
- package/lib/express/websocket.js +10 -39
- package/lib/helpers/capabilities.js +2 -3
- package/lib/protocol/protocol.js +11 -2
- package/lib/protocol/routes.js +12 -13
- package/package.json +10 -6
|
@@ -1,132 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
declare const BaseDriver_base_3: typeof DriverCore;
|
|
5
|
-
declare const BaseDriver_base_4: typeof DriverCore;
|
|
6
|
-
declare const BaseDriver_base_5: typeof DriverCore;
|
|
7
|
-
declare const BaseDriver_base_6: typeof DriverCore;
|
|
8
|
-
/**
|
|
9
|
-
* @implements {SessionHandler<C>}
|
|
10
|
-
* @template {Constraints} C
|
|
11
|
-
* @template {StringRecord} [CArgs=StringRecord]
|
|
12
|
-
* @implements {Driver<C, CArgs>}
|
|
13
|
-
* @extends {DriverCore<C>}
|
|
14
|
-
*/
|
|
15
|
-
export class BaseDriver<C extends Readonly<Record<string, import("@appium/types").Constraint>>, CArgs extends import("@appium/types").StringRecord = import("@appium/types").StringRecord> extends DriverCore<C>, BaseDriver_base, BaseDriver_base_1, BaseDriver_base_2, BaseDriver_base_3, BaseDriver_base_4, BaseDriver_base_5, BaseDriver_base_6 implements SessionHandler<C>, Driver<C, CArgs> {
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param {DriverOpts<C>} opts
|
|
19
|
-
* @param {boolean} shouldValidateCaps
|
|
20
|
-
*/
|
|
21
|
-
constructor(opts?: DriverOpts<C>, shouldValidateCaps?: boolean);
|
|
22
|
-
/**
|
|
23
|
-
* @type {CArgs & ServerArgs}
|
|
24
|
-
*/
|
|
1
|
+
import { DriverCore } from './core';
|
|
2
|
+
import { AppiumServer, BaseDriverCapConstraints, Capabilities, Constraints, DefaultCreateSessionResult, Driver, DriverCaps, DriverData, DriverOpts, ServerArgs, StringRecord, W3CDriverCaps } from '@appium/types';
|
|
3
|
+
export declare class BaseDriver<C extends Constraints, CArgs extends StringRecord = StringRecord, Settings extends StringRecord = StringRecord> extends DriverCore<C, Settings> implements Driver<C, CArgs> {
|
|
25
4
|
cliArgs: CArgs & ServerArgs;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*/
|
|
29
|
-
caps: Capabilities<C>;
|
|
30
|
-
/**
|
|
31
|
-
* @type {W3CCapabilities<C>}
|
|
32
|
-
*/
|
|
33
|
-
originalCaps: W3CCapabilities<C>;
|
|
34
|
-
/**
|
|
35
|
-
* @type {C}
|
|
36
|
-
*/
|
|
5
|
+
caps: DriverCaps<C>;
|
|
6
|
+
originalCaps: W3CDriverCaps<C>;
|
|
37
7
|
desiredCapConstraints: C;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
8
|
+
opts: DriverOpts<C>;
|
|
9
|
+
server?: AppiumServer;
|
|
10
|
+
serverHost?: string;
|
|
11
|
+
serverPort?: number;
|
|
12
|
+
serverPath?: string;
|
|
13
|
+
constructor(opts: DriverOpts<C>, shouldValidateCaps?: boolean);
|
|
42
14
|
/**
|
|
43
15
|
* Contains the base constraints plus whatever the subclass wants to add.
|
|
44
16
|
*
|
|
45
17
|
* Subclasses _shouldn't_ need to use this. If you need to use this, please create
|
|
46
18
|
* an issue:
|
|
47
19
|
* @see https://github.com/appium/appium/issues/new
|
|
48
|
-
* @type {Readonly<BaseDriverCapConstraints & C>}
|
|
49
|
-
* @protected
|
|
50
|
-
*/
|
|
51
|
-
protected get _desiredCapConstraints(): Readonly<typeof BASE_DESIRED_CAP_CONSTRAINTS & C>;
|
|
52
|
-
/**
|
|
53
|
-
* @param {string} cmd
|
|
54
|
-
* @param {...any} args
|
|
55
|
-
* @returns {Promise<any>}
|
|
56
20
|
*/
|
|
57
|
-
|
|
21
|
+
protected get _desiredCapConstraints(): Readonly<BaseDriverCapConstraints & C>;
|
|
58
22
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
23
|
+
* This is the main command handler for the driver. It wraps command
|
|
24
|
+
* execution with timeout logic, checking that we have a valid session,
|
|
25
|
+
* and ensuring that we execute commands one at a time. This method is called
|
|
26
|
+
* by MJSONWP's express router.
|
|
61
27
|
*/
|
|
62
|
-
|
|
28
|
+
executeCommand<T = unknown>(cmd: string, ...args: any[]): Promise<T>;
|
|
29
|
+
startUnexpectedShutdown(err?: Error): Promise<void>;
|
|
63
30
|
startNewCommandTimeout(): Promise<void>;
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
* @param {import('@appium/types').AppiumServer} server
|
|
67
|
-
* @param {string} host
|
|
68
|
-
* @param {number} port
|
|
69
|
-
* @param {string} path
|
|
70
|
-
*/
|
|
71
|
-
assignServer(server: import('@appium/types').AppiumServer, host: string, port: number, path: string): void;
|
|
72
|
-
server: import("@appium/types").AppiumServer | undefined;
|
|
73
|
-
serverHost: string | undefined;
|
|
74
|
-
serverPort: number | undefined;
|
|
75
|
-
serverPath: string | undefined;
|
|
31
|
+
assignServer(server: AppiumServer, host: string, port: number, path: string): void;
|
|
76
32
|
reset(): Promise<void>;
|
|
77
|
-
resetOnUnexpectedShutdown: (() => void) | undefined;
|
|
78
33
|
/**
|
|
79
34
|
*
|
|
80
35
|
* Historically the first two arguments were reserved for JSONWP capabilities.
|
|
81
36
|
* Appium 2 has dropped the support of these, so now we only accept capability
|
|
82
37
|
* objects in W3C format and thus allow any of the three arguments to represent
|
|
83
38
|
* the latter.
|
|
84
|
-
* @param {W3CCapabilities<C>} w3cCapabilities1
|
|
85
|
-
* @param {W3CCapabilities<C>} [w3cCapabilities2]
|
|
86
|
-
* @param {W3CCapabilities<C>} [w3cCapabilities]
|
|
87
|
-
* @param {DriverData[]} [driverData]
|
|
88
|
-
* @returns {Promise<[string,Capabilities<C>]>}
|
|
89
|
-
*/
|
|
90
|
-
createSession(w3cCapabilities1: W3CCapabilities<C>, w3cCapabilities2?: W3CCapabilities<C, void> | undefined, w3cCapabilities?: W3CCapabilities<C, void> | undefined, driverData?: import("@appium/types").DriverData[] | undefined): Promise<[string, Capabilities<C>]>;
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
* @param {string} [sessionId]
|
|
94
|
-
* @param {DriverData[]} [driverData]
|
|
95
|
-
* @returns {Promise<void>}
|
|
96
|
-
*/
|
|
97
|
-
deleteSession(sessionId?: string | undefined, driverData?: import("@appium/types").DriverData[] | undefined): Promise<void>;
|
|
98
|
-
/**
|
|
99
|
-
*
|
|
100
|
-
* @param {Capabilities<C>} caps
|
|
101
39
|
*/
|
|
40
|
+
createSession(w3cCapabilities1: W3CDriverCaps<C>, w3cCapabilities2?: W3CDriverCaps<C>, w3cCapabilities?: W3CDriverCaps<C>, driverData?: DriverData[]): Promise<DefaultCreateSessionResult<C>>;
|
|
41
|
+
deleteSession(sessionId?: string | null): Promise<void>;
|
|
102
42
|
logExtraCaps(caps: Capabilities<C>): void;
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
* @param {Capabilities<C>} caps
|
|
106
|
-
* @returns {boolean}
|
|
107
|
-
*/
|
|
108
|
-
validateDesiredCaps(caps: Capabilities<C>): boolean;
|
|
43
|
+
validateDesiredCaps(caps: any): caps is DriverCaps<C>;
|
|
109
44
|
}
|
|
110
|
-
export * from
|
|
45
|
+
export * from './commands';
|
|
111
46
|
export default BaseDriver;
|
|
112
|
-
export type HTTPMethod = import('@appium/types').HTTPMethod;
|
|
113
|
-
export type DriverData = import('@appium/types').DriverData;
|
|
114
|
-
export type Constraints = import('@appium/types').Constraints;
|
|
115
|
-
export type Constraint = import('@appium/types').Constraint;
|
|
116
|
-
export type StringRecord = import('@appium/types').StringRecord;
|
|
117
|
-
export type BaseDriverCapConstraints = import('@appium/types').BaseDriverCapConstraints;
|
|
118
|
-
export type ServerArgs = import('@appium/types').ServerArgs;
|
|
119
|
-
export type UpdateServerCallback = (app: import('express').Express, httpServer: import('@appium/types').AppiumServer) => import('type-fest').Promisable<void>;
|
|
120
|
-
/**
|
|
121
|
-
* This is used to extend {@linkcode BaseDriver } by the mixins and also external drivers.
|
|
122
|
-
*/
|
|
123
|
-
export type BaseDriverBase<C extends Readonly<Record<string, import("@appium/types").Constraint>>, Proto = {}, Static = {}> = import('@appium/types').Class<BaseDriver<C> & Proto, import("@appium/types").DriverStatic<any> & Static>;
|
|
124
|
-
export type SessionHandler<C extends Readonly<Record<string, import("@appium/types").Constraint>> = typeof BASE_DESIRED_CAP_CONSTRAINTS> = import('@appium/types').SessionHandler<[string, object], void, C>;
|
|
125
|
-
export type Capabilities<C extends Readonly<Record<string, import("@appium/types").Constraint>> = typeof BASE_DESIRED_CAP_CONSTRAINTS, Extra extends void | import("@appium/types").StringRecord = void> = import('@appium/types').Capabilities<C, Extra>;
|
|
126
|
-
export type W3CCapabilities<C extends Readonly<Record<string, import("@appium/types").Constraint>> = typeof BASE_DESIRED_CAP_CONSTRAINTS, Extra extends void | import("@appium/types").StringRecord = void> = import('@appium/types').W3CCapabilities<C, Extra>;
|
|
127
|
-
export type Driver<C extends Readonly<Record<string, import("@appium/types").Constraint>> = typeof BASE_DESIRED_CAP_CONSTRAINTS, CArgs extends import("@appium/types").StringRecord = import("@appium/types").StringRecord> = import('@appium/types').Driver<C, CArgs>;
|
|
128
|
-
export type ExternalDriver<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('@appium/types').ExternalDriver<C>;
|
|
129
|
-
export type DriverOpts<C extends Readonly<Record<string, import("@appium/types").Constraint>>> = import('@appium/types').DriverOpts<C>;
|
|
130
|
-
import { DriverCore } from "./core";
|
|
131
|
-
import { BASE_DESIRED_CAP_CONSTRAINTS } from "@appium/types";
|
|
132
47
|
//# sourceMappingURL=driver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/driver.
|
|
1
|
+
{"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/driver.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAOlC,OAAO,EACL,YAAY,EACZ,wBAAwB,EAExB,YAAY,EACZ,WAAW,EACX,0BAA0B,EAC1B,MAAM,EACN,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACd,MAAM,eAAe,CAAC;AAQvB,qBAAa,UAAU,CACnB,CAAC,SAAS,WAAW,EACrB,KAAK,SAAS,YAAY,GAAG,YAAY,EACzC,QAAQ,SAAS,YAAY,GAAG,YAAY,CAE9C,SAAQ,UAAU,CAAC,CAAC,EAAE,QAAQ,CAC9B,YAAW,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC;IAE3B,OAAO,EAAE,KAAK,GAAG,UAAU,CAAC;IAE5B,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACpB,YAAY,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IAC/B,qBAAqB,EAAE,CAAC,CAAC;IACzB,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IACpB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;gBAER,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,kBAAkB,UAAO;IAQ1D;;;;;;OAMG;IACH,SAAS,KAAK,sBAAsB,IAAI,QAAQ,CAAC,wBAAwB,GAAG,CAAC,CAAC,CAE7E;IAED;;;;;OAKG;IACG,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAsEpE,uBAAuB,CAC3B,GAAG,GAAE,KAA8E;IAa/E,sBAAsB;IAqB5B,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAWrE,KAAK;IA8BX;;;;;;OAMG;IACG,aAAa,CACjB,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC,EAClC,gBAAgB,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EACnC,eAAe,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,EAElC,UAAU,CAAC,EAAE,UAAU,EAAE,GACxB,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,CAAC;IAiFnC,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAc7C,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAYlC,mBAAmB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,UAAU,CAAC,CAAC,CAAC;CAoBtD;AAED,cAAc,YAAY,CAAC;AAE3B,eAAe,UAAU,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable require-await */
|
|
3
|
-
/* eslint-disable no-unused-vars */
|
|
4
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
5
3
|
if (k2 === undefined) k2 = k;
|
|
6
4
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -34,28 +32,11 @@ const EVENT_SESSION_START = 'newSessionStarted';
|
|
|
34
32
|
const EVENT_SESSION_QUIT_START = 'quitSessionRequested';
|
|
35
33
|
const EVENT_SESSION_QUIT_DONE = 'quitSessionFinished';
|
|
36
34
|
const ON_UNEXPECTED_SHUTDOWN_EVENT = 'onUnexpectedShutdown';
|
|
37
|
-
/**
|
|
38
|
-
* @implements {SessionHandler<C>}
|
|
39
|
-
* @template {Constraints} C
|
|
40
|
-
* @template {StringRecord} [CArgs=StringRecord]
|
|
41
|
-
* @implements {Driver<C, CArgs>}
|
|
42
|
-
* @extends {DriverCore<C>}
|
|
43
|
-
*/
|
|
44
35
|
class BaseDriver extends core_1.DriverCore {
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
* @param {DriverOpts<C>} opts
|
|
48
|
-
* @param {boolean} shouldValidateCaps
|
|
49
|
-
*/
|
|
50
|
-
constructor(opts = /** @type {DriverOpts<C>} */ ({}), shouldValidateCaps = true) {
|
|
36
|
+
constructor(opts, shouldValidateCaps = true) {
|
|
51
37
|
super(opts, shouldValidateCaps);
|
|
52
|
-
/**
|
|
53
|
-
* This must be assigned here because the declaration of {@linkcode BaseDriver.opts} above
|
|
54
|
-
* blows away {@linkcode DriverCore.opts}.
|
|
55
|
-
*/
|
|
56
|
-
this.opts = opts;
|
|
57
38
|
this.caps = {};
|
|
58
|
-
this.cliArgs =
|
|
39
|
+
this.cliArgs = {};
|
|
59
40
|
}
|
|
60
41
|
/**
|
|
61
42
|
* Contains the base constraints plus whatever the subclass wants to add.
|
|
@@ -63,24 +44,19 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
63
44
|
* Subclasses _shouldn't_ need to use this. If you need to use this, please create
|
|
64
45
|
* an issue:
|
|
65
46
|
* @see https://github.com/appium/appium/issues/new
|
|
66
|
-
* @type {Readonly<BaseDriverCapConstraints & C>}
|
|
67
|
-
* @protected
|
|
68
47
|
*/
|
|
69
48
|
get _desiredCapConstraints() {
|
|
70
49
|
return Object.freeze(lodash_1.default.merge({}, types_1.BASE_DESIRED_CAP_CONSTRAINTS, this.desiredCapConstraints));
|
|
71
50
|
}
|
|
72
|
-
// This is the main command handler for the driver. It wraps command
|
|
73
|
-
// execution with timeout logic, checking that we have a valid session,
|
|
74
|
-
// and ensuring that we execute commands one at a time. This method is called
|
|
75
|
-
// by MJSONWP's express router.
|
|
76
51
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
52
|
+
* This is the main command handler for the driver. It wraps command
|
|
53
|
+
* execution with timeout logic, checking that we have a valid session,
|
|
54
|
+
* and ensuring that we execute commands one at a time. This method is called
|
|
55
|
+
* by MJSONWP's express router.
|
|
80
56
|
*/
|
|
81
57
|
async executeCommand(cmd, ...args) {
|
|
82
58
|
// get start time for this command, and log in special cases
|
|
83
|
-
|
|
59
|
+
const startTime = Date.now();
|
|
84
60
|
if (cmd === 'createSession') {
|
|
85
61
|
// If creating a session determine if W3C or MJSONWP protocol was requested and remember the choice
|
|
86
62
|
this.protocol = (0, protocol_1.determineProtocol)(args);
|
|
@@ -137,10 +113,6 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
137
113
|
}
|
|
138
114
|
return res;
|
|
139
115
|
}
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param {Error|import('../protocol/errors').NoSuchDriverError} err
|
|
143
|
-
*/
|
|
144
116
|
async startUnexpectedShutdown(err = new protocol_1.errors.NoSuchDriverError('The driver was unexpectedly shut down!')) {
|
|
145
117
|
this.eventEmitter.emit(ON_UNEXPECTED_SHUTDOWN_EVENT, err); // allow others to listen for this
|
|
146
118
|
this.shutdownUnexpectedly = true;
|
|
@@ -169,13 +141,6 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
169
141
|
await this.startUnexpectedShutdown(new Error(errorMessage));
|
|
170
142
|
}, this.newCommandTimeoutMs);
|
|
171
143
|
}
|
|
172
|
-
/**
|
|
173
|
-
*
|
|
174
|
-
* @param {import('@appium/types').AppiumServer} server
|
|
175
|
-
* @param {string} host
|
|
176
|
-
* @param {number} port
|
|
177
|
-
* @param {string} path
|
|
178
|
-
*/
|
|
179
144
|
assignServer(server, host, port, path) {
|
|
180
145
|
this.server = server;
|
|
181
146
|
this.serverHost = host;
|
|
@@ -190,8 +155,8 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
190
155
|
this.log.debug('Resetting app mid-session');
|
|
191
156
|
this.log.debug('Running generic full reset');
|
|
192
157
|
// preserving state
|
|
193
|
-
|
|
194
|
-
for (
|
|
158
|
+
const currentConfig = {};
|
|
159
|
+
for (const property of [
|
|
195
160
|
'implicitWaitMs',
|
|
196
161
|
'newCommandTimeoutMs',
|
|
197
162
|
'sessionId',
|
|
@@ -199,8 +164,6 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
199
164
|
]) {
|
|
200
165
|
currentConfig[property] = this[property];
|
|
201
166
|
}
|
|
202
|
-
// We also need to preserve the unexpected shutdown, and make sure it is not cancelled during reset.
|
|
203
|
-
this.resetOnUnexpectedShutdown = () => { };
|
|
204
167
|
try {
|
|
205
168
|
if (this.sessionId !== null) {
|
|
206
169
|
await this.deleteSession(this.sessionId);
|
|
@@ -210,7 +173,7 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
210
173
|
}
|
|
211
174
|
finally {
|
|
212
175
|
// always restore state.
|
|
213
|
-
for (
|
|
176
|
+
for (const [key, value] of lodash_1.default.toPairs(currentConfig)) {
|
|
214
177
|
this[key] = value;
|
|
215
178
|
}
|
|
216
179
|
}
|
|
@@ -222,13 +185,10 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
222
185
|
* Appium 2 has dropped the support of these, so now we only accept capability
|
|
223
186
|
* objects in W3C format and thus allow any of the three arguments to represent
|
|
224
187
|
* the latter.
|
|
225
|
-
* @param {W3CCapabilities<C>} w3cCapabilities1
|
|
226
|
-
* @param {W3CCapabilities<C>} [w3cCapabilities2]
|
|
227
|
-
* @param {W3CCapabilities<C>} [w3cCapabilities]
|
|
228
|
-
* @param {DriverData[]} [driverData]
|
|
229
|
-
* @returns {Promise<[string,Capabilities<C>]>}
|
|
230
188
|
*/
|
|
231
|
-
async createSession(w3cCapabilities1, w3cCapabilities2, w3cCapabilities,
|
|
189
|
+
async createSession(w3cCapabilities1, w3cCapabilities2, w3cCapabilities,
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
191
|
+
driverData) {
|
|
232
192
|
if (this.sessionId !== null) {
|
|
233
193
|
throw new protocol_1.errors.SessionNotCreatedError('Cannot create a new session while one is in progress');
|
|
234
194
|
}
|
|
@@ -241,7 +201,6 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
241
201
|
this.setProtocolW3C();
|
|
242
202
|
this.originalCaps = originalCaps;
|
|
243
203
|
this.log.debug(`Creating session with W3C capabilities: ${JSON.stringify(originalCaps, null, 2)}`);
|
|
244
|
-
/** @type {Capabilities<C>} */
|
|
245
204
|
let caps;
|
|
246
205
|
try {
|
|
247
206
|
caps = (0, capabilities_1.processCapabilities)(originalCaps, this._desiredCapConstraints, this.shouldValidateCaps);
|
|
@@ -276,37 +235,28 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
276
235
|
delete this.opts.app;
|
|
277
236
|
}
|
|
278
237
|
if (!lodash_1.default.isUndefined(this.caps.newCommandTimeout)) {
|
|
279
|
-
this.newCommandTimeoutMs =
|
|
238
|
+
this.newCommandTimeoutMs = this.caps.newCommandTimeout * 1000;
|
|
280
239
|
}
|
|
281
240
|
this._log.prefix = helpers_1.default.generateDriverLogPrefix(this, this.sessionId);
|
|
282
241
|
this.log.info(`Session created with session id: ${this.sessionId}`);
|
|
283
242
|
return [this.sessionId, caps];
|
|
284
243
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
* @param {string} [sessionId]
|
|
288
|
-
* @param {DriverData[]} [driverData]
|
|
289
|
-
* @returns {Promise<void>}
|
|
290
|
-
*/
|
|
291
|
-
async deleteSession(sessionId, driverData) {
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
245
|
+
async deleteSession(sessionId) {
|
|
292
246
|
await this.clearNewCommandTimeout();
|
|
293
247
|
if (this.isCommandsQueueEnabled && this.commandsQueueGuard.isBusy()) {
|
|
294
248
|
// simple hack to release pending commands if they exist
|
|
295
|
-
// @ts-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
249
|
+
// @ts-expect-error private API
|
|
250
|
+
const queues = this.commandsQueueGuard.queues;
|
|
251
|
+
for (const key of lodash_1.default.keys(queues)) {
|
|
252
|
+
queues[key] = [];
|
|
299
253
|
}
|
|
300
254
|
}
|
|
301
255
|
this.sessionId = null;
|
|
302
256
|
this._log.prefix = helpers_1.default.generateDriverLogPrefix(this);
|
|
303
257
|
}
|
|
304
|
-
/**
|
|
305
|
-
*
|
|
306
|
-
* @param {Capabilities<C>} caps
|
|
307
|
-
*/
|
|
308
258
|
logExtraCaps(caps) {
|
|
309
|
-
|
|
259
|
+
const extraCaps = lodash_1.default.difference(lodash_1.default.keys(caps), lodash_1.default.keys(this._desiredCapConstraints));
|
|
310
260
|
if (extraCaps.length) {
|
|
311
261
|
this.log.warn(`The following capabilities were provided, but are not ` + `recognized by Appium:`);
|
|
312
262
|
for (const cap of extraCaps) {
|
|
@@ -314,11 +264,6 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
314
264
|
}
|
|
315
265
|
}
|
|
316
266
|
}
|
|
317
|
-
/**
|
|
318
|
-
*
|
|
319
|
-
* @param {Capabilities<C>} caps
|
|
320
|
-
* @returns {boolean}
|
|
321
|
-
*/
|
|
322
267
|
validateDesiredCaps(caps) {
|
|
323
268
|
if (!this.shouldValidateCaps) {
|
|
324
269
|
return true;
|
|
@@ -335,56 +280,6 @@ class BaseDriver extends core_1.DriverCore {
|
|
|
335
280
|
}
|
|
336
281
|
}
|
|
337
282
|
exports.BaseDriver = BaseDriver;
|
|
338
|
-
// eslint-disable-next-line import/no-unresolved
|
|
339
283
|
__exportStar(require("./commands"), exports);
|
|
340
284
|
exports.default = BaseDriver;
|
|
341
|
-
/**
|
|
342
|
-
* @typedef {import('@appium/types').HTTPMethod} HTTPMethod
|
|
343
|
-
* @typedef {import('@appium/types').DriverData} DriverData
|
|
344
|
-
* @typedef {import('@appium/types').Constraints} Constraints
|
|
345
|
-
* @typedef {import('@appium/types').Constraint} Constraint
|
|
346
|
-
* @typedef {import('@appium/types').StringRecord} StringRecord
|
|
347
|
-
* @typedef {import('@appium/types').BaseDriverCapConstraints} BaseDriverCapConstraints
|
|
348
|
-
* @typedef {import('@appium/types').ServerArgs} ServerArgs
|
|
349
|
-
*/
|
|
350
|
-
/**
|
|
351
|
-
* @callback UpdateServerCallback
|
|
352
|
-
* @param {import('express').Express} app - Express app
|
|
353
|
-
* @param {import('@appium/types').AppiumServer} httpServer - HTTP server
|
|
354
|
-
* @returns {import('type-fest').Promisable<void>}
|
|
355
|
-
*/
|
|
356
|
-
/**
|
|
357
|
-
* This is used to extend {@linkcode BaseDriver} by the mixins and also external drivers.
|
|
358
|
-
* @template {Constraints} C
|
|
359
|
-
* @template [Proto={}]
|
|
360
|
-
* @template [Static={}]
|
|
361
|
-
* @typedef {import('@appium/types').Class<BaseDriver<C> & Proto,import('@appium/types').DriverStatic & Static>} BaseDriverBase
|
|
362
|
-
*/
|
|
363
|
-
/**
|
|
364
|
-
* @template {Constraints} [C=BaseDriverCapConstraints]
|
|
365
|
-
* @typedef {import('@appium/types').SessionHandler<[string, object],void, C>} SessionHandler
|
|
366
|
-
*/
|
|
367
|
-
/**
|
|
368
|
-
* @template {Constraints} [C=BaseDriverCapConstraints]
|
|
369
|
-
* @template {StringRecord|void} [Extra=void]
|
|
370
|
-
* @typedef {import('@appium/types').Capabilities<C, Extra>} Capabilities
|
|
371
|
-
*/
|
|
372
|
-
/**
|
|
373
|
-
* @template {Constraints} [C=BaseDriverCapConstraints]
|
|
374
|
-
* @template {StringRecord|void} [Extra=void]
|
|
375
|
-
* @typedef {import('@appium/types').W3CCapabilities<C, Extra>} W3CCapabilities
|
|
376
|
-
*/
|
|
377
|
-
/**
|
|
378
|
-
* @template {Constraints} [C=BaseDriverCapConstraints]
|
|
379
|
-
* @template {StringRecord} [CArgs=StringRecord]
|
|
380
|
-
* @typedef {import('@appium/types').Driver<C, CArgs>} Driver
|
|
381
|
-
*/
|
|
382
|
-
/**
|
|
383
|
-
* @template {Constraints} C
|
|
384
|
-
* @typedef {import('@appium/types').ExternalDriver<C>} ExternalDriver
|
|
385
|
-
*/
|
|
386
|
-
/**
|
|
387
|
-
* @template {Constraints} C
|
|
388
|
-
* @typedef {import('@appium/types').DriverOpts<C>} DriverOpts
|
|
389
|
-
*/
|
|
390
285
|
//# sourceMappingURL=driver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../../lib/basedriver/driver.
|
|
1
|
+
{"version":3,"file":"driver.js","sourceRoot":"","sources":["../../../lib/basedriver/driver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,iDAAiE;AACjE,iCAAkC;AAClC,6CAAqC;AACrC,wDAAyB;AACzB,oDAAuB;AACvB,0DAA2D;AAC3D,0CAA8E;AAC9E,wDAAgC;AAChC,yCAcuB;AAEvB,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AACjD,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAChD,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AACxD,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AACtD,MAAM,4BAA4B,GAAG,sBAAsB,CAAC;AAE5D,MAAa,UAKX,SAAQ,iBAAuB;IAc/B,YAAY,IAAmB,EAAE,kBAAkB,GAAG,IAAI;QACxD,KAAK,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;QAEhC,IAAI,CAAC,IAAI,GAAG,EAAmB,CAAC;QAEhC,IAAI,CAAC,OAAO,GAAG,EAAwB,CAAC;IAC1C,CAAC;IAED;;;;;;OAMG;IACH,IAAc,sBAAsB;QAClC,OAAO,MAAM,CAAC,MAAM,CAAC,gBAAC,CAAC,KAAK,CAAC,EAAE,EAAE,oCAA4B,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC9F,CAAC;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|
export default _default;
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* - immutable: Optional boolean value. Contains true if the file has an `immutable` mark
|
|
9
|
-
* in `Cache-control` header
|
|
10
|
-
* - maxAge: Optional integer representation of `maxAge` parameter in `Cache-control` header
|
|
11
|
-
* - timestamp: The timestamp this item has been added to the cache (measured in Unix epoch
|
|
12
|
-
* milliseconds)
|
|
13
|
-
* - integrity: An object containing either `file` property with SHA1 hash of the file
|
|
14
|
-
* or `folder` property with total amount of cached files and subfolders
|
|
15
|
-
* - fullPath: the full path to the cached app
|
|
16
|
-
*/
|
|
17
|
-
cachedAppInfo: any | null;
|
|
18
|
-
/**
|
|
19
|
-
* Whether the app has been downloaded from a remote URL
|
|
20
|
-
*/
|
|
21
|
-
isUrl: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Optional headers object. Only present if `isUrl` is true and if the server
|
|
24
|
-
* responds to HEAD requests. All header names are normalized to lowercase.
|
|
25
|
-
*/
|
|
26
|
-
headers: any | null;
|
|
27
|
-
/**
|
|
28
|
-
* A string containing full path to the preprocessed application package (either
|
|
29
|
-
* downloaded or a local one)
|
|
30
|
-
*/
|
|
31
|
-
appPath: string;
|
|
3
|
+
export type RemoteAppProps = {
|
|
4
|
+
lastModified: Date | null;
|
|
5
|
+
immutable: boolean;
|
|
6
|
+
maxAge: number | null;
|
|
7
|
+
etag: string | null;
|
|
32
8
|
};
|
|
33
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Properties of the remote application (e.g. GET HTTP response) to be downloaded.
|
|
11
|
+
*/
|
|
12
|
+
export type RemoteAppData = {
|
|
34
13
|
/**
|
|
35
|
-
* The
|
|
36
|
-
* local file system (might be a file or a folder path)
|
|
14
|
+
* The HTTP status of the response
|
|
37
15
|
*/
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
export type ConfigureAppOptions = {
|
|
16
|
+
status: number;
|
|
41
17
|
/**
|
|
42
|
-
*
|
|
43
|
-
* to the application after it is downloaded/preprocessed. This function may be async
|
|
44
|
-
* and is expected to accept single object parameter.
|
|
45
|
-
* The function is expected to either return a falsy value, which means the app must not be
|
|
46
|
-
* cached and a fresh copy of it is downloaded each time. If this function returns an object
|
|
47
|
-
* containing `appPath` property then the integrity of it will be verified and stored into
|
|
48
|
-
* the cache.
|
|
18
|
+
* The HTTP response body represented as readable stream
|
|
49
19
|
*/
|
|
50
|
-
|
|
20
|
+
stream: import('stream').Readable;
|
|
51
21
|
/**
|
|
52
|
-
*
|
|
53
|
-
* including starting dots). This property is mandatory and must not be empty.
|
|
22
|
+
* HTTP response headers
|
|
54
23
|
*/
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
export type RemoteAppProps = {
|
|
58
|
-
lastModified: Date | null;
|
|
59
|
-
immutable: boolean;
|
|
60
|
-
maxAge: number | null;
|
|
24
|
+
headers: import('axios').RawAxiosResponseHeaders | import('axios').AxiosResponseHeaders;
|
|
61
25
|
};
|
|
62
26
|
/**
|
|
63
|
-
* @typedef PostProcessOptions
|
|
64
|
-
* @property {?Object} cachedAppInfo The information about the previously cached app instance (if exists):
|
|
65
|
-
* - packageHash: SHA1 hash of the package if it is a file and not a folder
|
|
66
|
-
* - lastModified: Optional Date instance, the value of file's `Last-Modified` header
|
|
67
|
-
* - immutable: Optional boolean value. Contains true if the file has an `immutable` mark
|
|
68
|
-
* in `Cache-control` header
|
|
69
|
-
* - maxAge: Optional integer representation of `maxAge` parameter in `Cache-control` header
|
|
70
|
-
* - timestamp: The timestamp this item has been added to the cache (measured in Unix epoch
|
|
71
|
-
* milliseconds)
|
|
72
|
-
* - integrity: An object containing either `file` property with SHA1 hash of the file
|
|
73
|
-
* or `folder` property with total amount of cached files and subfolders
|
|
74
|
-
* - fullPath: the full path to the cached app
|
|
75
|
-
* @property {boolean} isUrl Whether the app has been downloaded from a remote URL
|
|
76
|
-
* @property {?Object} headers Optional headers object. Only present if `isUrl` is true and if the server
|
|
77
|
-
* responds to HEAD requests. All header names are normalized to lowercase.
|
|
78
|
-
* @property {string} appPath A string containing full path to the preprocessed application package (either
|
|
79
|
-
* downloaded or a local one)
|
|
80
|
-
*/
|
|
81
|
-
/**
|
|
82
|
-
* @typedef PostProcessResult
|
|
83
|
-
* @property {string} appPath The full past to the post-processed application package on the
|
|
84
|
-
* local file system (might be a file or a folder path)
|
|
85
|
-
*/
|
|
86
|
-
/**
|
|
87
|
-
* @typedef ConfigureAppOptions
|
|
88
|
-
* @property {(obj: PostProcessOptions) => (Promise<PostProcessResult|undefined>|PostProcessResult|undefined)} [onPostProcess]
|
|
89
|
-
* Optional function, which should be applied
|
|
90
|
-
* to the application after it is downloaded/preprocessed. This function may be async
|
|
91
|
-
* and is expected to accept single object parameter.
|
|
92
|
-
* The function is expected to either return a falsy value, which means the app must not be
|
|
93
|
-
* cached and a fresh copy of it is downloaded each time. If this function returns an object
|
|
94
|
-
* containing `appPath` property then the integrity of it will be verified and stored into
|
|
95
|
-
* the cache.
|
|
96
|
-
* @property {string[]} supportedExtensions List of supported application extensions (
|
|
97
|
-
* including starting dots). This property is mandatory and must not be empty.
|
|
98
|
-
*/
|
|
99
|
-
/**
|
|
100
|
-
* Prepares an app to be used in an automated test. The app gets cached automatically
|
|
101
|
-
* if it is an archive or if it is downloaded from an URL.
|
|
102
|
-
* If the downloaded app has `.zip` extension, this method will unzip it.
|
|
103
|
-
* The unzip does not work when `onPostProcess` is provided.
|
|
104
27
|
*
|
|
105
|
-
* @param {string} app
|
|
106
|
-
* @param {string|string[]|ConfigureAppOptions} options
|
|
107
|
-
* @returns The full path to the resulting application bundle
|
|
28
|
+
* @param {string} app
|
|
29
|
+
* @param {string|string[]|import('@appium/types').ConfigureAppOptions} options
|
|
108
30
|
*/
|
|
109
|
-
export function configureApp(app: string, options?: string | string[] | ConfigureAppOptions): Promise<any>;
|
|
31
|
+
export function configureApp(app: string, options?: string | string[] | import('@appium/types').ConfigureAppOptions): Promise<any>;
|
|
110
32
|
export function isPackageOrBundle(app: any): boolean;
|
|
111
33
|
/**
|
|
112
34
|
* Finds all instances 'firstKey' and create a duplicate with the key 'secondKey',
|
|
@@ -133,5 +55,6 @@ export function parseCapsArray(cap: string | Array<string>): any[];
|
|
|
133
55
|
* @param {string?} sessionId session identifier (if exists)
|
|
134
56
|
* @returns {string}
|
|
135
57
|
*/
|
|
136
|
-
export function generateDriverLogPrefix(obj: import(
|
|
58
|
+
export function generateDriverLogPrefix(obj: import("@appium/types").Core<any, import("@appium/types").StringRecord<any>>, sessionId?: string | null): string;
|
|
59
|
+
export const BASEDRIVER_VER: string;
|
|
137
60
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/helpers.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../lib/basedriver/helpers.js"],"names":[],"mappings":"wBA2kBW,OAAO,eAAe,EAAE,aAAa;;;kBAmBlC,IAAI;eACJ,OAAO;YACP,MAAM;UACN,MAAM;;;;;;;;;YAKN,MAAM;;;;YACN,OAAO,QAAQ,EAAE,QAAQ;;;;aACzB,OAAO,OAAO,EAAE,uBAAuB,GAAG,OAAO,OAAO,EAAE,oBAAoB;;AAtgB5F;;;;GAIG;AACH,kCAHW,MAAM,YACN,MAAM,GAAC,MAAM,EAAE,GAAC,OAAO,eAAe,EAAE,mBAAmB,gBA6PrE;AA4JD,qDAEC;AAED;;;;;;;;;GASG;AACH,oFAuBC;AAED;;;;;GAKG;AACH,oCAFW,MAAM,GAAC,aAAa,SAoB9B;AAED;;;;;;GAMG;AACH,uIAHW,MAAM,UACJ,MAAM,CAKlB"}
|