@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.
- package/LICENSE +1 -1
- package/build/lib/action.d.ts +4 -1
- package/build/lib/action.d.ts.map +1 -1
- package/build/lib/action.js +1 -1
- package/build/lib/action.js.map +1 -1
- package/build/lib/capabilities.d.ts +34 -23
- package/build/lib/capabilities.d.ts.map +1 -1
- package/build/lib/command.d.ts +116 -0
- package/build/lib/command.d.ts.map +1 -0
- package/build/lib/command.js +3 -0
- package/build/lib/command.js.map +1 -0
- package/build/lib/config.d.ts +2 -13
- package/build/lib/config.d.ts.map +1 -1
- package/build/lib/config.js.map +1 -1
- package/build/lib/constraints.d.ts +54 -67
- package/build/lib/constraints.d.ts.map +1 -1
- package/build/lib/constraints.js +2 -5
- package/build/lib/constraints.js.map +1 -1
- package/build/lib/driver.d.ts +223 -292
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/http.d.ts +11 -0
- package/build/lib/http.d.ts.map +1 -0
- package/build/lib/http.js +3 -0
- package/build/lib/http.js.map +1 -0
- package/build/lib/index.d.ts +6 -157
- package/build/lib/index.d.ts.map +1 -1
- package/build/lib/index.js +6 -3
- package/build/lib/index.js.map +1 -1
- package/build/lib/logger.d.ts +39 -0
- package/build/lib/logger.d.ts.map +1 -0
- package/build/lib/logger.js +3 -0
- package/build/lib/logger.js.map +1 -0
- package/build/lib/plugin.d.ts +30 -5
- package/build/lib/plugin.d.ts.map +1 -1
- package/build/lib/server.d.ts +60 -0
- package/build/lib/server.d.ts.map +1 -0
- package/build/lib/server.js +3 -0
- package/build/lib/server.js.map +1 -0
- package/build/lib/util.d.ts +51 -0
- package/build/lib/util.d.ts.map +1 -0
- package/build/lib/util.js +3 -0
- package/build/lib/util.js.map +1 -0
- package/lib/action.ts +4 -1
- package/lib/capabilities.ts +40 -53
- package/lib/command.ts +139 -0
- package/lib/config.ts +2 -36
- package/lib/{constraints.js → constraints.ts} +5 -5
- package/lib/driver.ts +260 -370
- package/lib/http.ts +31 -0
- package/lib/index.ts +6 -214
- package/lib/logger.ts +41 -0
- package/lib/plugin.ts +38 -6
- package/lib/server.ts +73 -0
- package/lib/util.ts +74 -0
- package/package.json +6 -5
package/lib/driver.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import type {EventEmitter} from 'events';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
UpdateServerCallback,
|
|
7
|
-
Class,
|
|
8
|
-
MethodMap,
|
|
9
|
-
AppiumLogger,
|
|
10
|
-
StringRecord,
|
|
11
|
-
ConstraintsToCaps,
|
|
12
|
-
BaseDriverCapConstraints,
|
|
13
|
-
W3CCapabilities,
|
|
14
|
-
Capabilities,
|
|
15
|
-
ExecuteMethodMap,
|
|
16
|
-
} from '.';
|
|
2
|
+
import {Entries} from 'type-fest';
|
|
3
|
+
import {ActionSequence, Element} from './action';
|
|
4
|
+
import {Capabilities, DriverCaps, W3CCapabilities, W3CDriverCaps} from './capabilities';
|
|
5
|
+
import {ExecuteMethodMap, MethodMap} from './command';
|
|
17
6
|
import {ServerArgs} from './config';
|
|
18
|
-
import {
|
|
7
|
+
import {HTTPHeaders, HTTPMethod} from './http';
|
|
8
|
+
import {AppiumLogger} from './logger';
|
|
9
|
+
import {AppiumServer, UpdateServerCallback} from './server';
|
|
10
|
+
import {Class, StringRecord} from './util';
|
|
19
11
|
|
|
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
|
+
}
|
|
20
19
|
export interface ITimeoutCommands {
|
|
21
20
|
/**
|
|
22
21
|
* Set the various timeouts associated with a session
|
|
@@ -49,6 +48,7 @@ export interface ITimeoutCommands {
|
|
|
49
48
|
* @param ms - the timeout in ms
|
|
50
49
|
*
|
|
51
50
|
* @deprecated Use `timeouts` instead
|
|
51
|
+
*
|
|
52
52
|
*/
|
|
53
53
|
implicitWait(ms: number | string): Promise<void>;
|
|
54
54
|
|
|
@@ -66,7 +66,7 @@ export interface ITimeoutCommands {
|
|
|
66
66
|
*
|
|
67
67
|
* @returns The return value of the condition
|
|
68
68
|
*/
|
|
69
|
-
implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
|
|
69
|
+
implicitWaitForCondition(condition: (...args: any[]) => Promise<any>): Promise<unknown>;
|
|
70
70
|
|
|
71
71
|
/**
|
|
72
72
|
* Get the current timeouts
|
|
@@ -170,7 +170,7 @@ export interface ISessionCommands {
|
|
|
170
170
|
*
|
|
171
171
|
* @returns A session data object
|
|
172
172
|
*/
|
|
173
|
-
getSession(): Promise<SingularSessionData
|
|
173
|
+
getSession<C extends Constraints>(): Promise<SingularSessionData<C>>;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
export interface IExecuteCommands {
|
|
@@ -183,23 +183,26 @@ export interface IExecuteCommands {
|
|
|
183
183
|
*
|
|
184
184
|
* @returns The result of calling the Execute Method
|
|
185
185
|
*/
|
|
186
|
-
executeMethod<
|
|
186
|
+
executeMethod<
|
|
187
|
+
TArgs extends readonly any[] | readonly [StringRecord<unknown>] = unknown[],
|
|
188
|
+
TReturn = unknown
|
|
189
|
+
>(
|
|
190
|
+
script: string,
|
|
191
|
+
args: TArgs
|
|
192
|
+
): Promise<TReturn>;
|
|
187
193
|
}
|
|
188
194
|
|
|
189
|
-
export interface MultiSessionData<
|
|
190
|
-
C extends Constraints = BaseDriverCapConstraints,
|
|
191
|
-
Extra extends StringRecord | void = void
|
|
192
|
-
> {
|
|
195
|
+
export interface MultiSessionData<C extends Constraints = Constraints> {
|
|
193
196
|
id: string;
|
|
194
|
-
capabilities:
|
|
197
|
+
capabilities: DriverCaps<C>;
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
export type SingularSessionData<
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
200
|
+
export type SingularSessionData<C extends Constraints = Constraints> = DriverCaps<C> & {
|
|
201
|
+
events?: EventHistory;
|
|
202
|
+
error?: string;
|
|
203
|
+
};
|
|
201
204
|
|
|
202
|
-
export interface IFindCommands
|
|
205
|
+
export interface IFindCommands {
|
|
203
206
|
/**
|
|
204
207
|
* Find a UI element given a locator strategy and a selector, erroring if it can't be found
|
|
205
208
|
* @see {@link https://w3c.github.io/webdriver/#find-element}
|
|
@@ -294,7 +297,7 @@ export interface IFindCommands<Ctx = any> {
|
|
|
294
297
|
*
|
|
295
298
|
* @returns A single element or list of elements
|
|
296
299
|
*/
|
|
297
|
-
findElOrEls<Mult extends boolean>(
|
|
300
|
+
findElOrEls<Mult extends boolean, Ctx = any>(
|
|
298
301
|
strategy: string,
|
|
299
302
|
selector: string,
|
|
300
303
|
mult: Mult,
|
|
@@ -312,7 +315,7 @@ export interface IFindCommands<Ctx = any> {
|
|
|
312
315
|
*
|
|
313
316
|
* @returns A single element or list of elements
|
|
314
317
|
*/
|
|
315
|
-
findElOrElsWithProcessing<Mult extends boolean>(
|
|
318
|
+
findElOrElsWithProcessing<Mult extends boolean, Ctx = any>(
|
|
316
319
|
strategy: string,
|
|
317
320
|
selector: string,
|
|
318
321
|
mult: Mult,
|
|
@@ -328,41 +331,35 @@ export interface IFindCommands<Ctx = any> {
|
|
|
328
331
|
getPageSource(): Promise<string>;
|
|
329
332
|
}
|
|
330
333
|
|
|
331
|
-
export interface ILogCommands
|
|
334
|
+
export interface ILogCommands {
|
|
332
335
|
/**
|
|
333
336
|
* Definition of the available log types
|
|
334
337
|
*/
|
|
335
|
-
supportedLogTypes: Readonly<LogDefRecord
|
|
338
|
+
supportedLogTypes: Readonly<LogDefRecord>;
|
|
336
339
|
|
|
337
340
|
/**
|
|
338
341
|
* Get available log types as a list of strings
|
|
339
342
|
*/
|
|
340
|
-
getLogTypes(): Promise<
|
|
343
|
+
getLogTypes(): Promise<string[]>;
|
|
341
344
|
|
|
342
345
|
/**
|
|
343
346
|
* Get the log for a given log type.
|
|
344
347
|
*
|
|
345
348
|
* @param logType - Name/key of log type as defined in {@linkcode ILogCommands.supportedLogTypes}.
|
|
346
349
|
*/
|
|
347
|
-
getLog(
|
|
348
|
-
logType: keyof ILogCommands<C>['supportedLogTypes']
|
|
349
|
-
): Promise<
|
|
350
|
-
AsyncReturnType<
|
|
351
|
-
ILogCommands<C>['supportedLogTypes'][keyof ILogCommands<C>['supportedLogTypes']]['getter']
|
|
352
|
-
>
|
|
353
|
-
>;
|
|
350
|
+
getLog(logType: string): Promise<unknown[]>;
|
|
354
351
|
}
|
|
355
352
|
|
|
356
353
|
/**
|
|
357
354
|
* A record of {@linkcode LogDef} objects, keyed by the log type name.
|
|
358
355
|
* Used in {@linkcode ILogCommands.supportedLogTypes}
|
|
359
356
|
*/
|
|
360
|
-
export type LogDefRecord
|
|
357
|
+
export type LogDefRecord = Record<string, LogDef>;
|
|
361
358
|
|
|
362
359
|
/**
|
|
363
360
|
* A definition of a log type
|
|
364
361
|
*/
|
|
365
|
-
export interface LogDef
|
|
362
|
+
export interface LogDef {
|
|
366
363
|
/**
|
|
367
364
|
* Description of the log type.
|
|
368
365
|
*
|
|
@@ -375,10 +372,10 @@ export interface LogDef<C extends Constraints, T = unknown> {
|
|
|
375
372
|
*
|
|
376
373
|
* This implementation *should* drain, truncate or otherwise reset the log buffer.
|
|
377
374
|
*/
|
|
378
|
-
getter: (driver:
|
|
375
|
+
getter: (driver: any) => Promise<unknown[]> | unknown[];
|
|
379
376
|
}
|
|
380
377
|
|
|
381
|
-
export interface ISettingsCommands {
|
|
378
|
+
export interface ISettingsCommands<T extends StringRecord = StringRecord> {
|
|
382
379
|
/**
|
|
383
380
|
* Update the session's settings dictionary with a new settings object
|
|
384
381
|
*
|
|
@@ -392,14 +389,29 @@ export interface ISettingsCommands {
|
|
|
392
389
|
*
|
|
393
390
|
* @returns The settings object
|
|
394
391
|
*/
|
|
395
|
-
getSettings(): Promise<
|
|
392
|
+
getSettings(): Promise<T>;
|
|
396
393
|
}
|
|
397
394
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
395
|
+
/**
|
|
396
|
+
* @see {@linkcode ISessionHandler}
|
|
397
|
+
*/
|
|
398
|
+
export type DefaultCreateSessionResult<C extends Constraints> = [
|
|
399
|
+
sessionId: string,
|
|
400
|
+
capabilities: DriverCaps<C>
|
|
401
|
+
];
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* @see {@linkcode ISessionHandler}
|
|
405
|
+
*/
|
|
406
|
+
export type DefaultDeleteSessionResult = void;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* An interface which creates and deletes sessions.
|
|
410
|
+
*/
|
|
411
|
+
export interface ISessionHandler<
|
|
412
|
+
C extends Constraints = Constraints,
|
|
413
|
+
CreateResult = DefaultCreateSessionResult<C>,
|
|
414
|
+
DeleteResult = DefaultDeleteSessionResult
|
|
403
415
|
> {
|
|
404
416
|
/**
|
|
405
417
|
* Start a new automation session
|
|
@@ -419,9 +431,9 @@ export interface SessionHandler<
|
|
|
419
431
|
* @returns The capabilities object representing the created session
|
|
420
432
|
*/
|
|
421
433
|
createSession(
|
|
422
|
-
w3cCaps1:
|
|
423
|
-
w3cCaps2?:
|
|
424
|
-
w3cCaps3?:
|
|
434
|
+
w3cCaps1: W3CDriverCaps<C>,
|
|
435
|
+
w3cCaps2?: W3CDriverCaps<C>,
|
|
436
|
+
w3cCaps3?: W3CDriverCaps<C>,
|
|
425
437
|
driverData?: DriverData[]
|
|
426
438
|
): Promise<CreateResult>;
|
|
427
439
|
|
|
@@ -440,19 +452,6 @@ export interface SessionHandler<
|
|
|
440
452
|
*/
|
|
441
453
|
export type DriverData = Record<string, unknown>;
|
|
442
454
|
|
|
443
|
-
/**
|
|
444
|
-
* Extensions can define new methods for the Appium server to map to command names, of the same
|
|
445
|
-
* format as used in Appium's `routes.js`.
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
* @example
|
|
449
|
-
* {
|
|
450
|
-
* '/session/:sessionId/new_method': {
|
|
451
|
-
* GET: {command: 'getNewThing'},
|
|
452
|
-
* POST: {command: 'setNewThing', payloadParams: {required: ['someParam']}}
|
|
453
|
-
* }
|
|
454
|
-
* }
|
|
455
|
-
*/
|
|
456
455
|
export interface Constraint {
|
|
457
456
|
readonly presence?: boolean | Readonly<{allowEmpty: boolean}>;
|
|
458
457
|
readonly isString?: boolean;
|
|
@@ -461,17 +460,26 @@ export interface Constraint {
|
|
|
461
460
|
readonly isObject?: boolean;
|
|
462
461
|
readonly isArray?: boolean;
|
|
463
462
|
readonly deprecated?: boolean;
|
|
464
|
-
readonly inclusion?: Readonly<[
|
|
465
|
-
readonly inclusionCaseInsensitive?: Readonly<[
|
|
463
|
+
readonly inclusion?: Readonly<[string, ...string[]]>;
|
|
464
|
+
readonly inclusionCaseInsensitive?: Readonly<[string, ...string[]]>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* A collection of constraints describing the allowed capabilities for a driver.
|
|
469
|
+
*/
|
|
470
|
+
export interface Constraints {
|
|
471
|
+
[name: string]: Constraint;
|
|
466
472
|
}
|
|
467
|
-
export type Constraints = Readonly<Record<string, Constraint>>;
|
|
468
473
|
|
|
469
|
-
export interface DriverHelpers
|
|
470
|
-
configureApp: (
|
|
474
|
+
export interface DriverHelpers {
|
|
475
|
+
configureApp: (
|
|
476
|
+
app: string,
|
|
477
|
+
supportedAppExtensions?: string | string[] | ConfigureAppOptions
|
|
478
|
+
) => Promise<string>;
|
|
471
479
|
isPackageOrBundle: (app: string) => boolean;
|
|
472
480
|
duplicateKeys: <T>(input: T, firstKey: string, secondKey: string) => T;
|
|
473
481
|
parseCapsArray: (cap: string | string[]) => string[];
|
|
474
|
-
generateDriverLogPrefix: (obj: Core<C>, sessionId?: string) => string;
|
|
482
|
+
generateDriverLogPrefix: <C extends Constraints>(obj: Core<C>, sessionId?: string) => string;
|
|
475
483
|
}
|
|
476
484
|
|
|
477
485
|
export type SettingsUpdateListener<T extends Record<string, unknown> = Record<string, unknown>> = (
|
|
@@ -480,11 +488,6 @@ export type SettingsUpdateListener<T extends Record<string, unknown> = Record<st
|
|
|
480
488
|
curValue: unknown
|
|
481
489
|
) => Promise<void>;
|
|
482
490
|
|
|
483
|
-
export interface DeviceSettings<T = any> {
|
|
484
|
-
update(newSettings: Record<string, T>): Promise<void>;
|
|
485
|
-
getSettings(): Record<string, T>;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
491
|
// WebDriver
|
|
489
492
|
|
|
490
493
|
export interface Rect {
|
|
@@ -588,13 +591,13 @@ export interface EventHistoryCommand {
|
|
|
588
591
|
*
|
|
589
592
|
* This should not be used directly by external code.
|
|
590
593
|
*/
|
|
591
|
-
export interface Core<C extends Constraints =
|
|
594
|
+
export interface Core<C extends Constraints, Settings extends StringRecord = StringRecord> {
|
|
592
595
|
shouldValidateCaps: boolean;
|
|
593
596
|
sessionId: string | null;
|
|
594
597
|
opts: DriverOpts<C>;
|
|
595
|
-
initialOpts:
|
|
598
|
+
initialOpts: Partial<DriverOpts<C>>;
|
|
596
599
|
protocol?: string;
|
|
597
|
-
helpers: DriverHelpers
|
|
600
|
+
helpers: DriverHelpers;
|
|
598
601
|
basePath: string;
|
|
599
602
|
relaxedSecurityEnabled: boolean;
|
|
600
603
|
allowInsecure: string[];
|
|
@@ -604,9 +607,9 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
|
|
|
604
607
|
locatorStrategies: string[];
|
|
605
608
|
webLocatorStrategies: string[];
|
|
606
609
|
eventEmitter: EventEmitter;
|
|
607
|
-
settings:
|
|
610
|
+
settings: IDeviceSettings<Settings>;
|
|
608
611
|
log: AppiumLogger;
|
|
609
|
-
driverData
|
|
612
|
+
driverData: DriverData;
|
|
610
613
|
isCommandsQueueEnabled: boolean;
|
|
611
614
|
eventHistory: EventHistory;
|
|
612
615
|
onUnexpectedShutdown(handler: () => any): void;
|
|
@@ -642,7 +645,7 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
|
|
|
642
645
|
* ```
|
|
643
646
|
*/
|
|
644
647
|
getStatus(): Promise<any>;
|
|
645
|
-
sessionExists(sessionId
|
|
648
|
+
sessionExists(sessionId?: string): boolean;
|
|
646
649
|
isW3CProtocol(): boolean;
|
|
647
650
|
isMjsonwpProtocol(): boolean;
|
|
648
651
|
isFeatureEnabled(name: string): boolean;
|
|
@@ -653,7 +656,7 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
|
|
|
653
656
|
canProxy(sessionId?: string): boolean;
|
|
654
657
|
proxyRouteIsAvoided(sessionId: string, method: string, url: string): boolean;
|
|
655
658
|
addManagedDriver(driver: Driver): void;
|
|
656
|
-
getManagedDrivers(): Driver[];
|
|
659
|
+
getManagedDrivers(): Driver<Constraints>[];
|
|
657
660
|
clearNewCommandTimeout(): Promise<void>;
|
|
658
661
|
logEvent(eventName: string): void;
|
|
659
662
|
driverForSession(sessionId: string): Core<C> | null;
|
|
@@ -665,25 +668,32 @@ export interface Core<C extends Constraints = BaseDriverCapConstraints> {
|
|
|
665
668
|
*
|
|
666
669
|
* `C` should be the constraints of the driver.
|
|
667
670
|
* `CArgs` would be the shape of `cliArgs`.
|
|
668
|
-
* `
|
|
671
|
+
* `Settings` is the shape of the raw device settings object (see {@linkcode IDeviceSettings})
|
|
669
672
|
*/
|
|
670
673
|
export interface Driver<
|
|
671
|
-
C extends Constraints =
|
|
674
|
+
C extends Constraints = Constraints,
|
|
672
675
|
CArgs extends StringRecord = StringRecord,
|
|
673
|
-
|
|
676
|
+
Settings extends StringRecord = StringRecord,
|
|
677
|
+
CreateResult = DefaultCreateSessionResult<C>,
|
|
678
|
+
DeleteResult = DefaultDeleteSessionResult
|
|
674
679
|
> extends ISessionCommands,
|
|
675
|
-
ILogCommands
|
|
676
|
-
IFindCommands
|
|
677
|
-
ISettingsCommands
|
|
680
|
+
ILogCommands,
|
|
681
|
+
IFindCommands,
|
|
682
|
+
ISettingsCommands<Settings>,
|
|
678
683
|
ITimeoutCommands,
|
|
679
684
|
IEventCommands,
|
|
680
685
|
IExecuteCommands,
|
|
681
|
-
|
|
682
|
-
Core {
|
|
686
|
+
ISessionHandler<C, CreateResult, DeleteResult>,
|
|
687
|
+
Core<C, Settings> {
|
|
683
688
|
/**
|
|
684
689
|
* The set of command line arguments set for this driver
|
|
685
690
|
*/
|
|
686
691
|
cliArgs: CArgs;
|
|
692
|
+
// The following properties are assigned by appium */
|
|
693
|
+
server?: AppiumServer;
|
|
694
|
+
serverHost?: string;
|
|
695
|
+
serverPort?: number;
|
|
696
|
+
serverPath?: string;
|
|
687
697
|
|
|
688
698
|
// The following methods are implemented by `BaseDriver`.
|
|
689
699
|
|
|
@@ -715,6 +725,7 @@ export interface Driver<
|
|
|
715
725
|
* Reset the current session (run the delete session and create session subroutines)
|
|
716
726
|
*
|
|
717
727
|
* @deprecated Use explicit session management commands instead
|
|
728
|
+
* @privateRemarks This is implemented by `BaseDriver` and is used within `@appium/driver-test-support`
|
|
718
729
|
*/
|
|
719
730
|
reset(): Promise<void>;
|
|
720
731
|
|
|
@@ -742,7 +753,7 @@ export interface Driver<
|
|
|
742
753
|
*
|
|
743
754
|
* @returns Whether or not the capabilities are valid
|
|
744
755
|
*/
|
|
745
|
-
validateDesiredCaps(caps:
|
|
756
|
+
validateDesiredCaps(caps: DriverCaps<C>): boolean;
|
|
746
757
|
|
|
747
758
|
/**
|
|
748
759
|
* A helper function to log unrecognized capabilities to the console
|
|
@@ -751,7 +762,7 @@ export interface Driver<
|
|
|
751
762
|
*
|
|
752
763
|
* @internal
|
|
753
764
|
*/
|
|
754
|
-
logExtraCaps(caps:
|
|
765
|
+
logExtraCaps(caps: DriverCaps<C>): void;
|
|
755
766
|
|
|
756
767
|
/**
|
|
757
768
|
* A helper function used to assign server information to the driver instance so the driver knows
|
|
@@ -769,14 +780,7 @@ export interface Driver<
|
|
|
769
780
|
* External drivers must subclass `BaseDriver`, and can implement any of these methods.
|
|
770
781
|
* None of these are implemented within Appium itself.
|
|
771
782
|
*/
|
|
772
|
-
export interface ExternalDriver<C extends Constraints =
|
|
773
|
-
extends Driver<C> {
|
|
774
|
-
// The following properties are assigned by appium */
|
|
775
|
-
server?: AppiumServer;
|
|
776
|
-
serverHost?: string;
|
|
777
|
-
serverPort?: number;
|
|
778
|
-
serverPath?: string;
|
|
779
|
-
|
|
783
|
+
export interface ExternalDriver<C extends Constraints = Constraints> extends Driver<C> {
|
|
780
784
|
// WebDriver spec commands
|
|
781
785
|
|
|
782
786
|
/**
|
|
@@ -1217,13 +1221,6 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1217
1221
|
|
|
1218
1222
|
// Appium W3C WebDriver Extension
|
|
1219
1223
|
|
|
1220
|
-
/**
|
|
1221
|
-
* Shake the device
|
|
1222
|
-
*
|
|
1223
|
-
* @deprecated
|
|
1224
|
-
*/
|
|
1225
|
-
mobileShake?(): Promise<void>;
|
|
1226
|
-
|
|
1227
1224
|
/**
|
|
1228
1225
|
* Get the current time on the device under timeouts
|
|
1229
1226
|
*
|
|
@@ -1233,52 +1230,6 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1233
1230
|
*/
|
|
1234
1231
|
getDeviceTime?(format?: string): Promise<string>;
|
|
1235
1232
|
|
|
1236
|
-
/**
|
|
1237
|
-
* Lock the device, and optionally unlock the device after a certain amount of time
|
|
1238
|
-
*
|
|
1239
|
-
* @param seconds - the number of seconds after which to unlock the device. Set to zero or leave
|
|
1240
|
-
* empty to not unlock the device automatically
|
|
1241
|
-
*
|
|
1242
|
-
* @deprecated
|
|
1243
|
-
*/
|
|
1244
|
-
lock?(seconds?: number): Promise<void>;
|
|
1245
|
-
|
|
1246
|
-
/**
|
|
1247
|
-
* Unlock the device
|
|
1248
|
-
*
|
|
1249
|
-
* @deprecated
|
|
1250
|
-
*/
|
|
1251
|
-
unlock?(): Promise<void>;
|
|
1252
|
-
|
|
1253
|
-
/**
|
|
1254
|
-
* Determine whether the device is locked
|
|
1255
|
-
*
|
|
1256
|
-
* @returns True if the device is locked, false otherwise
|
|
1257
|
-
*
|
|
1258
|
-
* @deprecated
|
|
1259
|
-
*/
|
|
1260
|
-
isLocked?(): Promise<boolean>;
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* Direct Appium to start recording the device screen
|
|
1264
|
-
*
|
|
1265
|
-
* @param options - parameters for screen recording
|
|
1266
|
-
*
|
|
1267
|
-
* @deprecated
|
|
1268
|
-
*/
|
|
1269
|
-
startRecordingScreen?(options?: StartScreenRecordOptions): Promise<void>;
|
|
1270
|
-
|
|
1271
|
-
/**
|
|
1272
|
-
* Direct Appium to stop screen recording and return the video
|
|
1273
|
-
*
|
|
1274
|
-
* @param options - parameters for stopping like video Uploading
|
|
1275
|
-
*
|
|
1276
|
-
* @returns The base64-encoded video data
|
|
1277
|
-
*
|
|
1278
|
-
* @deprecated
|
|
1279
|
-
*/
|
|
1280
|
-
stopRecordingScreen?(options?: StopScreenRecordOptions): Promise<string>;
|
|
1281
|
-
|
|
1282
1233
|
/**
|
|
1283
1234
|
* List the performance data types supported by this driver, which can be used in a call to get
|
|
1284
1235
|
* the performance data by type.
|
|
@@ -1286,6 +1237,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1286
1237
|
* @returns The list of types
|
|
1287
1238
|
*
|
|
1288
1239
|
* @deprecated
|
|
1240
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1289
1241
|
*/
|
|
1290
1242
|
getPerformanceDataTypes?(): Promise<string[]>;
|
|
1291
1243
|
|
|
@@ -1300,6 +1252,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1300
1252
|
* @returns A list of performance data strings
|
|
1301
1253
|
*
|
|
1302
1254
|
* @deprecated
|
|
1255
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1303
1256
|
*/
|
|
1304
1257
|
getPerformanceData?(
|
|
1305
1258
|
packageName: string,
|
|
@@ -1315,6 +1268,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1315
1268
|
* @param flags - the code denoting the combination of extra flags
|
|
1316
1269
|
*
|
|
1317
1270
|
* @deprecated
|
|
1271
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1318
1272
|
*/
|
|
1319
1273
|
pressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
|
|
1320
1274
|
|
|
@@ -1326,6 +1280,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1326
1280
|
* @param flags - the code denoting the combination of extra flags
|
|
1327
1281
|
*
|
|
1328
1282
|
* @deprecated
|
|
1283
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1329
1284
|
*/
|
|
1330
1285
|
longPressKeyCode?(keycode: number, metastate?: number, flags?: number): Promise<void>;
|
|
1331
1286
|
|
|
@@ -1335,6 +1290,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1335
1290
|
* @param fingerprintId - the numeric ID of the fingerprint to use
|
|
1336
1291
|
*
|
|
1337
1292
|
* @deprecated
|
|
1293
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1338
1294
|
*/
|
|
1339
1295
|
fingerprint?(fingerprintId: number): Promise<void>;
|
|
1340
1296
|
|
|
@@ -1345,6 +1301,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1345
1301
|
* @param message - the SMS text
|
|
1346
1302
|
*
|
|
1347
1303
|
* @deprecated
|
|
1304
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1348
1305
|
*/
|
|
1349
1306
|
sendSMS?(phoneNumber: string, message: string): Promise<void>;
|
|
1350
1307
|
|
|
@@ -1356,6 +1313,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1356
1313
|
* @param action - the action to take in response (accept, reject, etc...)
|
|
1357
1314
|
*
|
|
1358
1315
|
* @deprecated
|
|
1316
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1359
1317
|
*/
|
|
1360
1318
|
gsmCall?(phoneNumber: string, action: string): Promise<void>;
|
|
1361
1319
|
|
|
@@ -1365,6 +1323,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1365
1323
|
* @param singalStrength - the strength in a driver-appropriate string
|
|
1366
1324
|
*
|
|
1367
1325
|
* @deprecated
|
|
1326
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1368
1327
|
*/
|
|
1369
1328
|
gsmSignal?(signalStrength: string): Promise<void>;
|
|
1370
1329
|
|
|
@@ -1374,6 +1333,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1374
1333
|
* @param state - the state
|
|
1375
1334
|
*
|
|
1376
1335
|
* @deprecated
|
|
1336
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1377
1337
|
*/
|
|
1378
1338
|
gsmVoice?(state: string): Promise<void>;
|
|
1379
1339
|
|
|
@@ -1383,6 +1343,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1383
1343
|
* @param percent - how full the battery should become
|
|
1384
1344
|
*
|
|
1385
1345
|
* @deprecated
|
|
1346
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1386
1347
|
*/
|
|
1387
1348
|
powerCapacity?(percent: number): Promise<void>;
|
|
1388
1349
|
|
|
@@ -1392,6 +1353,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1392
1353
|
* @param state - whether the device is connected to power or not
|
|
1393
1354
|
*
|
|
1394
1355
|
* @deprecated
|
|
1356
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1395
1357
|
*/
|
|
1396
1358
|
powerAC?(state: string): Promise<void>;
|
|
1397
1359
|
|
|
@@ -1401,6 +1363,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1401
1363
|
* @param netspeed - the speed as a string, like '3G'
|
|
1402
1364
|
*
|
|
1403
1365
|
* @deprecated
|
|
1366
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1404
1367
|
*/
|
|
1405
1368
|
networkSpeed?(netspeed: string): Promise<void>;
|
|
1406
1369
|
|
|
@@ -1411,6 +1374,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1411
1374
|
* @param metastate - the combination of meta startUnexpectedShutdown
|
|
1412
1375
|
*
|
|
1413
1376
|
* @deprecated
|
|
1377
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1414
1378
|
*/
|
|
1415
1379
|
keyevent?(keycode: string, metastate?: string): Promise<void>;
|
|
1416
1380
|
|
|
@@ -1425,6 +1389,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1425
1389
|
* @param elementId - if we're rotating around an element
|
|
1426
1390
|
*
|
|
1427
1391
|
* @deprecated Use setRotation instead
|
|
1392
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1428
1393
|
*/
|
|
1429
1394
|
mobileRotation?(
|
|
1430
1395
|
x: number,
|
|
@@ -1442,6 +1407,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1442
1407
|
* @returns The activity name
|
|
1443
1408
|
*
|
|
1444
1409
|
* @deprecated
|
|
1410
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1445
1411
|
*/
|
|
1446
1412
|
getCurrentActivity?(): Promise<string>;
|
|
1447
1413
|
|
|
@@ -1451,6 +1417,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1451
1417
|
* @returns The package name
|
|
1452
1418
|
*
|
|
1453
1419
|
* @deprecated
|
|
1420
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1454
1421
|
*/
|
|
1455
1422
|
getCurrentPackage?(): Promise<string>;
|
|
1456
1423
|
|
|
@@ -1498,10 +1465,11 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1498
1465
|
*
|
|
1499
1466
|
* @param appId - the package or bundle ID of the application
|
|
1500
1467
|
*
|
|
1501
|
-
* @returns A number representing the state. 0 means not installed, 1 means not running,
|
|
1502
|
-
* running in
|
|
1468
|
+
* @returns A number representing the state. `0` means not installed, `1` means not running, `2`
|
|
1469
|
+
* means running in background but suspended, `3` means running in the background, and `4` means
|
|
1470
|
+
* running in the foreground
|
|
1503
1471
|
*/
|
|
1504
|
-
queryAppState?(appId: string): Promise<0 | 1 | 3 | 4>;
|
|
1472
|
+
queryAppState?(appId: string): Promise<0 | 1 | 2 | 3 | 4>;
|
|
1505
1473
|
|
|
1506
1474
|
/**
|
|
1507
1475
|
* Attempt to hide a virtual keyboard
|
|
@@ -1550,6 +1518,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1550
1518
|
* Toggle airplane/flight mode for the device
|
|
1551
1519
|
*
|
|
1552
1520
|
* @deprecated
|
|
1521
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1553
1522
|
*/
|
|
1554
1523
|
toggleFlightMode?(): Promise<void>;
|
|
1555
1524
|
|
|
@@ -1557,6 +1526,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1557
1526
|
* Toggle cell network data
|
|
1558
1527
|
*
|
|
1559
1528
|
* @deprecated
|
|
1529
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1560
1530
|
*/
|
|
1561
1531
|
toggleData?(): Promise<void>;
|
|
1562
1532
|
|
|
@@ -1564,6 +1534,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1564
1534
|
* Toggle WiFi radio status
|
|
1565
1535
|
*
|
|
1566
1536
|
* @deprecated
|
|
1537
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1567
1538
|
*/
|
|
1568
1539
|
toggleWiFi?(): Promise<void>;
|
|
1569
1540
|
|
|
@@ -1571,6 +1542,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1571
1542
|
* Toggle location services for the device
|
|
1572
1543
|
*
|
|
1573
1544
|
* @deprecated
|
|
1545
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1574
1546
|
*/
|
|
1575
1547
|
toggleLocationServices?(): Promise<void>;
|
|
1576
1548
|
|
|
@@ -1578,6 +1550,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1578
1550
|
* Open the notifications shade/screen
|
|
1579
1551
|
*
|
|
1580
1552
|
* @deprecated
|
|
1553
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1581
1554
|
*/
|
|
1582
1555
|
openNotifications?(): Promise<void>;
|
|
1583
1556
|
|
|
@@ -1597,6 +1570,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1597
1570
|
* activity
|
|
1598
1571
|
*
|
|
1599
1572
|
* @deprecated
|
|
1573
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1600
1574
|
*/
|
|
1601
1575
|
startActivity?(
|
|
1602
1576
|
appPackage: string,
|
|
@@ -1616,6 +1590,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1616
1590
|
* @returns An array of information objects of driver-specific shape
|
|
1617
1591
|
*
|
|
1618
1592
|
* @deprecated
|
|
1593
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1619
1594
|
*/
|
|
1620
1595
|
getSystemBars?(): Promise<unknown[]>;
|
|
1621
1596
|
|
|
@@ -1625,50 +1600,10 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1625
1600
|
* @returns The density
|
|
1626
1601
|
*
|
|
1627
1602
|
* @deprecated
|
|
1603
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1628
1604
|
*/
|
|
1629
1605
|
getDisplayDensity?(): Promise<number>;
|
|
1630
1606
|
|
|
1631
|
-
/**
|
|
1632
|
-
* Trigger a touch/fingerprint match or match failure
|
|
1633
|
-
*
|
|
1634
|
-
* @param match - whether the match should be a success or failure
|
|
1635
|
-
*
|
|
1636
|
-
* @deprecated
|
|
1637
|
-
*/
|
|
1638
|
-
touchId?(match: boolean): Promise<void>;
|
|
1639
|
-
|
|
1640
|
-
/**
|
|
1641
|
-
* Toggle whether the device is enrolled in the touch ID program
|
|
1642
|
-
*
|
|
1643
|
-
* @param enabled - whether to enable or disable the touch ID program
|
|
1644
|
-
*
|
|
1645
|
-
* @deprecated
|
|
1646
|
-
*/
|
|
1647
|
-
toggleEnrollTouchId?(enabled: boolean): Promise<void>;
|
|
1648
|
-
|
|
1649
|
-
/**
|
|
1650
|
-
* Start the session after it has been started.
|
|
1651
|
-
*
|
|
1652
|
-
* @deprecated Don't use this, it never made sense.
|
|
1653
|
-
*/
|
|
1654
|
-
launchApp?(): Promise<void>;
|
|
1655
|
-
|
|
1656
|
-
/**
|
|
1657
|
-
* Stop the session without stopping the session
|
|
1658
|
-
*
|
|
1659
|
-
* @deprecated Don't use this, it never made sense.
|
|
1660
|
-
*/
|
|
1661
|
-
closeApp?(): Promise<void>;
|
|
1662
|
-
|
|
1663
|
-
/**
|
|
1664
|
-
* Background (close) the app either permanently or for a certain amount of time
|
|
1665
|
-
*
|
|
1666
|
-
* @param seconds - the number of seconds to background the app for, or `null` for permanently
|
|
1667
|
-
*
|
|
1668
|
-
* @deprecated
|
|
1669
|
-
*/
|
|
1670
|
-
background?(seconds: null | number): Promise<void>;
|
|
1671
|
-
|
|
1672
1607
|
/**
|
|
1673
1608
|
* End platform-specific code coverage tracing
|
|
1674
1609
|
*
|
|
@@ -1676,31 +1611,10 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1676
1611
|
* @param path - the path to place the results
|
|
1677
1612
|
*
|
|
1678
1613
|
* @deprecated
|
|
1614
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1679
1615
|
*/
|
|
1680
1616
|
endCoverage?(intent: string, path: string): Promise<void>;
|
|
1681
1617
|
|
|
1682
|
-
/**
|
|
1683
|
-
* Return the language-specific strings for an app
|
|
1684
|
-
*
|
|
1685
|
-
* @param language - the language to retrieve strings for
|
|
1686
|
-
* @param stringFile - the path to the localized strings file if not in the default location
|
|
1687
|
-
*
|
|
1688
|
-
* @returns A record of localized keys to localized text
|
|
1689
|
-
*
|
|
1690
|
-
* @deprecated
|
|
1691
|
-
*/
|
|
1692
|
-
getStrings?(language?: string, stringFile?: string): Promise<Record<string, unknown>>;
|
|
1693
|
-
|
|
1694
|
-
/**
|
|
1695
|
-
* Set the value, but like, now? Don't use this.
|
|
1696
|
-
*
|
|
1697
|
-
* @param value - the value to set
|
|
1698
|
-
* @param elementId - the element to set the value of
|
|
1699
|
-
*
|
|
1700
|
-
* @deprecated
|
|
1701
|
-
*/
|
|
1702
|
-
setValueImmediate?(value: string, elementId: string): Promise<void>;
|
|
1703
|
-
|
|
1704
1618
|
/**
|
|
1705
1619
|
* Set the value of a text field but ensure the current value is replace and not appended
|
|
1706
1620
|
*
|
|
@@ -1708,93 +1622,11 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1708
1622
|
* @param elementId - the element to set it in
|
|
1709
1623
|
*
|
|
1710
1624
|
* @deprecated
|
|
1625
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1711
1626
|
*/
|
|
1712
1627
|
replaceValue?(value: string, elementId: string): Promise<void>;
|
|
1713
1628
|
|
|
1714
|
-
/**
|
|
1715
|
-
* Collect the response of an async script execution? It's unclear what this is for. Don't use
|
|
1716
|
-
* it.
|
|
1717
|
-
*
|
|
1718
|
-
* @param response - idk
|
|
1719
|
-
*
|
|
1720
|
-
* @deprecated
|
|
1721
|
-
*/
|
|
1722
|
-
receiveAsyncResponse?(response: unknown): Promise<void>;
|
|
1723
|
-
|
|
1724
|
-
/**
|
|
1725
|
-
* Set the contents of the device clipboard
|
|
1726
|
-
*
|
|
1727
|
-
* @param content - the text to set
|
|
1728
|
-
* @param contentType - the media type if not text
|
|
1729
|
-
* @param label - the label if not text
|
|
1730
|
-
*
|
|
1731
|
-
* @deprecated
|
|
1732
|
-
*/
|
|
1733
|
-
setClipboard?(content: string, contentType?: string, label?: string): Promise<void>;
|
|
1734
|
-
|
|
1735
|
-
/**
|
|
1736
|
-
* Get the contents of the device clipboard, converted into an appropriate media type
|
|
1737
|
-
*
|
|
1738
|
-
* @param contentType - the media type if not text
|
|
1739
|
-
*
|
|
1740
|
-
* @returns The text or media content (base64-encoded) of the clipboard
|
|
1741
|
-
*
|
|
1742
|
-
* @deprecated
|
|
1743
|
-
*/
|
|
1744
|
-
getClipboard?(contentType?: string): Promise<string>;
|
|
1745
|
-
|
|
1746
1629
|
// JSONWP
|
|
1747
|
-
/**
|
|
1748
|
-
* Set the async execute script timeout
|
|
1749
|
-
*
|
|
1750
|
-
* @param ms - the timeout
|
|
1751
|
-
*
|
|
1752
|
-
* @deprecated Use the W3C timeouts command instead
|
|
1753
|
-
*/
|
|
1754
|
-
asyncScriptTimeout?(ms: number): Promise<void>;
|
|
1755
|
-
|
|
1756
|
-
/**
|
|
1757
|
-
* Get the window size
|
|
1758
|
-
*
|
|
1759
|
-
* @returns The size (width and height)
|
|
1760
|
-
*
|
|
1761
|
-
* @deprecated Use getWindowRect instead
|
|
1762
|
-
*/
|
|
1763
|
-
getWindowSize?(): Promise<Size>;
|
|
1764
|
-
|
|
1765
|
-
/**
|
|
1766
|
-
* Get the position of an element on screen
|
|
1767
|
-
*
|
|
1768
|
-
* @param elementId - the element ID
|
|
1769
|
-
*
|
|
1770
|
-
* @returns The position of the element
|
|
1771
|
-
*
|
|
1772
|
-
* @deprecated Use getElementRect instead
|
|
1773
|
-
*/
|
|
1774
|
-
getLocation?(elementId: string): Promise<Position>;
|
|
1775
|
-
|
|
1776
|
-
/**
|
|
1777
|
-
* Get the position of an element on screen within a certain other view
|
|
1778
|
-
*
|
|
1779
|
-
* @param elementId - the element ID
|
|
1780
|
-
*
|
|
1781
|
-
* @returns The position of the element
|
|
1782
|
-
*
|
|
1783
|
-
* @deprecated Use getElementRect instead
|
|
1784
|
-
*/
|
|
1785
|
-
getLocationInView?(elementId: string): Promise<Position>;
|
|
1786
|
-
|
|
1787
|
-
/**
|
|
1788
|
-
* Get the size of an element
|
|
1789
|
-
*
|
|
1790
|
-
* @param elementId - the element ID
|
|
1791
|
-
*
|
|
1792
|
-
* @returns The size of the element
|
|
1793
|
-
*
|
|
1794
|
-
* @deprecated Use getElementRect instead
|
|
1795
|
-
*/
|
|
1796
|
-
getSize?(elementId: string): Promise<Size>;
|
|
1797
|
-
|
|
1798
1630
|
/**
|
|
1799
1631
|
* Check whether two elements are identical
|
|
1800
1632
|
*
|
|
@@ -1804,33 +1636,16 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1804
1636
|
* @returns True if the elements are equal, false otherwise
|
|
1805
1637
|
*
|
|
1806
1638
|
* @deprecated
|
|
1639
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1807
1640
|
*/
|
|
1808
1641
|
equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
|
|
1809
|
-
|
|
1810
|
-
/**
|
|
1811
|
-
* Submit the form an element is in
|
|
1812
|
-
*
|
|
1813
|
-
* @param elementId - the element ID
|
|
1814
|
-
*
|
|
1815
|
-
* @deprecated
|
|
1816
|
-
*/
|
|
1817
|
-
submit?(elementId: string): Promise<void>;
|
|
1818
|
-
|
|
1819
|
-
/**
|
|
1820
|
-
* Send keys to the app
|
|
1821
|
-
*
|
|
1822
|
-
* @param value: the array of keys to send
|
|
1823
|
-
*
|
|
1824
|
-
* @deprecated Use the W3C send keys method instead
|
|
1825
|
-
*/
|
|
1826
|
-
keys?(value: string[]): Promise<void>;
|
|
1827
|
-
|
|
1828
1642
|
/**
|
|
1829
1643
|
* Get the list of IME engines
|
|
1830
1644
|
*
|
|
1831
1645
|
* @returns The list of IME engines
|
|
1832
1646
|
*
|
|
1833
1647
|
* @deprecated
|
|
1648
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1834
1649
|
*/
|
|
1835
1650
|
availableIMEEngines?(): Promise<string[]>;
|
|
1836
1651
|
|
|
@@ -1840,6 +1655,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1840
1655
|
* @returns The name of the active engine
|
|
1841
1656
|
*
|
|
1842
1657
|
* @deprecated
|
|
1658
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1843
1659
|
*/
|
|
1844
1660
|
getActiveIMEEngine?(): Promise<string>;
|
|
1845
1661
|
|
|
@@ -1849,6 +1665,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1849
1665
|
* @returns True if the IME is activated
|
|
1850
1666
|
*
|
|
1851
1667
|
* @deprecated
|
|
1668
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1852
1669
|
*/
|
|
1853
1670
|
isIMEActivated?(): Promise<boolean>;
|
|
1854
1671
|
|
|
@@ -1856,6 +1673,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1856
1673
|
* Deactivate an IME engine
|
|
1857
1674
|
*
|
|
1858
1675
|
* @deprecated
|
|
1676
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1859
1677
|
*/
|
|
1860
1678
|
deactivateIMEEngine?(): Promise<void>;
|
|
1861
1679
|
|
|
@@ -1865,6 +1683,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1865
1683
|
* @param engine - the name of the engine
|
|
1866
1684
|
*
|
|
1867
1685
|
* @deprecated
|
|
1686
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1868
1687
|
*/
|
|
1869
1688
|
activateIMEEngine?(engine: string): Promise<void>;
|
|
1870
1689
|
|
|
@@ -1882,23 +1701,13 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1882
1701
|
*/
|
|
1883
1702
|
setOrientation?(orientation: string): Promise<void>;
|
|
1884
1703
|
|
|
1885
|
-
/**
|
|
1886
|
-
* Move the mouse pointer to a particular screen location
|
|
1887
|
-
*
|
|
1888
|
-
* @param element - the element ID if the move is relative to an element
|
|
1889
|
-
* @param xOffset - the x offset
|
|
1890
|
-
* @param yOffset - the y offset
|
|
1891
|
-
*
|
|
1892
|
-
* @deprecated Use the Actions API instead
|
|
1893
|
-
*/
|
|
1894
|
-
moveTo?(element?: null | string, xOffset?: number, yOffset?: number): Promise<void>;
|
|
1895
|
-
|
|
1896
1704
|
/**
|
|
1897
1705
|
* Trigger a mouse button down
|
|
1898
1706
|
*
|
|
1899
1707
|
* @param button - the button ID
|
|
1900
1708
|
*
|
|
1901
1709
|
* @deprecated Use the Actions API instead
|
|
1710
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1902
1711
|
*/
|
|
1903
1712
|
buttonDown?(button?: number): Promise<void>;
|
|
1904
1713
|
|
|
@@ -1908,6 +1717,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1908
1717
|
* @param button - the button ID
|
|
1909
1718
|
*
|
|
1910
1719
|
* @deprecated Use the Actions API instead
|
|
1720
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1911
1721
|
*/
|
|
1912
1722
|
buttonUp?(button?: number): Promise<void>;
|
|
1913
1723
|
|
|
@@ -1917,6 +1727,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1917
1727
|
* @param button - the button ID
|
|
1918
1728
|
*
|
|
1919
1729
|
* @deprecated Use the Actions API instead
|
|
1730
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1920
1731
|
*/
|
|
1921
1732
|
clickCurrent?(button?: number): Promise<void>;
|
|
1922
1733
|
|
|
@@ -1924,6 +1735,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1924
1735
|
* Double-click the current mouse location
|
|
1925
1736
|
*
|
|
1926
1737
|
* @deprecated Use the Actions API instead
|
|
1738
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1927
1739
|
*/
|
|
1928
1740
|
doubleClick?(): Promise<void>;
|
|
1929
1741
|
|
|
@@ -1934,6 +1746,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1934
1746
|
* @param y - the y coordinate
|
|
1935
1747
|
*
|
|
1936
1748
|
* @deprecated Use the Actions API instead
|
|
1749
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1937
1750
|
*/
|
|
1938
1751
|
touchDown?(x: number, y: number): Promise<void>;
|
|
1939
1752
|
|
|
@@ -1944,6 +1757,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1944
1757
|
* @param y - the y coordinate
|
|
1945
1758
|
*
|
|
1946
1759
|
* @deprecated Use the Actions API instead
|
|
1760
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1947
1761
|
*/
|
|
1948
1762
|
touchUp?(x: number, y: number): Promise<void>;
|
|
1949
1763
|
|
|
@@ -1954,6 +1768,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1954
1768
|
* @param y - the y coordinate
|
|
1955
1769
|
*
|
|
1956
1770
|
* @deprecated Use the Actions API instead
|
|
1771
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1957
1772
|
*/
|
|
1958
1773
|
touchMove?(x: number, y: number): Promise<void>;
|
|
1959
1774
|
|
|
@@ -1963,6 +1778,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1963
1778
|
* @param elementId - the id of the element to long touch
|
|
1964
1779
|
*
|
|
1965
1780
|
* @deprecated Use the Actions API instead
|
|
1781
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1966
1782
|
*/
|
|
1967
1783
|
touchLongClick?(elementId: string): Promise<void>;
|
|
1968
1784
|
|
|
@@ -1977,6 +1793,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
1977
1793
|
* @param speed - the speed (unclear how this relates to xSpeed and ySpeed)
|
|
1978
1794
|
*
|
|
1979
1795
|
* @deprecated Use the Actions API instead
|
|
1796
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
1980
1797
|
*/
|
|
1981
1798
|
flick?(
|
|
1982
1799
|
element?: string,
|
|
@@ -2017,7 +1834,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
2017
1834
|
*
|
|
2018
1835
|
* @param name - the context name
|
|
2019
1836
|
*/
|
|
2020
|
-
setContext?(name: string): Promise<void>;
|
|
1837
|
+
setContext?(name: string, ...args: any[]): Promise<void>;
|
|
2021
1838
|
|
|
2022
1839
|
/**
|
|
2023
1840
|
* Get the list of available contexts
|
|
@@ -2035,6 +1852,7 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
2035
1852
|
* @returns The page index
|
|
2036
1853
|
*
|
|
2037
1854
|
* @deprecated
|
|
1855
|
+
* @privateRemarks Not implemented in `appium-xcuitest-driver`
|
|
2038
1856
|
*/
|
|
2039
1857
|
getPageIndex?(elementId: string): Promise<string>;
|
|
2040
1858
|
|
|
@@ -2055,25 +1873,6 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
2055
1873
|
*/
|
|
2056
1874
|
setNetworkConnection?(type: number): Promise<void>;
|
|
2057
1875
|
|
|
2058
|
-
/**
|
|
2059
|
-
* Perform a set of touch actions
|
|
2060
|
-
*
|
|
2061
|
-
* @param actions - the old MJSONWP style touch action objects
|
|
2062
|
-
*
|
|
2063
|
-
* @deprecated Use the W3C Actions API instead
|
|
2064
|
-
*/
|
|
2065
|
-
performTouch?(actions: unknown): Promise<void>;
|
|
2066
|
-
|
|
2067
|
-
/**
|
|
2068
|
-
* Perform a set of touch actions
|
|
2069
|
-
*
|
|
2070
|
-
* @param actions - the old MJSONWP style touch action objects
|
|
2071
|
-
* @param elementId - the id of an element if actions are restricted to one element
|
|
2072
|
-
*
|
|
2073
|
-
* @deprecated Use the W3C Actions API instead
|
|
2074
|
-
*/
|
|
2075
|
-
performMultiAction?(actions: unknown, elementId: string): Promise<void>;
|
|
2076
|
-
|
|
2077
1876
|
/**
|
|
2078
1877
|
* Get the current rotation state of the device
|
|
2079
1878
|
* @see {@link https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md#device-rotation}
|
|
@@ -2207,11 +2006,11 @@ export interface ExternalDriver<C extends Constraints = BaseDriverCapConstraints
|
|
|
2207
2006
|
*
|
|
2208
2007
|
* This is likely unusable by external consumers, but YMMV!
|
|
2209
2008
|
*/
|
|
2210
|
-
export interface DriverStatic<
|
|
2009
|
+
export interface DriverStatic<T extends Driver> {
|
|
2211
2010
|
baseVersion: string;
|
|
2212
2011
|
updateServer?: UpdateServerCallback;
|
|
2213
|
-
newMethodMap?: MethodMap<
|
|
2214
|
-
executeMethodMap?: ExecuteMethodMap<
|
|
2012
|
+
newMethodMap?: MethodMap<T>;
|
|
2013
|
+
executeMethodMap?: ExecuteMethodMap<T>;
|
|
2215
2014
|
}
|
|
2216
2015
|
|
|
2217
2016
|
/**
|
|
@@ -2219,9 +2018,9 @@ export interface DriverStatic<D extends Driver> {
|
|
|
2219
2018
|
*
|
|
2220
2019
|
* This is likely unusable by external consumers, but YMMV!
|
|
2221
2020
|
*/
|
|
2222
|
-
export type DriverClass<
|
|
2223
|
-
|
|
2224
|
-
DriverStatic<
|
|
2021
|
+
export type DriverClass<T extends Driver = Driver> = Class<
|
|
2022
|
+
T,
|
|
2023
|
+
DriverStatic<T>,
|
|
2225
2024
|
[] | [Partial<ServerArgs>] | [Partial<ServerArgs>, boolean]
|
|
2226
2025
|
>;
|
|
2227
2026
|
|
|
@@ -2234,18 +2033,109 @@ export interface ExtraDriverOpts {
|
|
|
2234
2033
|
*
|
|
2235
2034
|
* The combination happens within Appium prior to calling the constructor.
|
|
2236
2035
|
*/
|
|
2237
|
-
export type DriverOpts<C extends Constraints
|
|
2238
|
-
ExtraDriverOpts &
|
|
2239
|
-
Partial<ConstraintsToCaps<C>>;
|
|
2036
|
+
export type DriverOpts<C extends Constraints> = ServerArgs & ExtraDriverOpts & DriverCaps<C>;
|
|
2240
2037
|
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2038
|
+
/**
|
|
2039
|
+
* An instance method of a driver class, whose name may be referenced by {@linkcode MethodDef.command}, and serves as an Appium command.
|
|
2040
|
+
*
|
|
2041
|
+
* Note that this signature differs from a `PluginCommand`.
|
|
2042
|
+
*/
|
|
2043
|
+
export type DriverCommand<TArgs extends readonly any[] = any[], TRetval = unknown> = (
|
|
2044
|
+
...args: TArgs
|
|
2045
|
+
) => Promise<TRetval>;
|
|
2247
2046
|
|
|
2248
2047
|
/**
|
|
2249
2048
|
* Tuple of an HTTP method with a regex matching a request path
|
|
2250
2049
|
*/
|
|
2251
2050
|
export type RouteMatcher = [HTTPMethod, RegExp];
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* Result of the {@linkcode onPostProcess ConfigureAppOptions.onPostProcess} callback.
|
|
2054
|
+
*/
|
|
2055
|
+
export interface PostProcessResult {
|
|
2056
|
+
/**
|
|
2057
|
+
* The full past to the post-processed application package on the local file system .
|
|
2058
|
+
*
|
|
2059
|
+
* This might be a file or a folder path.
|
|
2060
|
+
*/
|
|
2061
|
+
appPath: string;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
/**
|
|
2065
|
+
* Information about a cached app instance.
|
|
2066
|
+
*/
|
|
2067
|
+
export interface CachedAppInfo {
|
|
2068
|
+
/**
|
|
2069
|
+
* SHA1 hash of the package if it is a file (and not a folder)
|
|
2070
|
+
*/
|
|
2071
|
+
packageHash: string;
|
|
2072
|
+
/**
|
|
2073
|
+
* Date instance; the value of the file's `Last-Modified` header
|
|
2074
|
+
*/
|
|
2075
|
+
lastModified?: Date;
|
|
2076
|
+
/**
|
|
2077
|
+
* `true` if the file contains an `immutable` mark in `Cache-control` header
|
|
2078
|
+
*/
|
|
2079
|
+
immutable?: boolean;
|
|
2080
|
+
/**
|
|
2081
|
+
* Integer representation of `maxAge` parameter in `Cache-control` header
|
|
2082
|
+
*/
|
|
2083
|
+
maxAge?: number;
|
|
2084
|
+
/**
|
|
2085
|
+
* The timestamp this item has been added to the cache (measured in Unix epoch milliseconds)
|
|
2086
|
+
*/
|
|
2087
|
+
timestamp?: number;
|
|
2088
|
+
/**
|
|
2089
|
+
* An object containing either `file` property with SHA1 hash of the file or `folder` property
|
|
2090
|
+
* with total amount of cached files and subfolders
|
|
2091
|
+
*/
|
|
2092
|
+
integrity?: {file?: string} | {folder?: number};
|
|
2093
|
+
/**
|
|
2094
|
+
* The full path to the cached app
|
|
2095
|
+
*/
|
|
2096
|
+
fullPath?: string;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
/**
|
|
2100
|
+
* Options for the post-processing step
|
|
2101
|
+
*
|
|
2102
|
+
* The generic can be supplied if using `axios`, where `headers` is a fancy object.
|
|
2103
|
+
*/
|
|
2104
|
+
export interface PostProcessOptions<Headers = HTTPHeaders> {
|
|
2105
|
+
/**
|
|
2106
|
+
* The information about the previously cached app instance (if exists)
|
|
2107
|
+
*/
|
|
2108
|
+
cachedAppInfo?: CachedAppInfo;
|
|
2109
|
+
/**
|
|
2110
|
+
* Whether the app has been downloaded from a remote URL
|
|
2111
|
+
*/
|
|
2112
|
+
isUrl?: boolean;
|
|
2113
|
+
/**
|
|
2114
|
+
* Optional headers object.
|
|
2115
|
+
*
|
|
2116
|
+
* Only present if `isUrl` is `true` and if the server responds to `HEAD` requests. All header names are normalized to lowercase.
|
|
2117
|
+
*/
|
|
2118
|
+
headers?: Headers;
|
|
2119
|
+
/**
|
|
2120
|
+
* A string containing full path to the preprocessed application package (either downloaded or a local one)
|
|
2121
|
+
*/
|
|
2122
|
+
appPath?: string;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2125
|
+
export interface ConfigureAppOptions {
|
|
2126
|
+
/**
|
|
2127
|
+
*
|
|
2128
|
+
* Optional function, which should be applied to the application after it is
|
|
2129
|
+
* downloaded/preprocessed.
|
|
2130
|
+
*
|
|
2131
|
+
* This function may be async and is expected to accept single object parameter. The function is
|
|
2132
|
+
* expected to either return a falsy value, which means the app must not be cached and a fresh
|
|
2133
|
+
* copy of it is downloaded each time, _or_ if this function returns an object containing an
|
|
2134
|
+
* `appPath` property, then the integrity of it will be verified and stored into the cache.
|
|
2135
|
+
* @returns
|
|
2136
|
+
*/
|
|
2137
|
+
onPostProcess?: (
|
|
2138
|
+
obj: PostProcessOptions
|
|
2139
|
+
) => Promise<PostProcessResult | undefined> | PostProcessResult | undefined;
|
|
2140
|
+
supportedExtensions: string[];
|
|
2141
|
+
}
|