@appium/types 0.10.0 → 0.10.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.
Files changed (55) hide show
  1. package/LICENSE +1 -1
  2. package/build/lib/action.d.ts +4 -1
  3. package/build/lib/action.d.ts.map +1 -1
  4. package/build/lib/action.js +1 -1
  5. package/build/lib/action.js.map +1 -1
  6. package/build/lib/capabilities.d.ts +34 -23
  7. package/build/lib/capabilities.d.ts.map +1 -1
  8. package/build/lib/command.d.ts +116 -0
  9. package/build/lib/command.d.ts.map +1 -0
  10. package/build/lib/command.js +3 -0
  11. package/build/lib/command.js.map +1 -0
  12. package/build/lib/config.d.ts +2 -13
  13. package/build/lib/config.d.ts.map +1 -1
  14. package/build/lib/config.js.map +1 -1
  15. package/build/lib/constraints.d.ts +54 -67
  16. package/build/lib/constraints.d.ts.map +1 -1
  17. package/build/lib/constraints.js +2 -5
  18. package/build/lib/constraints.js.map +1 -1
  19. package/build/lib/driver.d.ts +223 -292
  20. package/build/lib/driver.d.ts.map +1 -1
  21. package/build/lib/http.d.ts +11 -0
  22. package/build/lib/http.d.ts.map +1 -0
  23. package/build/lib/http.js +3 -0
  24. package/build/lib/http.js.map +1 -0
  25. package/build/lib/index.d.ts +6 -157
  26. package/build/lib/index.d.ts.map +1 -1
  27. package/build/lib/index.js +6 -3
  28. package/build/lib/index.js.map +1 -1
  29. package/build/lib/logger.d.ts +39 -0
  30. package/build/lib/logger.d.ts.map +1 -0
  31. package/build/lib/logger.js +3 -0
  32. package/build/lib/logger.js.map +1 -0
  33. package/build/lib/plugin.d.ts +30 -5
  34. package/build/lib/plugin.d.ts.map +1 -1
  35. package/build/lib/server.d.ts +60 -0
  36. package/build/lib/server.d.ts.map +1 -0
  37. package/build/lib/server.js +3 -0
  38. package/build/lib/server.js.map +1 -0
  39. package/build/lib/util.d.ts +51 -0
  40. package/build/lib/util.d.ts.map +1 -0
  41. package/build/lib/util.js +3 -0
  42. package/build/lib/util.js.map +1 -0
  43. package/lib/action.ts +4 -1
  44. package/lib/capabilities.ts +40 -53
  45. package/lib/command.ts +139 -0
  46. package/lib/config.ts +2 -36
  47. package/lib/{constraints.js → constraints.ts} +5 -5
  48. package/lib/driver.ts +260 -370
  49. package/lib/http.ts +31 -0
  50. package/lib/index.ts +6 -214
  51. package/lib/logger.ts +41 -0
  52. package/lib/plugin.ts +38 -6
  53. package/lib/server.ts +73 -0
  54. package/lib/util.ts +74 -0
  55. package/package.json +6 -5
@@ -1,9 +1,21 @@
1
1
  /// <reference types="node" />
2
2
  import type { EventEmitter } from 'events';
3
- import { Element, ActionSequence } from './action';
4
- import { HTTPMethod, AppiumServer, UpdateServerCallback, Class, MethodMap, AppiumLogger, StringRecord, ConstraintsToCaps, BaseDriverCapConstraints, W3CCapabilities, Capabilities, ExecuteMethodMap } from '.';
3
+ import { Entries } from 'type-fest';
4
+ import { ActionSequence, Element } from './action';
5
+ import { Capabilities, DriverCaps, W3CCapabilities, W3CDriverCaps } from './capabilities';
6
+ import { ExecuteMethodMap, MethodMap } from './command';
5
7
  import { ServerArgs } from './config';
6
- import { AsyncReturnType, Entries } from 'type-fest';
8
+ import { HTTPHeaders, HTTPMethod } from './http';
9
+ import { AppiumLogger } from './logger';
10
+ import { AppiumServer, UpdateServerCallback } from './server';
11
+ import { Class, StringRecord } from './util';
12
+ /**
13
+ * Interface implemented by the `DeviceSettings` class in `@appium/base-driver`
14
+ */
15
+ export interface IDeviceSettings<T extends StringRecord> {
16
+ update(newSettings: T): Promise<void>;
17
+ getSettings(): T;
18
+ }
7
19
  export interface ITimeoutCommands {
8
20
  /**
9
21
  * Set the various timeouts associated with a session
@@ -28,6 +40,7 @@ export interface ITimeoutCommands {
28
40
  * @param ms - the timeout in ms
29
41
  *
30
42
  * @deprecated Use `timeouts` instead
43
+ *
31
44
  */
32
45
  implicitWait(ms: number | string): Promise<void>;
33
46
  /**
@@ -43,7 +56,7 @@ export interface ITimeoutCommands {
43
56
  *
44
57
  * @returns The return value of the condition
45
58
  */
46
- implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
59
+ implicitWaitForCondition(condition: (...args: any[]) => Promise<any>): Promise<unknown>;
47
60
  /**
48
61
  * Get the current timeouts
49
62
  * @see {@link https://w3c.github.io/webdriver/#get-timeouts}
@@ -134,7 +147,7 @@ export interface ISessionCommands {
134
147
  *
135
148
  * @returns A session data object
136
149
  */
137
- getSession(): Promise<SingularSessionData>;
150
+ getSession<C extends Constraints>(): Promise<SingularSessionData<C>>;
138
151
  }
139
152
  export interface IExecuteCommands {
140
153
  /**
@@ -146,17 +159,17 @@ export interface IExecuteCommands {
146
159
  *
147
160
  * @returns The result of calling the Execute Method
148
161
  */
149
- executeMethod<TReturn = any>(script: string, args: [StringRecord] | any[]): Promise<TReturn>;
162
+ executeMethod<TArgs extends readonly any[] | readonly [StringRecord<unknown>] = unknown[], TReturn = unknown>(script: string, args: TArgs): Promise<TReturn>;
150
163
  }
