@appium/fake-driver 5.1.3 → 5.1.4

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.
Files changed (40) hide show
  1. package/build/lib/commands/alert.d.ts +58 -310
  2. package/build/lib/commands/alert.d.ts.map +1 -1
  3. package/build/lib/commands/alert.js +58 -69
  4. package/build/lib/commands/alert.js.map +1 -1
  5. package/build/lib/commands/contexts.d.ts +81 -330
  6. package/build/lib/commands/contexts.d.ts.map +1 -1
  7. package/build/lib/commands/contexts.js +75 -84
  8. package/build/lib/commands/contexts.js.map +1 -1
  9. package/build/lib/commands/element.d.ts +146 -315
  10. package/build/lib/commands/element.d.ts.map +1 -1
  11. package/build/lib/commands/element.js +134 -98
  12. package/build/lib/commands/element.js.map +1 -1
  13. package/build/lib/commands/find.d.ts +83 -327
  14. package/build/lib/commands/find.d.ts.map +1 -1
  15. package/build/lib/commands/find.js +93 -97
  16. package/build/lib/commands/find.js.map +1 -1
  17. package/build/lib/commands/general.d.ts +174 -332
  18. package/build/lib/commands/general.d.ts.map +1 -1
  19. package/build/lib/commands/general.js +119 -90
  20. package/build/lib/commands/general.js.map +1 -1
  21. package/build/lib/commands/index.d.ts +5 -1523
  22. package/build/lib/commands/index.d.ts.map +1 -1
  23. package/build/lib/commands/index.js +14 -14
  24. package/build/lib/commands/index.js.map +1 -1
  25. package/build/lib/driver.d.ts +80 -15
  26. package/build/lib/driver.d.ts.map +1 -1
  27. package/build/lib/driver.js +74 -24
  28. package/build/lib/driver.js.map +1 -1
  29. package/build/lib/types.d.ts +1 -24
  30. package/build/lib/types.d.ts.map +1 -1
  31. package/build/tsconfig.tsbuildinfo +1 -1
  32. package/lib/commands/alert.js +58 -67
  33. package/lib/commands/contexts.js +72 -81
  34. package/lib/commands/element.js +135 -94
  35. package/lib/commands/find.js +94 -98
  36. package/lib/commands/general.js +119 -91
  37. package/lib/commands/index.js +5 -13
  38. package/lib/driver.js +76 -20
  39. package/lib/types.ts +1 -29
  40. package/package.json +2 -2
@@ -1,332 +1,83 @@
1
- /// <reference types="node" />
2
- /**
3
- *
4
- * @template {Class<import('../types').IFakeDriver>} T
5
- * @param {T} Base
6
- */
7
- export function ContextsMixin<T extends Class<import("../types").IFakeDriver, {}, any[]>>(Base: T): {
8
- new (...arguments_: any[]): {
9
- getRawContexts(): {
10
- NATIVE_APP: null;
11
- PROXY: null;
12
- };
13
- assertWebviewContext(): void;
14
- getCurrentContext(): Promise<string>;
15
- /**
16
- * Get the list of available contexts
17
- *
18
- * @returns {Promise<string[]>}
19
- */
20
- getContexts(): Promise<string[]>;
21
- /**
22
- * Set the current context
23
- *
24
- * @param {string} context - name of the context
25
- * @returns {Promise<void>}
26
- */
27
- setContext(context: string): Promise<void>;
28
- curContext: string;
29
- _proxyActive: boolean | undefined;
30
- /**
31
- * Set the active frame
32
- *
33
- * @param {number} frameId
34
- * @returns {Promise<void>}
35
- */
36
- setFrame(frameId: number): Promise<void>;
37
- elMap: Record<string, import("../fake-element").FakeElement>;
38
- maxElId: number;
39
- appModel: import("../fake-app").FakeApp;
40
- focusedElId: string;
41
- server?: import("@appium/types").AppiumServer | undefined;
42
- serverHost?: string | undefined;
43
- serverPort?: number | undefined;
44
- serverPath?: string | undefined;
45
- setUrl?(url: string): Promise<void>;
46
- getUrl?(): Promise<string>;
47
- back?(): Promise<void>;
48
- forward?(): Promise<void>;
49
- refresh?(): Promise<void>;
50
- title?(): Promise<string>;
51
- getWindowHandle?(): Promise<string>;
52
- closeWindow?(): Promise<string[]>;
53
- setWindow?(handle: string): Promise<void>;
54
- getWindowHandles?(): Promise<string[]>;
55
- createNewWindow?(type?: import("@appium/types").NewWindowType | undefined): Promise<import("@appium/types").NewWindow>;
56
- switchToParentFrame?(): Promise<void>;
57
- getWindowRect?(): Promise<import("@appium/types").Rect>;
58
- setWindowRect?(x: number, y: number, width: number, height: number): Promise<import("@appium/types").Rect>;
59
- maximizeWindow?(): Promise<import("@appium/types").Rect>;
60
- minimizeWindow?(): Promise<import("@appium/types").Rect>;
61
- fullScreenWindow?(): Promise<import("@appium/types").Rect>;
62
- active?(): Promise<import("@appium/types").Element>;
63
- elementShadowRoot?(elementId: string): Promise<import("@appium/types").Element>;
64
- elementSelected?(elementId: string): Promise<boolean>;
65
- getAttribute?(name: string, elementId: string): Promise<string | null>;
66
- getProperty?(name: string, elementId: string): Promise<string | null>;
67
- getCssProperty?(name: string, elementId: string): Promise<string>;
68
- getText?(elementId: string): Promise<string>;
69
- getName?(elementId: string): Promise<string>;
70
- getElementRect?(elementId: string): Promise<import("@appium/types").Rect>;
71
- elementEnabled?(elementId: string): Promise<boolean>;
72
- getComputedRole?(elementId: string): Promise<string | null>;
73
- getComputedLabel?(elementId: string): Promise<string | null>;
74
- elementDisplayed?(elementId: string): Promise<boolean>;
75
- click?(elementId: string): Promise<void>;
76
- clear?(elementId: string): Promise<void>;
77
- setValue?(text: string, elementId: string): Promise<void>;
78
- execute?(script: string, args: unknown[]): Promise<unknown>;
79
- executeAsync?(script: string, args: unknown[]): Promise<unknown>;
80
- getCookies?(): Promise<import("@appium/types").Cookie[]>;
81
- getCookie?(name: string): Promise<import("@appium/types").Cookie>;
82
- setCookie?(cookie: import("@appium/types").Cookie): Promise<void>;
83
- deleteCookie?(name: string): Promise<void>;
84
- deleteCookies?(): Promise<void>;
85
- performActions?(actions: import("@appium/types").ActionSequence[]): Promise<void>;
86
- releaseActions?(): Promise<void>;
87
- postDismissAlert?(): Promise<void>;
88
- postAcceptAlert?(): Promise<void>;
89
- getAlertText?(): Promise<string | null>;
90
- setAlertText?(text: string): Promise<void>;
91
- getScreenshot?(): Promise<string>;
92
- getElementScreenshot?(elementId: string): Promise<string>;
93
- mobileShake?(): Promise<void>;
94
- getDeviceTime?(format?: string | undefined): Promise<string>;
95
- lock?(seconds?: number | undefined): Promise<void>;
96
- unlock?(): Promise<void>;
97
- isLocked?(): Promise<boolean>;
98
- startRecordingScreen?(options?: import("@appium/types").StartScreenRecordOptions | undefined): Promise<void>;
99
- stopRecordingScreen?(options?: import("@appium/types").StopScreenRecordOptions | undefined): Promise<string>;
100
- getPerformanceDataTypes?(): Promise<string[]>;
101
- getPerformanceData?(packageName: string, dataType: string, dataReadTimeout?: number | undefined): Promise<string[]>;
102
- pressKeyCode?(keycode: number, metastate?: number | undefined, flags?: number | undefined): Promise<void>;
103
- longPressKeyCode?(keycode: number, metastate?: number | undefined, flags?: number | undefined): Promise<void>;
104
- fingerprint?(fingerprintId: number): Promise<void>;
105
- sendSMS?(phoneNumber: string, message: string): Promise<void>;
106
- gsmCall?(phoneNumber: string, action: string): Promise<void>;
107
- gsmSignal?(signalStrength: string): Promise<void>;
108
- gsmVoice?(state: string): Promise<void>;
109
- powerCapacity?(percent: number): Promise<void>;
110
- powerAC?(state: string): Promise<void>;
111
- networkSpeed?(netspeed: string): Promise<void>;
112
- keyevent?(keycode: string, metastate?: string | undefined): Promise<void>;
113
- mobileRotation?(x: number, y: number, radius: number, rotation: number, touchCount: number, duration: string, elementId?: string | undefined): Promise<void>;
114
- getCurrentActivity?(): Promise<string>;
115
- getCurrentPackage?(): Promise<string>;
116
- installApp?(appPath: string, options?: unknown): Promise<void>;
117
- activateApp?(appId: string, options?: unknown): Promise<void>;
118
- removeApp?(appId: string, options?: unknown): Promise<void>;
119
- terminateApp?(appId: string, options?: unknown): Promise<void>;
120
- isAppInstalled?(appId: string): Promise<boolean>;
121
- queryAppState?(appId: string): Promise<0 | 1 | 3 | 4>;
122
- hideKeyboard?(strategy?: string | undefined, key?: string | undefined, keyCode?: string | undefined, keyName?: string | undefined): Promise<void>;
123
- isKeyboardShown?(): Promise<boolean>;
124
- pushFile?(path: string, data: string): Promise<void>;
125
- pullFile?(path: string): Promise<string>;
126
- pullFolder?(path: string): Promise<string>;
127
- toggleFlightMode?(): Promise<void>;
128
- toggleData?(): Promise<void>;
129
- toggleWiFi?(): Promise<void>;
130
- toggleLocationServices?(): Promise<void>;
131
- openNotifications?(): Promise<void>;
132
- startActivity?(appPackage: string, appActivity: string, appWaitPackage?: string | undefined, appWaitActivity?: string | undefined, intentAction?: string | undefined, intentCategory?: string | undefined, intentFlags?: string | undefined, optionalIntentArguments?: string | undefined, dontStopAppOnReset?: boolean | undefined): Promise<void>;
133
- getSystemBars?(): Promise<unknown[]>;
134
- getDisplayDensity?(): Promise<number>;
135
- touchId?(match: boolean): Promise<void>;
136
- toggleEnrollTouchId?(enabled: boolean): Promise<void>;
137
- launchApp?(): Promise<void>;
138
- closeApp?(): Promise<void>;
139
- background?(seconds: number | null): Promise<void>;
140
- endCoverage?(intent: string, path: string): Promise<void>;
141
- getStrings?(language?: string | undefined, stringFile?: string | undefined): Promise<Record<string, unknown>>;
142
- setValueImmediate?(value: string, elementId: string): Promise<void>;
143
- replaceValue?(value: string, elementId: string): Promise<void>;
144
- receiveAsyncResponse?(response: unknown): Promise<void>;
145
- setClipboard?(content: string, contentType?: string | undefined, label?: string | undefined): Promise<void>;
146
- getClipboard?(contentType?: string | undefined): Promise<string>;
147
- asyncScriptTimeout?(ms: number): Promise<void>;
148
- getWindowSize?(): Promise<import("@appium/types").Size>;
149
- getLocation?(elementId: string): Promise<import("@appium/types").Position>;
150
- getLocationInView?(elementId: string): Promise<import("@appium/types").Position>;
151
- getSize?(elementId: string): Promise<import("@appium/types").Size>;
152
- equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
153
- submit?(elementId: string): Promise<void>;
154
- keys?(value: string[]): Promise<void>;
155
- availableIMEEngines?(): Promise<string[]>;
156
- getActiveIMEEngine?(): Promise<string>;
157
- isIMEActivated?(): Promise<boolean>;
158
- deactivateIMEEngine?(): Promise<void>;
159
- activateIMEEngine?(engine: string): Promise<void>;
160
- getOrientation?(): Promise<string>;
161
- setOrientation?(orientation: string): Promise<void>;
162
- moveTo?(element?: string | null | undefined, xOffset?: number | undefined, yOffset?: number | undefined): Promise<void>;
163
- buttonDown?(button?: number | undefined): Promise<void>;
164
- buttonUp?(button?: number | undefined): Promise<void>;
165
- clickCurrent?(button?: number | undefined): Promise<void>;
166
- doubleClick?(): Promise<void>;
167
- touchDown?(x: number, y: number): Promise<void>;
168
- touchUp?(x: number, y: number): Promise<void>;
169
- touchMove?(x: number, y: number): Promise<void>;
170
- touchLongClick?(elementId: string): Promise<void>;
171
- flick?(element?: string | undefined, xSpeed?: number | undefined, ySpeed?: number | undefined, xOffset?: number | undefined, yOffset?: number | undefined, speed?: number | undefined): Promise<void>;
172
- getGeoLocation?(): Promise<import("@appium/types").Location>;
173
- setGeoLocation?(location: Partial<import("@appium/types").Location>): Promise<void>;
174
- getPageIndex?(elementId: string): Promise<string>;
175
- getNetworkConnection?(): Promise<number>;
176
- setNetworkConnection?(type: number): Promise<void>;
177
- performTouch?(actions: unknown): Promise<void>;
178
- performMultiAction?(actions: unknown, elementId: string): Promise<void>;
179
- getRotation?(): Promise<import("@appium/types").Rotation>;
180
- setRotation?(x: number, y: number, z: number): Promise<void>;
181
- executeCdp?(cmd: string, params: unknown): Promise<unknown>;
182
- addVirtualAuthenticator?(protocol: "ctap/u2f" | "ctap2" | "ctap2_1", transport: string, hasResidentKey?: boolean | undefined, hasUserVerification?: boolean | undefined, isUserConsenting?: boolean | undefined, isUserVerified?: boolean | undefined): Promise<string>;
183
- removeVirtualAuthenticator?(authenticatorId: string): Promise<void>;
184
- addAuthCredential?(credentialId: string, isResidentCredential: boolean, rpId: string, privateKey: string, userHandle: string, signCount: number, authenticatorId: string): Promise<void>;
185
- getAuthCredential?(): Promise<import("@appium/types").Credential[]>;
186
- removeAllAuthCredentials?(): Promise<void>;
187
- removeAuthCredential?(credentialId: string, authenticatorId: string): Promise<void>;
188
- setUserAuthVerified?(isUserVerified: boolean, authenticatorId: string): Promise<void>;
189
- proxyCommand?<T_1 = any>(url: string, method: import("@appium/types").HTTPMethod, body?: string | undefined): Promise<T_1>;
190
- cliArgs: import("@appium/types").StringRecord;
191
- executeCommand(cmd: string, ...args: any[]): Promise<any>;
192
- startUnexpectedShutdown(err?: Error | undefined): Promise<void>;
193
- startNewCommandTimeout(): Promise<void>;
194
- reset(): Promise<void>;
195
- caps?: Partial<import("@appium/types").ConstraintsToCaps<{
196
- readonly app: {
197
- readonly presence: true;
198
- readonly isString: true;
199
- };
200
- readonly uniqueApp: {
201
- readonly isBoolean: true;
202
- };
203
- }> & void> | undefined;
204
- originalCaps?: import("@appium/types").W3CCapabilities<{
205
- readonly app: {
206
- readonly presence: true;
207
- readonly isString: true;
208
- };
209
- readonly uniqueApp: {
210
- readonly isBoolean: true;
211
- };
212
- }, void> | undefined;
213
- desiredCapConstraints: {
214
- readonly app: {
215
- readonly presence: true;
216
- readonly isString: true;
217
- };
218
- readonly uniqueApp: {
219
- readonly isBoolean: true;
220
- };
221
- };
222
- assignServer?(server: import("@appium/types").AppiumServer, host: string, port: number, path: string): void;
223
- getSessions(): Promise<import("@appium/types").MultiSessionData<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, void>[]>;
224
- getSession(): Promise<import("@appium/types").SingularSessionData<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, void>>;
225
- supportedLogTypes: Readonly<import("@appium/types").LogDefRecord<{
226
- readonly app: {
227
- readonly presence: true;
228
- readonly isString: true;
229
- };
230
- readonly uniqueApp: {
231
- readonly isBoolean: true;
232
- };
233
- }>>;
234
- getLogTypes(): Promise<string[]>;
235
- getLog(logType: string): Promise<unknown[]>;
236
- findElement(strategy: string, selector: string): Promise<import("@appium/types").Element>;
237
- findElements(strategy: string, selector: string): Promise<import("@appium/types").Element[]>;
238
- findElementFromElement(strategy: string, selector: string, elementId: string): Promise<import("@appium/types").Element>;
239
- findElementsFromElement(strategy: string, selector: string, elementId: string): Promise<import("@appium/types").Element[]>;
240
- findElementFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<import("@appium/types").Element>;
241
- findElementsFromShadowRoot?(strategy: string, selector: string, shadowId: string): Promise<import("@appium/types").Element[]>;
242
- findElOrEls<Mult extends boolean>(strategy: string, selector: string, mult: Mult, context?: any): Promise<Mult extends true ? import("@appium/types").Element[] : import("@appium/types").Element>;
243
- findElOrElsWithProcessing<Mult_1 extends boolean>(strategy: string, selector: string, mult: Mult_1, context?: any): Promise<Mult_1 extends true ? import("@appium/types").Element[] : import("@appium/types").Element>;
244
- getPageSource(): Promise<string>;
245
- updateSettings: (settings: import("@appium/types").StringRecord) => Promise<void>;
246
- getSettings(): Promise<import("@appium/types").StringRecord>;
247
- timeouts(type: string, ms: string | number, script?: number | undefined, pageLoad?: number | undefined, implicit?: string | number | undefined): Promise<void>;
248
- setNewCommandTimeout(ms: number): void;
249
- implicitWait(ms: string | number): Promise<void>;
250
- setImplicitWait(ms: number): void;
251
- implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
252
- getTimeouts(): Promise<Record<string, number>>;
253
- implicitWaitW3C(ms: number): Promise<void>;
254
- implicitWaitMJSONWP(ms: number): Promise<void>;
255
- pageLoadTimeoutW3C(ms: number): Promise<void>;
256
- pageLoadTimeoutMJSONWP(ms: number): Promise<void>;
257
- scriptTimeoutW3C(ms: number): Promise<void>;
258
- scriptTimeoutMJSONWP(ms: number): Promise<void>;
259
- newCommandTimeout(ms: number): Promise<void>;
260
- parseTimeoutArgument(ms: string | number): number;
261
- logCustomEvent(vendor: string, event: string): Promise<void>;
262
- getLogEvents(type?: string | string[] | undefined): Promise<import("@appium/types").EventHistory | Record<string, number>>;
263
- executeMethod(script: string, args: [] | [import("@appium/types").StringRecord]): Promise<any>;
264
- createSession(w3cCaps1: import("@appium/types").W3CCapabilities<{
265
- readonly app: {
266
- readonly presence: true;
267
- readonly isString: true;
268
- };
269
- readonly uniqueApp: {
270
- readonly isBoolean: true;
271
- };
272
- }, void>, w3cCaps2?: import("@appium/types").W3CCapabilities<{
273
- readonly app: {
274
- readonly presence: true;
275
- readonly isString: true;
276
- };
277
- readonly uniqueApp: {
278
- readonly isBoolean: true;
279
- };
280
- }, void> | undefined, w3cCaps3?: import("@appium/types").W3CCapabilities<{
281
- readonly app: {
282
- readonly presence: true;
283
- readonly isString: true;
284
- };
285
- readonly uniqueApp: {
286
- readonly isBoolean: true;
287
- };
288
- }, void> | undefined, driverData?: import("@appium/types").DriverData[] | undefined): Promise<[string, any]>;
289
- deleteSession(sessionId?: string | undefined, driverData?: import("@appium/types").DriverData[] | undefined): Promise<void>;
290
- shouldValidateCaps: boolean;
291
- sessionId: string | null;
292
- opts: import("@appium/types").DriverOpts<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS>;
293
- initialOpts: import("@appium/types").ServerArgs;
294
- protocol?: string | undefined;
295
- helpers: import("@appium/types").DriverHelpers<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS>;
296
- basePath: string;
297
- relaxedSecurityEnabled: boolean;
298
- allowInsecure: string[];
299
- denyInsecure: string[];
300
- newCommandTimeoutMs: number;
301
- implicitWaitMs: number;
302
- locatorStrategies: string[];
303
- webLocatorStrategies: string[];
304
- eventEmitter: import("events");
305
- settings: import("@appium/types").DeviceSettings<any>;
306
- log: import("@appium/types").AppiumLogger;
307
- driverData?: import("@appium/types").DriverData | undefined;
308
- isCommandsQueueEnabled: boolean;
309
- eventHistory: import("@appium/types").EventHistory;
310
- onUnexpectedShutdown(handler: () => any): void;
311
- getStatus(): Promise<any>;
312
- sessionExists(sessionId: string): boolean;
313
- isW3CProtocol(): boolean;
314
- isMjsonwpProtocol(): boolean;
315
- isFeatureEnabled(name: string): boolean;
316
- assertFeatureEnabled(name: string): void;
317
- validateLocatorStrategy(strategy: string, webContext?: boolean | undefined): void;
318
- proxyActive(sessionId?: string | undefined): boolean;
319
- getProxyAvoidList(sessionId?: string | undefined): import("@appium/types").RouteMatcher[];
320
- canProxy(sessionId?: string | undefined): boolean;
321
- proxyRouteIsAvoided(sessionId: string, method: string, url: string): boolean;
322
- addManagedDriver(driver: import("@appium/types").Driver<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, import("@appium/types").StringRecord, any>): void;
323
- getManagedDrivers(): import("@appium/types").Driver<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS, import("@appium/types").StringRecord, any>[];
324
- clearNewCommandTimeout(): Promise<void>;
325
- logEvent(eventName: string): void;
326
- driverForSession(sessionId: string): import("@appium/types").Core<typeof import("@appium/types").BASE_DESIRED_CAP_CONSTRAINTS> | null;
1
+ declare namespace _default {
2
+ /**
3
+ * @this {FakeDriver}
4
+ */
5
+ function getRawContexts(this: import("../driver").FakeDriver): {
6
+ NATIVE_APP: null;
7
+ PROXY: null;
327
8
  };
328
- } & T;
329
- export type FakeDriverCore = import('../driver').FakeDriverCore;
330
- export type IContextsCommands = import('../types').IContextsCommands;
331
- export type Class<T, U = {}, V = any[]> = import('@appium/types').Class<T, U, V>;
9
+ /**
10
+ * @this {FakeDriver}
11
+ */
12
+ function getRawContexts(this: import("../driver").FakeDriver): {
13
+ NATIVE_APP: null;
14
+ PROXY: null;
15
+ };
16
+ /**
17
+ * @this {FakeDriver}
18
+ */
19
+ function assertWebviewContext(this: import("../driver").FakeDriver): void;
20
+ /**
21
+ * @this {FakeDriver}
22
+ */
23
+ function assertWebviewContext(this: import("../driver").FakeDriver): void;
24
+ /**
25
+ * @returns {Promise<string>}
26
+ * @this {FakeDriver}
27
+ */
28
+ function getCurrentContext(this: import("../driver").FakeDriver): Promise<string>;
29
+ /**
30
+ * @returns {Promise<string>}
31
+ * @this {FakeDriver}
32
+ */
33
+ function getCurrentContext(this: import("../driver").FakeDriver): Promise<string>;
34
+ /**
35
+ * Get the list of available contexts
36
+ *
37
+ * @returns {Promise<string[]>}
38
+ * @this {FakeDriver}
39
+ */
40
+ function getContexts(this: import("../driver").FakeDriver): Promise<string[]>;
41
+ /**
42
+ * Get the list of available contexts
43
+ *
44
+ * @returns {Promise<string[]>}
45
+ * @this {FakeDriver}
46
+ */
47
+ function getContexts(this: import("../driver").FakeDriver): Promise<string[]>;
48
+ /**
49
+ * Set the current context
50
+ *
51
+ * @param {string} context - name of the context
52
+ * @returns {Promise<void>}
53
+ * @this {FakeDriver}
54
+ */
55
+ function setContext(this: import("../driver").FakeDriver, context: string): Promise<void>;
56
+ /**
57
+ * Set the current context
58
+ *
59
+ * @param {string} context - name of the context
60
+ * @returns {Promise<void>}
61
+ * @this {FakeDriver}
62
+ */
63
+ function setContext(this: import("../driver").FakeDriver, context: string): Promise<void>;
64
+ /**
65
+ * Set the active frame
66
+ *
67
+ * @param {number} frameId
68
+ * @returns {Promise<void>}
69
+ * @this {FakeDriver}
70
+ */
71
+ function setFrame(this: import("../driver").FakeDriver, frameId: number): Promise<void>;
72
+ /**
73
+ * Set the active frame
74
+ *
75
+ * @param {number} frameId
76
+ * @returns {Promise<void>}
77
+ * @this {FakeDriver}
78
+ */
79
+ function setFrame(this: import("../driver").FakeDriver, frameId: number): Promise<void>;
80
+ }
81
+ export default _default;
82
+ export type FakeDriver = import('../driver').FakeDriver;
332
83
  //# sourceMappingURL=contexts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../lib/commands/contexts.js"],"names":[],"mappings":";AAGA;;;;GAIG;AACH;;;;;;;;QA4BI;;;;WAIG;uBADU,QAAQ,MAAM,EAAE,CAAC;QAM9B;;;;;WAKG;4BAFQ,MAAM,GACJ,QAAQ,IAAI,CAAC;;;QAoB1B;;;;;WAKG;0BAFQ,MAAM,GACJ,QAAQ,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAiB7B;6BAGY,OAAO,WAAW,EAAE,cAAc;gCAClC,OAAO,UAAU,EAAE,iBAAiB;0CAKpC,OAAO,eAAe,EAAE,KAAK,CAAC,CAAC,EAAC,CAAC,EAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"contexts.d.ts","sourceRoot":"","sources":["../../../lib/commands/contexts.js"],"names":[],"mappings":";IAIE;;OAEG;IACH;;;MAOC;IAVD;;OAEG;IACH;;;MAOC;IAED;;OAEG;IACH,0EAIC;IAPD;;OAEG;IACH,0EAIC;IAED;;;OAGG;IACH,kFAEC;IAND;;;OAGG;IACH,kFAEC;IAED;;;;;OAKG;IACH,8EAEC;IARD;;;;;OAKG;IACH,8EAEC;IAED;;;;;;OAMG;IACH,0FAgBC;IAvBD;;;;;;OAMG;IACH,0FAgBC;IAED;;;;;;OAMG;IACH,wFAWC;IAlBD;;;;;;OAMG;IACH,wFAWC;;;yBAIU,OAAO,WAAW,EAAE,UAAU"}
@@ -3,102 +3,93 @@ 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.ContextsMixin = void 0;
7
6
  const lodash_1 = __importDefault(require("lodash"));
8
7
  const driver_1 = require("appium/driver");
9
- /**
10
- *
11
- * @template {Class<import('../types').IFakeDriver>} T
12
- * @param {T} Base
13
- */
14
- function ContextsMixin(Base) {
8
+ exports.default = {
15
9
  /**
16
- * @implements {IContextsCommands}
10
+ * @this {FakeDriver}
17
11
  */
18
- class ContextsCommands extends Base {
19
- getRawContexts() {
20
- let contexts = { NATIVE_APP: null, PROXY: null };
21
- let wvs = this.appModel?.getWebviews() ?? [];
22
- for (let i = 1; i < wvs.length + 1; i++) {
23
- contexts[`WEBVIEW_${i}`] = wvs[i - 1];
24
- }
25
- return contexts;
26
- }
27
- assertWebviewContext() {
28
- if (this.curContext === 'NATIVE_APP') {
29
- throw new driver_1.errors.InvalidContextError();
30
- }
31
- }
32
- // do not add a description to this method's docstring
33
- /*
34
- * @returns {Promise<string>}
35
- */
36
- async getCurrentContext() {
37
- return this.curContext;
12
+ getRawContexts() {
13
+ let contexts = { NATIVE_APP: null, PROXY: null };
14
+ let wvs = this.appModel?.getWebviews() ?? [];
15
+ for (let i = 1; i < wvs.length + 1; i++) {
16
+ contexts[`WEBVIEW_${i}`] = wvs[i - 1];
38
17
  }
39
- /**
40
- * Get the list of available contexts
41
- *
42
- * @returns {Promise<string[]>}
43
- */
44
- async getContexts() {
45
- return lodash_1.default.keys(this.getRawContexts());
18
+ return contexts;
19
+ },
20
+ /**
21
+ * @this {FakeDriver}
22
+ */
23
+ assertWebviewContext() {
24
+ if (this.curContext === 'NATIVE_APP') {
25
+ throw new driver_1.errors.InvalidContextError();
46
26
  }
47
- /**
48
- * Set the current context
49
- *
50
- * @param {string} context - name of the context
51
- * @returns {Promise<void>}
52
- */
53
- async setContext(context) {
54
- let contexts = this.getRawContexts();
55
- if (context in contexts) {
56
- this.curContext = context;
57
- if (context === 'NATIVE_APP') {
58
- this.appModel.deactivateWebview();
59
- this._proxyActive = false;
60
- }
61
- else if (context === 'PROXY') {
62
- this._proxyActive = true;
63
- }
64
- else {
65
- this.appModel.activateWebview(contexts[context]);
66
- this._proxyActive = false;
67
- }
27
+ },
28
+ /**
29
+ * @returns {Promise<string>}
30
+ * @this {FakeDriver}
31
+ */
32
+ async getCurrentContext() {
33
+ return this.curContext;
34
+ },
35
+ /**
36
+ * Get the list of available contexts
37
+ *
38
+ * @returns {Promise<string[]>}
39
+ * @this {FakeDriver}
40
+ */
41
+ async getContexts() {
42
+ return lodash_1.default.keys(this.getRawContexts());
43
+ },
44
+ /**
45
+ * Set the current context
46
+ *
47
+ * @param {string} context - name of the context
48
+ * @returns {Promise<void>}
49
+ * @this {FakeDriver}
50
+ */
51
+ async setContext(context) {
52
+ let contexts = this.getRawContexts();
53
+ if (context in contexts) {
54
+ this.curContext = context;
55
+ if (context === 'NATIVE_APP') {
56
+ this.appModel.deactivateWebview();
57
+ this._proxyActive = false;
58
+ }
59
+ else if (context === 'PROXY') {
60
+ this._proxyActive = true;
68
61
  }
69
62
  else {
70
- throw new driver_1.errors.NoSuchContextError();
63
+ this.appModel.activateWebview(contexts[context]);
64
+ this._proxyActive = false;
71
65
  }
72
66
  }
73
- /**
74
- * Set the active frame
75
- *
76
- * @param {number} frameId
77
- * @returns {Promise<void>}
78
- */
79
- async setFrame(frameId) {
80
- this.assertWebviewContext();
81
- if (frameId === null) {
82
- this.appModel.deactivateFrame();
83
- }
84
- else {
85
- let nodes = this.appModel.xpathQuery(`//iframe[@id="${frameId}"]`);
86
- if (!nodes.length) {
87
- throw new driver_1.errors.NoSuchFrameError();
88
- }
89
- this.appModel.activateFrame(nodes[0]);
67
+ else {
68
+ throw new driver_1.errors.NoSuchContextError();
69
+ }
70
+ },
71
+ /**
72
+ * Set the active frame
73
+ *
74
+ * @param {number} frameId
75
+ * @returns {Promise<void>}
76
+ * @this {FakeDriver}
77
+ */
78
+ async setFrame(frameId) {
79
+ this.assertWebviewContext();
80
+ if (frameId === null) {
81
+ this.appModel.deactivateFrame();
82
+ }
83
+ else {
84
+ let nodes = this.appModel.xpathQuery(`//iframe[@id="${frameId}"]`);
85
+ if (!nodes.length) {
86
+ throw new driver_1.errors.NoSuchFrameError();
90
87
  }
88
+ this.appModel.activateFrame(nodes[0]);
91
89
  }
92
- }
93
- return ContextsCommands;
94
- }
95
- exports.ContextsMixin = ContextsMixin;
96
- /**
97
- * @typedef {import('../driver').FakeDriverCore} FakeDriverCore
98
- * @typedef {import('../types').IContextsCommands} IContextsCommands
99
- */
90
+ },
91
+ };
100
92
  /**
101
- * @template T,[U={}],[V=Array<any>]
102
- * @typedef {import('@appium/types').Class<T,U,V>} Class
93
+ * @typedef {import('../driver').FakeDriver} FakeDriver
103
94
  */
104
95
  //# sourceMappingURL=contexts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contexts.js","sourceRoot":"","sources":["../../../lib/commands/contexts.js"],"names":[],"mappings":";;;;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