151
- export interface MultiSessionData<C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> {
164
+ export interface MultiSessionData<C extends Constraints = Constraints> {
152
165
  id: string;
153
- capabilities: Capabilities<C, Extra>;
166
+ capabilities: DriverCaps<C>;
154
167
  }
155
- export type SingularSessionData<C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> = Capabilities<C, Extra> & {
168
+ export type SingularSessionData<C extends Constraints = Constraints> = DriverCaps<C> & {
156
169
  events?: EventHistory;
157
170
  error?: string;
158
171
  };
159
- export interface IFindCommands<Ctx = any> {
172
+ export interface IFindCommands {
160
173
  /**
161
174
  * Find a UI element given a locator strategy and a selector, erroring if it can't be found
162
175
  * @see {@link https://w3c.github.io/webdriver/#find-element}
@@ -233,7 +246,7 @@ export interface IFindCommands<Ctx = any> {
233
246
  *
234
247
  * @returns A single element or list of elements
235
248
  */
236
- findElOrEls<Mult extends boolean>(strategy: string, selector: string, mult: Mult, context?: Ctx): Promise<Mult extends true ? Element[] : Element>;
249
+ findElOrEls<Mult extends boolean, Ctx = any>(strategy: string, selector: string, mult: Mult, context?: Ctx): Promise<Mult extends true ? Element[] : Element>;
237
250
  /**
238
251
  * This is a wrapper for {@linkcode IFindCommands.findElOrEls} that validates locator strategies
239
252
  * and implements the `appium:printPageSourceOnFindFailure` capability
@@ -245,7 +258,7 @@ export interface IFindCommands<Ctx = any> {
245
258
  *
246
259
  * @returns A single element or list of elements
247
260
  */
248
- findElOrElsWithProcessing<Mult extends boolean>(strategy: string, selector: string, mult: Mult, context?: Ctx): Promise<Mult extends true ? Element[] : Element>;
261
+ findElOrElsWithProcessing<Mult extends boolean, Ctx = any>(strategy: string, selector: string, mult: Mult, context?: Ctx): Promise<Mult extends true ? Element[] : Element>;
249
262
  /**
250
263
  * Get the current page/app source as HTML/XML
251
264
  * @see {@link https://w3c.github.io/webdriver/#get-page-source}
@@ -254,31 +267,31 @@ export interface IFindCommands<Ctx = any> {
254
267
  */
255
268
  getPageSource(): Promise<string>;
256
269
  }
257
- export interface ILogCommands<C extends Constraints> {
270
+ export interface ILogCommands {
258
271
  /**
259
272
  * Definition of the available log types
260
273
  */
261
- supportedLogTypes: Readonly<LogDefRecord<C>>;
274
+ supportedLogTypes: Readonly<LogDefRecord>;
262
275
  /**
263
276
  * Get available log types as a list of strings
264
277
  */
265
- getLogTypes(): Promise<(keyof ILogCommands<C>['supportedLogTypes'])[]>;
278
+ getLogTypes(): Promise<string[]>;
266
279
  /**
267
280
  * Get the log for a given log type.
268
281
  *
269
282
  * @param logType - Name/key of log type as defined in {@linkcode ILogCommands.supportedLogTypes}.
270
283
  */
271
- getLog(logType: keyof ILogCommands<C>['supportedLogTypes']): Promise<AsyncReturnType<ILogCommands<C>['supportedLogTypes'][keyof ILogCommands<C>['supportedLogTypes']]['getter']>>;
284
+ getLog(logType: string): Promise<unknown[]>;
272
285
  }
273
286
  /**
274
287
  * A record of {@linkcode LogDef} objects, keyed by the log type name.
275
288
  * Used in {@linkcode ILogCommands.supportedLogTypes}
276
289
  */
277
- export type LogDefRecord<C extends Constraints> = Record<string, LogDef<C>>;
290
+ export type LogDefRecord = Record<string, LogDef>;
278
291
  /**
279
292
  * A definition of a log type
280
293
  */
281
- export interface LogDef<C extends Constraints, T = unknown> {
294
+ export interface LogDef {
282
295
  /**
283
296
  * Description of the log type.
284
297
  *
@@ -291,9 +304,9 @@ export interface LogDef<C extends Constraints, T = unknown> {
291
304
  *
292
305
  * This implementation *should* drain, truncate or otherwise reset the log buffer.
293
306
  */
294
- getter: (driver: Driver<C>) => Promise<T[]>;
307
+ getter: (driver: any) => Promise<unknown[]> | unknown[];
295
308
  }
296
- export interface ISettingsCommands {
309
+ export interface ISettingsCommands<T extends StringRecord = StringRecord> {
297
310
  /**
298
311
  * Update the session's settings dictionary with a new settings object
299
312
  *
@@ -306,9 +319,23 @@ export interface ISettingsCommands {
306
319
  *
307
320
  * @returns The settings object
308
321
  */
309
- getSettings(): Promise<StringRecord>;
322
+ getSettings(): Promise<T>;
310
323
  }
311
- export interface SessionHandler<CreateResult, DeleteResult, C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> {
324
+ /**
325
+ * @see {@linkcode ISessionHandler}
326
+ */
327
+ export type DefaultCreateSessionResult<C extends Constraints> = [
328
+ sessionId: string,
329
+ capabilities: DriverCaps<C>
330
+ ];
331
+ /**
332
+ * @see {@linkcode ISessionHandler}
333
+ */
334
+ export type DefaultDeleteSessionResult = void;
335
+ /**
336
+ * An interface which creates and deletes sessions.
337
+ */
338
+ export interface ISessionHandler<C extends Constraints = Constraints, CreateResult = DefaultCreateSessionResult<C>, DeleteResult = DefaultDeleteSessionResult> {
312
339
  /**
313
340
  * Start a new automation session
314
341
  * @see {@link https://w3c.github.io/webdriver/#new-session}
@@ -326,7 +353,7 @@ export interface SessionHandler<CreateResult, DeleteResult, C extends Constraint
326
353
  *
327
354
  * @returns The capabilities object representing the created session
328
355
  */
329
- createSession(w3cCaps1: W3CCapabilities<C, Extra>, w3cCaps2?: W3CCapabilities<C, Extra>, w3cCaps3?: W3CCapabilities<C, Extra>, driverData?: DriverData[]): Promise<CreateResult>;
356
+ createSession(w3cCaps1: W3CDriverCaps<C>, w3cCaps2?: W3CDriverCaps<C>, w3cCaps3?: W3CDriverCaps<C>, driverData?: DriverData[]): Promise<CreateResult>;
330
357
  /**
331
358
  * Stop an automation session
332
359
  * @see {@link https://w3c.github.io/webdriver/#delete-session}
@@ -340,19 +367,6 @@ export interface SessionHandler<CreateResult, DeleteResult, C extends Constraint
340
367
  * Custom session data for a driver.
341
368
  */
342
369
  export type DriverData = Record<string, unknown>;
343
- /**
344
- * Extensions can define new methods for the Appium server to map to command names, of the same
345
- * format as used in Appium's `routes.js`.
346
- *
347
- *
348
- * @example
349
- * {
350
- * '/session/:sessionId/new_method': {
351
- * GET: {command: 'getNewThing'},
352
- * POST: {command: 'setNewThing', payloadParams: {required: ['someParam']}}
353
- * }
354
- * }
355
- */
356
370
  export interface Constraint {
357
371
  readonly presence?: boolean | Readonly<{
358
372
  allowEmpty: boolean;
@@ -363,22 +377,23 @@ export interface Constraint {
363
377
  readonly isObject?: boolean;
364
378
  readonly isArray?: boolean;
365
379
  readonly deprecated?: boolean;
366
- readonly inclusion?: Readonly<[any, ...any[]]>;
367
- readonly inclusionCaseInsensitive?: Readonly<[any, ...any[]]>;
380
+ readonly inclusion?: Readonly<[string, ...string[]]>;
381
+ readonly inclusionCaseInsensitive?: Readonly<[string, ...string[]]>;
382
+ }
383
+ /**
384
+ * A collection of constraints describing the allowed capabilities for a driver.
385
+ */
386
+ export interface Constraints {
387
+ [name: string]: Constraint;
368
388
  }
369
- export type Constraints = Readonly<Record<string, Constraint>>;
370
- export interface DriverHelpers<C extends Constraints> {
371
- configureApp: (app: string, supportedAppExtensions: string[]) => Promise<string>;
389
+ export interface DriverHelpers {
390
+ configureApp: (app: string, supportedAppExtensions?: string | string[] | ConfigureAppOptions) => Promise<string>;
372
391
  isPackageOrBundle: (app: string) => boolean;
373
392
  duplicateKeys: <T>(input: T, firstKey: string, secondKey: string) => T;
374
393
  parseCapsArray: (cap: string | string[]) => string[];
375
- generateDriverLogPrefix: (obj: Core<C>, sessionId?: string) => string;
394
+ generateDriverLogPrefix: <C extends Constraints>(obj: Core<C>, sessionId?: string) => string;
376
395
  }
377
396
  export type SettingsUpdateListener<T extends Record<string, unknown> = Record<string, unknown>> = (prop: keyof T, newValue: unknown, curValue: unknown) => Promise<void>;
378
- export interface DeviceSettings<T = any> {
379
- update(newSettings: Record<string, T>): Promise<void>;
380
- getSettings(): Record<string, T>;
381
- }
382
397
  export interface Rect {
383
398
  x: number;
384
399
  y: number;
@@ -460,13 +475,13 @@ export interface EventHistoryCommand {
460
475
  *
461
476
  * This should not be used directly by external code.
462
477
  */
463
- export interface Core<C extends Constraints = BaseDriverCapConstraints> {
478
+ export interface Core<C extends Constraints, Settings extends StringRecord = StringRecord> {
464
479
  shouldValidateCaps: boolean;
465
480
  sessionId: string | null;
466
481
  opts: DriverOpts<C>;
467
- initialOpts: ServerArgs;
482
+ initialOpts: Partial<DriverOpts<C>>;
468
483
  protocol?: string;
469
- helpers: DriverHelpers<C>;
484
+ helpers: DriverHelpers;
470
485
  basePath: string;
471
486
  relaxedSecurityEnabled: boolean;
472
487
  allowInsecure: string[];
@@ -476,9 +491,9 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
476
491
  locatorStrategies: string[];
477
492
  webLocatorStrategies: string[];
478
493
  eventEmitter: EventEmitter;
479
- settings: DeviceSettings;
494
+ settings: IDeviceSettings<Settings>;
480
495
  log: AppiumLogger;
481
- driverData?: DriverData;
496
+ driverData: DriverData;
482
497
  isCommandsQueueEnabled: boolean;
483
498
  eventHistory: EventHistory;
484
499
  onUnexpectedShutdown(handler: () => any): void;
@@ -514,7 +529,7 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
514
529
  * ```
515
530
  */
516
531
  getStatus(): Promise<any>;
517
- sessionExists(sessionId: string): boolean;
532
+ sessionExists(sessionId?: string): boolean;
518
533
  isW3CProtocol(): boolean;
519
534
  isMjsonwpProtocol(): boolean;
520
535
  isFeatureEnabled(name: string): boolean;
@@ -525,7 +540,7 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
525
540
  canProxy(sessionId?: string): boolean;
526
541
  proxyRouteIsAvoided(sessionId: string, method: string, url: string): boolean;
527
542
  addManagedDriver(driver: Driver): void;
528
- getManagedDrivers(): Driver[];
543
+ getManagedDrivers(): Driver<Constraints>[];
529
544
  clearNewCommandTimeout(): Promise<void>;
530
545
  logEvent(eventName: string): void;
531
546
  driverForSession(sessionId: string): Core<C> | null;
@@ -536,13 +551,17 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
536
551
  *
537
552
  * `C` should be the constraints of the driver.
538
553
  * `CArgs` would be the shape of `cliArgs`.
539
- * `Ctx` would be the type of the element context (e.g., string, dictionary of some sort, etc.)
554
+ * `Settings` is the shape of the raw device settings object (see {@linkcode IDeviceSettings})
540
555
  */
541
- export interface Driver<C extends Constraints = BaseDriverCapConstraints, CArgs extends StringRecord = StringRecord, Ctx = any> extends ISessionCommands, ILogCommands<C>, IFindCommands<Ctx>, ISettingsCommands, ITimeoutCommands, IEventCommands, IExecuteCommands, SessionHandler<[sessionId: string, caps: any], void, C>, Core {
556
+ export interface Driver<C extends Constraints = Constraints, CArgs extends StringRecord = StringRecord, Settings extends StringRecord = StringRecord, CreateResult = DefaultCreateSessionResult<C>, DeleteResult = DefaultDeleteSessionResult> extends ISessionCommands, ILogCommands, IFindCommands, ISettingsCommands<Settings>, ITimeoutCommands, IEventCommands, IExecuteCommands, ISessionHandler<C, CreateResult, DeleteResult>, Core<C, Settings> {
542
557
  /**
543
558
  * The set of command line arguments set for this driver
544
559
  */
545
560
  cliArgs: CArgs;
561
+ server?: AppiumServer;
562
+ serverHost?: string;
563
+ serverPort?: number;
564
+ serverPath?: string;
546
565
  /**
547
566
  * Execute a driver (WebDriver-protocol) command by its name as defined in the routes file
548
567
  *
@@ -568,6 +587,7 @@ export interface Driver<C extends Constraints = BaseDriverCapConstraints, CArgs
568
587
  * Reset the current session (run the delete session and create session subroutines)
569
588
  *
570
589
  * @deprecated Use explicit session management commands instead
590
+ * @privateRemarks This is implemented by `BaseDriver` and is used within `@appium/driver-test-support`
571
591
  */
572
592
  reset(): Promise<void>;
573
593
  /**
@@ -597,11 +617,7 @@ export interface Driver<C extends Constraints = BaseDriverCapConstraints, CArgs
597
617
  * External drivers must subclass `BaseDriver`, and can implement any of these methods.
598
618
  * None of these are implemented within Appium itself.
599
619
  */
600
- export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints> extends Driver<C> {
601
- server?: AppiumServer;
602
- serverHost?: string;
603
- serverPort?: number;
604
- serverPath?: string;
620
+ export interface ExternalDriver<C extends Constraints = Constraints> extends Driver<C> {
605
621
  /**
606
622
  * Navigate to a given url
607
623
  * @see {@link https://w3c.github.io/webdriver/#navigate-to}
@@ -989,12 +1005,6 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
989
1005
  * @returns A base64-encoded string representing the PNG image data for the element rect
990
1006
  */
991
1007
  getElementScreenshot?(elementId: string): Promise<string>;
992
- /**
993
- * Shake the device
994
- *
995
- * @deprecated
996
- */
997
- mobileShake?(): Promise<void>;
998
1008
  /**
999
1009
  * Get the current time on the device under timeouts
1000
1010
  *
@@ -1003,47 +1013,6 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1003
1013
  * @returns The formatted time
1004
1014
  */
1005
1015
  getDeviceTime?(format?: string): Promise<string>;
1006
- /**
1007
- * Lock the device, and optionally unlock the device after a certain amount of time
1008
- *
1009
- * @param seconds - the number of seconds after which to unlock the device. Set to zero or leave
1010
- * empty to not unlock the device automatically
1011
- *
1012
- * @deprecated
1013
- */
1014
- lock?(seconds?: number): Promise<void>;
1015
- /**
1016
- * Unlock the device
1017
- *
1018
- * @deprecated
1019
- */
1020
- unlock?(): Promise<void>;
1021
- /**
1022
- * Determine whether the device is locked
1023
- *
1024
- * @returns True if the device is locked, false otherwise
1025
- *
1026
- * @deprecated
1027
- */
1028
- isLocked?(): Promise<boolean>;
1029
- /**
1030
- * Direct Appium to start recording the device screen
1031
- *
1032
- * @param options - parameters for screen recording
1033
- *
1034
- * @deprecated
1035
- */
1036
- startRecordingScreen?(options?: StartScreenRecordOptions): Promise<void>;
1037
- /**
1038
- * Direct Appium to stop screen recording and return the video
1039
- *
1040
- * @param options - parameters for stopping like video Uploading
1041
- *
1042
- * @returns The base64-encoded video data
1043
- *
1044
- * @deprecated
1045
- */
1046
- stopRecordingScreen?(options?: StopScreenRecordOptions): Promise<string>;
1047
1016
  /**
1048
1017
  * List the performance data types supported by this driver, which can be used in a call to get
1049
1018
  * the performance data by type.
@@ -1051,6 +1020,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1051
1020
  * @returns The list of types
1052
1021
  *
1053
1022
  * @deprecated
1023
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1054
1024
  */
1055
1025
  getPerformanceDataTypes?(): Promise<string[]>;
1056
1026
  /**
@@ -1064,6 +1034,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1064
1034
  * @returns A list of performance data strings
1065
1035
  *
1066
1036
  * @deprecated
1037
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1067
1038
  */
1068
1039
  getPerformanceData?(packageName: string, dataType: string, dataReadTimeout?: number): Promise<string[]>;
1069
1040
  /**
@@ -1074,6 +1045,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1074
1045
  * @param flags - the code denoting the combination of extra flags
1075
1046
  *
1076
1047
  * @deprecated
1048
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1077
1049
  */
1078
1050
  pressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
1079
1051
  /**
@@ -1084,6 +1056,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1084
1056
  * @param flags - the code denoting the combination of extra flags
1085
1057
  *
1086
1058
  * @deprecated
1059
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1087
1060
  */
1088
1061
  longPressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
1089
1062
  /**
@@ -1092,6 +1065,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1092
1065
  * @param fingerprintId - the numeric ID of the fingerprint to use
1093
1066
  *
1094
1067
  * @deprecated
1068
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1095
1069
  */
1096
1070
  fingerprint?(fingerprintId: number): Promise<void>;
1097
1071
  /**
@@ -1101,6 +1075,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1101
1075
  * @param message - the SMS text
1102
1076
  *
1103
1077
  * @deprecated
1078
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1104
1079
  */
1105
1080
  sendSMS?(phoneNumber: string, message: string): Promise<void>;
1106
1081
  /**
@@ -1111,6 +1086,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1111
1086
  * @param action - the action to take in response (accept, reject, etc...)
1112
1087
  *
1113
1088
  * @deprecated
1089
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1114
1090
  */
1115
1091
  gsmCall?(phoneNumber: string, action: string): Promise<void>;
1116
1092
  /**
@@ -1119,6 +1095,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1119
1095
  * @param singalStrength - the strength in a driver-appropriate string
1120
1096
  *
1121
1097
  * @deprecated
1098
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1122
1099
  */
1123
1100
  gsmSignal?(signalStrength: string): Promise<void>;
1124
1101
  /**
@@ -1127,6 +1104,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1127
1104
  * @param state - the state
1128
1105
  *
1129
1106
  * @deprecated
1107
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1130
1108
  */
1131
1109
  gsmVoice?(state: string): Promise<void>;
1132
1110
  /**
@@ -1135,6 +1113,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1135
1113
  * @param percent - how full the battery should become
1136
1114
  *
1137
1115
  * @deprecated
1116
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1138
1117
  */
1139
1118
  powerCapacity?(percent: number): Promise<void>;
1140
1119
  /**
@@ -1143,6 +1122,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1143
1122
  * @param state - whether the device is connected to power or not
1144
1123
  *
1145
1124
  * @deprecated
1125
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1146
1126
  */
1147
1127
  powerAC?(state: string): Promise<void>;
1148
1128
  /**
@@ -1151,6 +1131,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1151
1131
  * @param netspeed - the speed as a string, like '3G'
1152
1132
  *
1153
1133
  * @deprecated
1134
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1154
1135
  */
1155
1136
  networkSpeed?(netspeed: string): Promise<void>;
1156
1137
  /**
@@ -1160,6 +1141,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1160
1141
  * @param metastate - the combination of meta startUnexpectedShutdown
1161
1142
  *
1162
1143
  * @deprecated
1144
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1163
1145
  */
1164
1146
  keyevent?(keycode: string, metastate?: string): Promise<void>;
1165
1147
  /**
@@ -1173,6 +1155,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1173
1155
  * @param elementId - if we're rotating around an element
1174
1156
  *
1175
1157
  * @deprecated Use setRotation instead
1158
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1176
1159
  */
1177
1160
  mobileRotation?(x: number, y: number, radius: number, rotation: number, touchCount: number, duration: string, elementId?: string): Promise<void>;
1178
1161
  /**
@@ -1181,6 +1164,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1181
1164
  * @returns The activity name
1182
1165
  *
1183
1166
  * @deprecated
1167
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1184
1168
  */
1185
1169
  getCurrentActivity?(): Promise<string>;
1186
1170
  /**
@@ -1189,6 +1173,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1189
1173
  * @returns The package name
1190
1174
  *
1191
1175
  * @deprecated
1176
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1192
1177
  */
1193
1178
  getCurrentPackage?(): Promise<string>;
1194
1179
  /**
@@ -1230,10 +1215,11 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1230
1215
  *
1231
1216
  * @param appId - the package or bundle ID of the application
1232
1217
  *
1233
- * @returns A number representing the state. 0 means not installed, 1 means not running, 3 means
1234
- * running in the background, and 4 means running in the foreground
1218
+ * @returns A number representing the state. `0` means not installed, `1` means not running, `2`
1219
+ * means running in background but suspended, `3` means running in the background, and `4` means
1220
+ * running in the foreground
1235
1221
  */
1236
- queryAppState?(appId: string): Promise<0 | 1 | 3 | 4>;
1222
+ queryAppState?(appId: string): Promise<0 | 1 | 2 | 3 | 4>;
1237
1223
  /**
1238
1224
  * Attempt to hide a virtual keyboard
1239
1225
  *
@@ -1276,30 +1262,35 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1276
1262
  * Toggle airplane/flight mode for the device
1277
1263
  *
1278
1264
  * @deprecated
1265
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1279
1266
  */
1280
1267
  toggleFlightMode?(): Promise<void>;
1281
1268
  /**
1282
1269
  * Toggle cell network data
1283
1270
  *
1284
1271
  * @deprecated
1272
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1285
1273
  */
1286
1274
  toggleData?(): Promise<void>;
1287
1275
  /**
1288
1276
  * Toggle WiFi radio status
1289
1277
  *
1290
1278
  * @deprecated
1279
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1291
1280
  */
1292
1281
  toggleWiFi?(): Promise<void>;
1293
1282
  /**
1294
1283
  * Toggle location services for the device
1295
1284
  *
1296
1285
  * @deprecated
1286
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1297
1287
  */
1298
1288
  toggleLocationServices?(): Promise<void>;
1299
1289
  /**
1300
1290
  * Open the notifications shade/screen
1301
1291
  *
1302
1292
  * @deprecated
1293
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1303
1294
  */
1304
1295
  openNotifications?(): Promise<void>;
1305
1296
  /**
@@ -1318,6 +1309,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1318
1309
  * activity
1319
1310
  *
1320
1311
  * @deprecated
1312
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1321
1313
  */
1322
1314
  startActivity?(appPackage: string, appActivity: string, appWaitPackage?: string, appWaitActivity?: string, intentAction?: string, intentCategory?: string, intentFlags?: string, optionalIntentArguments?: string, dontStopAppOnReset?: boolean): Promise<void>;
1323
1315
  /**
@@ -1326,6 +1318,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1326
1318
  * @returns An array of information objects of driver-specific shape
1327
1319
  *
1328
1320
  * @deprecated
1321
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1329
1322
  */
1330
1323
  getSystemBars?(): Promise<unknown[]>;
1331
1324
  /**
@@ -1334,44 +1327,9 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1334
1327
  * @returns The density
1335
1328
  *
1336
1329
  * @deprecated
1330
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1337
1331
  */
1338
1332
  getDisplayDensity?(): Promise<number>;
1339
- /**
1340
- * Trigger a touch/fingerprint match or match failure
1341
- *
1342
- * @param match - whether the match should be a success or failure
1343
- *
1344
- * @deprecated
1345
- */
1346
- touchId?(match: boolean): Promise<void>;
1347
- /**
1348
- * Toggle whether the device is enrolled in the touch ID program
1349
- *
1350
- * @param enabled - whether to enable or disable the touch ID program
1351
- *
1352
- * @deprecated
1353
- */
1354
- toggleEnrollTouchId?(enabled: boolean): Promise<void>;
1355
- /**
1356
- * Start the session after it has been started.
1357
- *
1358
- * @deprecated Don't use this, it never made sense.
1359
- */
1360
- launchApp?(): Promise<void>;
1361
- /**
1362
- * Stop the session without stopping the session
1363
- *
1364
- * @deprecated Don't use this, it never made sense.
1365
- */
1366
- closeApp?(): Promise<void>;
1367
- /**
1368
- * Background (close) the app either permanently or for a certain amount of time
1369
- *
1370
- * @param seconds - the number of seconds to background the app for, or `null` for permanently
1371
- *
1372
- * @deprecated
1373
- */
1374
- background?(seconds: null | number): Promise<void>;
1375
1333
  /**
1376
1334
  * End platform-specific code coverage tracing
1377
1335
  *
@@ -1379,28 +1337,9 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1379
1337
  * @param path - the path to place the results
1380
1338
  *
1381
1339
  * @deprecated
1340
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1382
1341
  */
1383
1342
  endCoverage?(intent: string, path: string): Promise<void>;
1384
- /**
1385
- * Return the language-specific strings for an app
1386
- *
1387
- * @param language - the language to retrieve strings for
1388
- * @param stringFile - the path to the localized strings file if not in the default location
1389
- *
1390
- * @returns A record of localized keys to localized text
1391
- *
1392
- * @deprecated
1393
- */
1394
- getStrings?(language?: string, stringFile?: string): Promise<Record<string, unknown>>;
1395
- /**
1396
- * Set the value, but like, now? Don't use this.
1397
- *
1398
- * @param value - the value to set
1399
- * @param elementId - the element to set the value of
1400
- *
1401
- * @deprecated
1402
- */
1403
- setValueImmediate?(value: string, elementId: string): Promise<void>;
1404
1343
  /**
1405
1344
  * Set the value of a text field but ensure the current value is replace and not appended
1406
1345
  *
@@ -1408,83 +1347,9 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1408
1347
  * @param elementId - the element to set it in
1409
1348
  *
1410
1349
  * @deprecated
1350
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1411
1351
  */
1412
1352
  replaceValue?(value: string, elementId: string): Promise<void>;
1413
- /**
1414
- * Collect the response of an async script execution? It's unclear what this is for. Don't use
1415
- * it.
1416
- *
1417
- * @param response - idk
1418
- *
1419
- * @deprecated
1420
- */
1421
- receiveAsyncResponse?(response: unknown): Promise<void>;
1422
- /**
1423
- * Set the contents of the device clipboard
1424
- *
1425
- * @param content - the text to set
1426
- * @param contentType - the media type if not text
1427
- * @param label - the label if not text
1428
- *
1429
- * @deprecated
1430
- */
1431
- setClipboard?(content: string, contentType?: string, label?: string): Promise<void>;
1432
- /**
1433
- * Get the contents of the device clipboard, converted into an appropriate media type
1434
- *
1435
- * @param contentType - the media type if not text
1436
- *
1437
- * @returns The text or media content (base64-encoded) of the clipboard
1438
- *
1439
- * @deprecated
1440
- */
1441
- getClipboard?(contentType?: string): Promise<string>;
1442
- /**
1443
- * Set the async execute script timeout
1444
- *
1445
- * @param ms - the timeout
1446
- *
1447
- * @deprecated Use the W3C timeouts command instead
1448
- */
1449
- asyncScriptTimeout?(ms: number): Promise<void>;
1450
- /**
1451
- * Get the window size
1452
- *
1453
- * @returns The size (width and height)
1454
- *
1455
- * @deprecated Use getWindowRect instead
1456
- */
1457
- getWindowSize?(): Promise<Size>;
1458
- /**
1459
- * Get the position of an element on screen
1460
- *
1461
- * @param elementId - the element ID
1462
- *
1463
- * @returns The position of the element
1464
- *
1465
- * @deprecated Use getElementRect instead
1466
- */
1467
- getLocation?(elementId: string): Promise<Position>;
1468
- /**
1469
- * Get the position of an element on screen within a certain other view
1470
- *
1471
- * @param elementId - the element ID
1472
- *
1473
- * @returns The position of the element
1474
- *
1475
- * @deprecated Use getElementRect instead
1476
- */
1477
- getLocationInView?(elementId: string): Promise<Position>;
1478
- /**
1479
- * Get the size of an element
1480
- *
1481
- * @param elementId - the element ID
1482
- *
1483
- * @returns The size of the element
1484
- *
1485
- * @deprecated Use getElementRect instead
1486
- */
1487
- getSize?(elementId: string): Promise<Size>;
1488
1353
  /**
1489
1354
  * Check whether two elements are identical
1490
1355
  *
@@ -1494,30 +1359,16 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1494
1359
  * @returns True if the elements are equal, false otherwise
1495
1360
  *
1496
1361
  * @deprecated
1362
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1497
1363
  */
1498
1364
  equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
1499
- /**
1500
- * Submit the form an element is in
1501
- *
1502
- * @param elementId - the element ID
1503
- *
1504
- * @deprecated
1505
- */
1506
- submit?(elementId: string): Promise<void>;
1507
- /**
1508
- * Send keys to the app
1509
- *
1510
- * @param value: the array of keys to send
1511
- *
1512
- * @deprecated Use the W3C send keys method instead
1513
- */
1514
- keys?(value: string[]): Promise<void>;
1515
1365
  /**
1516
1366
  * Get the list of IME engines
1517
1367
  *
1518
1368
  * @returns The list of IME engines
1519
1369
  *
1520
1370
  * @deprecated
1371
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1521
1372
  */
1522
1373
  availableIMEEngines?(): Promise<string[]>;
1523
1374
  /**
@@ -1526,6 +1377,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1526
1377
  * @returns The name of the active engine
1527
1378
  *
1528
1379
  * @deprecated
1380
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1529
1381
  */
1530
1382
  getActiveIMEEngine?(): Promise<string>;
1531
1383
  /**
@@ -1534,12 +1386,14 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1534
1386
  * @returns True if the IME is activated
1535
1387
  *
1536
1388
  * @deprecated
1389
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1537
1390
  */
1538
1391
  isIMEActivated?(): Promise<boolean>;
1539
1392
  /**
1540
1393
  * Deactivate an IME engine
1541
1394
  *
1542
1395
  * @deprecated
1396
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1543
1397
  */
1544
1398
  deactivateIMEEngine?(): Promise<void>;
1545
1399
  /**
@@ -1548,6 +1402,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1548
1402
  * @param engine - the name of the engine
1549
1403
  *
1550
1404
  * @deprecated
1405
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1551
1406
  */
1552
1407
  activateIMEEngine?(engine: string): Promise<void>;
1553
1408
  /**
@@ -1562,22 +1417,13 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1562
1417
  * @param orientation - the orientation string
1563
1418
  */
1564
1419
  setOrientation?(orientation: string): Promise<void>;
1565
- /**
1566
- * Move the mouse pointer to a particular screen location
1567
- *
1568
- * @param element - the element ID if the move is relative to an element
1569
- * @param xOffset - the x offset
1570
- * @param yOffset - the y offset
1571
- *
1572
- * @deprecated Use the Actions API instead
1573
- */
1574
- moveTo?(element?: null | string, xOffset?: number, yOffset?: number): Promise<void>;
1575
1420
  /**
1576
1421
  * Trigger a mouse button down
1577
1422
  *
1578
1423
  * @param button - the button ID
1579
1424
  *
1580
1425
  * @deprecated Use the Actions API instead
1426
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1581
1427
  */
1582
1428
  buttonDown?(button?: number): Promise<void>;
1583
1429
  /**
@@ -1586,6 +1432,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1586
1432
  * @param button - the button ID
1587
1433
  *
1588
1434
  * @deprecated Use the Actions API instead
1435
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1589
1436
  */
1590
1437
  buttonUp?(button?: number): Promise<void>;
1591
1438
  /**
@@ -1594,12 +1441,14 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1594
1441
  * @param button - the button ID
1595
1442
  *
1596
1443
  * @deprecated Use the Actions API instead
1444
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1597
1445
  */
1598
1446
  clickCurrent?(button?: number): Promise<void>;
1599
1447
  /**
1600
1448
  * Double-click the current mouse location
1601
1449
  *
1602
1450
  * @deprecated Use the Actions API instead
1451
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1603
1452
  */
1604
1453
  doubleClick?(): Promise<void>;
1605
1454
  /**
@@ -1609,6 +1458,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1609
1458
  * @param y - the y coordinate
1610
1459
  *
1611
1460
  * @deprecated Use the Actions API instead
1461
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1612
1462
  */
1613
1463
  touchDown?(x: number, y: number): Promise<void>;
1614
1464
  /**
@@ -1618,6 +1468,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1618
1468
  * @param y - the y coordinate
1619
1469
  *
1620
1470
  * @deprecated Use the Actions API instead
1471
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1621
1472
  */
1622
1473
  touchUp?(x: number, y: number): Promise<void>;
1623
1474
  /**
@@ -1627,6 +1478,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1627
1478
  * @param y - the y coordinate
1628
1479
  *
1629
1480
  * @deprecated Use the Actions API instead
1481
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1630
1482
  */
1631
1483
  touchMove?(x: number, y: number): Promise<void>;
1632
1484
  /**
@@ -1635,6 +1487,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1635
1487
  * @param elementId - the id of the element to long touch
1636
1488
  *
1637
1489
  * @deprecated Use the Actions API instead
1490
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1638
1491
  */
1639
1492
  touchLongClick?(elementId: string): Promise<void>;
1640
1493
  /**
@@ -1648,6 +1501,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1648
1501
  * @param speed - the speed (unclear how this relates to xSpeed and ySpeed)
1649
1502
  *
1650
1503
  * @deprecated Use the Actions API instead
1504
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1651
1505
  */
1652
1506
  flick?(element?: string, xSpeed?: number, ySpeed?: number, xOffset?: number, yOffset?: number, speed?: number): Promise<void>;
1653
1507
  /**
@@ -1675,7 +1529,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1675
1529
  *
1676
1530
  * @param name - the context name
1677
1531
  */
1678
- setContext?(name: string): Promise<void>;
1532
+ setContext?(name: string, ...args: any[]): Promise<void>;
1679
1533
  /**
1680
1534
  * Get the list of available contexts
1681
1535
  * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#webviews-and-other-contexts}
@@ -1691,6 +1545,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1691
1545
  * @returns The page index
1692
1546
  *
1693
1547
  * @deprecated
1548
+ * @privateRemarks Not implemented in `appium-xcuitest-driver`
1694
1549
  */
1695
1550
  getPageIndex?(elementId: string): Promise<string>;
1696
1551
  /**
@@ -1708,23 +1563,6 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1708
1563
  * @param type - the bitmask representing network state
1709
1564
  */
1710
1565
  setNetworkConnection?(type: number): Promise<void>;
1711
- /**
1712
- * Perform a set of touch actions
1713
- *
1714
- * @param actions - the old MJSONWP style touch action objects
1715
- *
1716
- * @deprecated Use the W3C Actions API instead
1717
- */
1718
- performTouch?(actions: unknown): Promise<void>;
1719
- /**
1720
- * Perform a set of touch actions
1721
- *
1722
- * @param actions - the old MJSONWP style touch action objects
1723
- * @param elementId - the id of an element if actions are restricted to one element
1724
- *
1725
- * @deprecated Use the W3C Actions API instead
1726
- */
1727
- performMultiAction?(actions: unknown, elementId: string): Promise<void>;
1728
1566
  /**
1729
1567
  * Get the current rotation state of the device
1730
1568
  * @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-rotation}
@@ -1828,18 +1666,18 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
1828
1666
  *
1829
1667
  * This is likely unusable by external consumers, but YMMV!
1830
1668
  */
1831
- export interface DriverStatic<D extends Driver> {
1669
+ export interface DriverStatic<T extends Driver> {
1832
1670
  baseVersion: string;
1833
1671
  updateServer?: UpdateServerCallback;
1834
- newMethodMap?: MethodMap<D>;
1835
- executeMethodMap?: ExecuteMethodMap<D>;
1672
+ newMethodMap?: MethodMap<T>;
1673
+ executeMethodMap?: ExecuteMethodMap<T>;
1836
1674
  }
1837
1675
  /**
1838
1676
  * Represents a driver class, which is used internally by Appium.
1839
1677
  *
1840
1678
  * This is likely unusable by external consumers, but YMMV!
1841
1679
  */
1842
- export type DriverClass<D extends Driver = ExternalDriver> = Class<D, DriverStatic<D>, [
1680
+ export type DriverClass<T extends Driver = Driver> = Class<T, DriverStatic<T>, [
1843
1681
  ] | [Partial<ServerArgs>] | [Partial<ServerArgs>, boolean]>;
1844
1682
  export interface ExtraDriverOpts {
1845
1683
  fastReset?: boolean;
@@ -1850,11 +1688,104 @@ export interface ExtraDriverOpts {
1850
1688
  *
1851
1689
  * The combination happens within Appium prior to calling the constructor.
1852
1690
  */
1853
- export type DriverOpts<C extends Constraints = BaseDriverCapConstraints> = ServerArgs & ExtraDriverOpts & Partial<ConstraintsToCaps<C>>;
1854
- export type DriverCommand<TArgs = any, TReturn = unknown> = (...args: TArgs[]) => Promise<TReturn>;
1855
- export type DriverCommands<TArgs = any, TReturn = unknown> = Record<string, DriverCommand<TArgs, TReturn>>;
1691
+ export type DriverOpts<C extends Constraints> = ServerArgs & ExtraDriverOpts & DriverCaps<C>;
1692
+ /**
1693
+ * An instance method of a driver class, whose name may be referenced by {@linkcode MethodDef.command}, and serves as an Appium command.
1694
+ *
1695
+ * Note that this signature differs from a `PluginCommand`.
1696
+ */
1697
+ export type DriverCommand<TArgs extends readonly any[] = any[], TRetval = unknown> = (...args: TArgs) => Promise<TRetval>;
1856
1698
  /**
1857
1699
  * Tuple of an HTTP method with a regex matching a request path
1858
1700
  */
1859
1701
  export type RouteMatcher = [HTTPMethod, RegExp];
1702
+ /**
1703
+ * Result of the {@linkcode onPostProcess ConfigureAppOptions.onPostProcess} callback.
1704
+ */
1705
+ export interface PostProcessResult {
1706
+ /**
1707
+ * The full past to the post-processed application package on the local file system .
1708
+ *
1709
+ * This might be a file or a folder path.
1710
+ */
1711
+ appPath: string;
1712
+ }
1713
+ /**
1714
+ * Information about a cached app instance.
1715
+ */
1716
+ export interface CachedAppInfo {
1717
+ /**
1718
+ * SHA1 hash of the package if it is a file (and not a folder)
1719
+ */
1720
+ packageHash: string;
1721
+ /**
1722
+ * Date instance; the value of the file's `Last-Modified` header
1723
+ */
1724
+ lastModified?: Date;
1725
+ /**
1726
+ * `true` if the file contains an `immutable` mark in `Cache-control` header
1727
+ */
1728
+ immutable?: boolean;
1729
+ /**
1730
+ * Integer representation of `maxAge` parameter in `Cache-control` header
1731
+ */
1732
+ maxAge?: number;
1733
+ /**
1734
+ * The timestamp this item has been added to the cache (measured in Unix epoch milliseconds)
1735
+ */
1736
+ timestamp?: number;
1737
+ /**
1738
+ * An object containing either `file` property with SHA1 hash of the file or `folder` property
1739
+ * with total amount of cached files and subfolders
1740
+ */
1741
+ integrity?: {
1742
+ file?: string;
1743
+ } | {
1744
+ folder?: number;
1745
+ };
1746
+ /**
1747
+ * The full path to the cached app
1748
+ */
1749
+ fullPath?: string;
1750
+ }
1751
+ /**
1752
+ * Options for the post-processing step
1753
+ *
1754
+ * The generic can be supplied if using `axios`, where `headers` is a fancy object.
1755
+ */
1756
+ export interface PostProcessOptions<Headers = HTTPHeaders> {
1757
+ /**
1758
+ * The information about the previously cached app instance (if exists)
1759
+ */
1760
+ cachedAppInfo?: CachedAppInfo;
1761
+ /**
1762
+ * Whether the app has been downloaded from a remote URL
1763
+ */
1764
+ isUrl?: boolean;
1765
+ /**
1766
+ * Optional headers object.
1767
+ *
1768
+ * Only present if `isUrl` is `true` and if the server responds to `HEAD` requests. All header names are normalized to lowercase.
1769
+ */
1770
+ headers?: Headers;
1771
+ /**
1772
+ * A string containing full path to the preprocessed application package (either downloaded or a local one)
1773
+ */
1774
+ appPath?: string;
1775
+ }
1776
+ export interface ConfigureAppOptions {
1777
+ /**
1778
+ *
1779
+ * Optional function, which should be applied to the application after it is
1780
+ * downloaded/preprocessed.
1781
+ *
1782
+ * This function may be async and is expected to accept single object parameter. The function is
1783
+ * expected to either return a falsy value, which means the app must not be cached and a fresh
1784
+ * copy of it is downloaded each time, _or_ if this function returns an object containing an
1785
+ * `appPath` property, then the integrity of it will be verified and stored into the cache.
1786
+ * @returns
1787
+ */
1788
+ onPostProcess?: (obj: PostProcessOptions) => Promise<PostProcessResult | undefined> | PostProcessResult | undefined;
1789
+ supportedExtensions: string[];
1790
+ }
1860
1791
  //# sourceMappingURL=driver.d.ts.map