@appium/types 0.1.0
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 +201 -0
- package/README.md +21 -0
- package/build/appium-config.d.ts +175 -0
- package/build/appium-config.d.ts.map +1 -0
- package/build/capabilities.d.ts +47 -0
- package/build/capabilities.d.ts.map +1 -0
- package/build/config.d.ts +80 -0
- package/build/config.d.ts.map +1 -0
- package/build/index.d.ts +422 -0
- package/build/index.d.ts.map +1 -0
- package/lib/appium-config.ts +197 -0
- package/lib/capabilities.ts +60 -0
- package/lib/config.ts +128 -0
- package/lib/index.ts +623 -0
- package/package.json +43 -0
package/lib/index.ts
ADDED
|
@@ -0,0 +1,623 @@
|
|
|
1
|
+
import type { Method as _Method } from 'axios';
|
|
2
|
+
import type { EventEmitter } from 'events';
|
|
3
|
+
import type { Server } from 'http';
|
|
4
|
+
import type { Logger } from 'npmlog';
|
|
5
|
+
import type { Class as _Class, MultidimensionalReadonlyArray } from 'type-fest';
|
|
6
|
+
import { DriverOpts } from './config';
|
|
7
|
+
import { Capabilities, W3CCapabilities } from './capabilities';
|
|
8
|
+
|
|
9
|
+
export { AppiumW3CCapabilities } from './capabilities';
|
|
10
|
+
export { AppiumConfig, NormalizedAppiumConfig } from './config';
|
|
11
|
+
export * from './appium-config';
|
|
12
|
+
export { DriverOpts, Capabilities, W3CCapabilities };
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Methods and properties which both `AppiumDriver` and `BaseDriver` inherit.
|
|
16
|
+
*/
|
|
17
|
+
export interface Core {
|
|
18
|
+
sessionId: string | null;
|
|
19
|
+
opts: DriverOpts;
|
|
20
|
+
initialOpts: DriverOpts;
|
|
21
|
+
caps?: Capabilities;
|
|
22
|
+
originalCaps?: W3CCapabilities;
|
|
23
|
+
protocol?: string;
|
|
24
|
+
helpers: DriverHelpers;
|
|
25
|
+
basePath: string;
|
|
26
|
+
relaxedSecurityEnabled: boolean;
|
|
27
|
+
allowInsecure: string[];
|
|
28
|
+
denyInsecure: string[];
|
|
29
|
+
newCommandTimeoutMs: number;
|
|
30
|
+
implicitWaitMs: number;
|
|
31
|
+
locatorStrategies: string[];
|
|
32
|
+
webLocatorStrategies: string[];
|
|
33
|
+
eventEmitter: EventEmitter;
|
|
34
|
+
settings: DeviceSettings;
|
|
35
|
+
log: AppiumLogger;
|
|
36
|
+
driverData?: DriverData;
|
|
37
|
+
isCommandsQueueEnabled: boolean;
|
|
38
|
+
eventHistory: EventHistory;
|
|
39
|
+
desiredCapConstraints: Constraints;
|
|
40
|
+
onUnexpectedShutdown(handler: () => any): void;
|
|
41
|
+
getStatus(): Promise<unknown>;
|
|
42
|
+
logExtraCaps(caps: Capabilities): void;
|
|
43
|
+
sessionExists(sessionId: string): boolean;
|
|
44
|
+
validateDesiredCaps(caps: Capabilities): boolean;
|
|
45
|
+
isW3CProtocol(): boolean;
|
|
46
|
+
isMjsonwpProtocol(): boolean;
|
|
47
|
+
isFeatureEnabled(name: string): boolean;
|
|
48
|
+
ensureFeatureEnabled(name: string): void;
|
|
49
|
+
validateLocatorStrategy(strategy: string, webContext?: boolean): void;
|
|
50
|
+
proxyActive(sessionId?: string): boolean;
|
|
51
|
+
getProxyAvoidList(sessionId?: string): [string, RegExp][];
|
|
52
|
+
canProxy(sessionId?: string): boolean;
|
|
53
|
+
proxyRouteIsAvoided(sessionId: string, method: string, url: string): boolean;
|
|
54
|
+
addManagedDriver(driver: Driver): void;
|
|
55
|
+
getManagedDrivers(): Driver[];
|
|
56
|
+
clearNewCommandTimeout(): Promise<void>;
|
|
57
|
+
logEvent(eventName: string): void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface Driver
|
|
61
|
+
extends SessionCommands,
|
|
62
|
+
LogCommands,
|
|
63
|
+
FindCommands,
|
|
64
|
+
SettingsCommands,
|
|
65
|
+
TimeoutCommands,
|
|
66
|
+
EventCommands,
|
|
67
|
+
SessionHandler<[string, any], void>,
|
|
68
|
+
Core {
|
|
69
|
+
// The following methods are implemented by `BaseDriver`.
|
|
70
|
+
executeCommand(cmd: string, ...args: any[]): Promise<any>;
|
|
71
|
+
startUnexpectedShutdown(err?: Error): Promise<void>;
|
|
72
|
+
startNewCommandTimeout(): Promise<void>;
|
|
73
|
+
reset(): Promise<void>;
|
|
74
|
+
|
|
75
|
+
assignServer(
|
|
76
|
+
server: AppiumServer,
|
|
77
|
+
host: string,
|
|
78
|
+
port: number,
|
|
79
|
+
path: string,
|
|
80
|
+
): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* External drivers must subclass `BaseDriver`, and can implement any of these methods.
|
|
85
|
+
* None of these are implemented within Appium itself.
|
|
86
|
+
*/
|
|
87
|
+
export interface ExternalDriver extends Driver {
|
|
88
|
+
// The following properties are assigned by appium */
|
|
89
|
+
readonly server: AppiumServer;
|
|
90
|
+
readonly serverHost: string;
|
|
91
|
+
readonly serverPort: number;
|
|
92
|
+
readonly serverPath: string;
|
|
93
|
+
|
|
94
|
+
// WebDriver
|
|
95
|
+
setUrl?(url: string): Promise<void>;
|
|
96
|
+
getUrl?(): Promise<string>;
|
|
97
|
+
back?(): Promise<void>;
|
|
98
|
+
forward?(): Promise<void>;
|
|
99
|
+
refresh?(): Promise<void>;
|
|
100
|
+
title?(): Promise<string>;
|
|
101
|
+
getWindowHandle?(): Promise<string>;
|
|
102
|
+
closeWindow?(): Promise<string[]>;
|
|
103
|
+
setWindow?(handle: string): Promise<void>;
|
|
104
|
+
getWindowHandles?(): Promise<string[]>;
|
|
105
|
+
setFrame?(id: null | number | string): Promise<void>;
|
|
106
|
+
getWindowRect?(): Promise<Rect>;
|
|
107
|
+
setWindowRect?(
|
|
108
|
+
x: number,
|
|
109
|
+
y: number,
|
|
110
|
+
width: number,
|
|
111
|
+
height: number,
|
|
112
|
+
): Promise<Rect>;
|
|
113
|
+
maximizeWindow?(): Promise<Rect>;
|
|
114
|
+
minimizeWindow?(): Promise<Rect>;
|
|
115
|
+
fullScreenWindow?(): Promise<Rect>;
|
|
116
|
+
active?(): Promise<Element>;
|
|
117
|
+
elementSelected?(elementId: string): Promise<boolean>;
|
|
118
|
+
getAttribute?(name: string, elementId: string): Promise<string | null>;
|
|
119
|
+
getProperty?(name: string, elementId: string): Promise<string | null>;
|
|
120
|
+
getCssProperty?(name: string, elementId: string): Promise<string>;
|
|
121
|
+
getText?(elementId: string): Promise<string>;
|
|
122
|
+
getName?(elementId: string): Promise<string>;
|
|
123
|
+
getElementRect?(elementId: string): Promise<Rect>;
|
|
124
|
+
elementEnabled?(elementId: string): Promise<boolean>;
|
|
125
|
+
elementDisplayed?(elementId: string): Promise<boolean>;
|
|
126
|
+
click?(elementId: string): Promise<void>;
|
|
127
|
+
clear?(elementId: string): Promise<void>;
|
|
128
|
+
setValue?(text: string, elementId: string): Promise<void>;
|
|
129
|
+
execute?(script: string, args: unknown[]): Promise<unknown>;
|
|
130
|
+
executeAsync?(script: string, args: unknown[]): Promise<unknown>;
|
|
131
|
+
getCookies?(): Promise<Cookie[]>;
|
|
132
|
+
getCookie?(name: string): Promise<Cookie>;
|
|
133
|
+
setCookie?(cookie: Cookie): Promise<void>;
|
|
134
|
+
deleteCookie?(name: string): Promise<void>;
|
|
135
|
+
deleteCookies?(): Promise<void>;
|
|
136
|
+
performActions?(actions: Actions[]): Promise<void>;
|
|
137
|
+
releaseActions?(): Promise<void>;
|
|
138
|
+
postDismissAlert?(): Promise<void>;
|
|
139
|
+
postAcceptAlert?(): Promise<void>;
|
|
140
|
+
getAlertText?(): Promise<string | null>;
|
|
141
|
+
setAlertText?(text: string): Promise<void>;
|
|
142
|
+
getScreenshot?(): Promise<string>;
|
|
143
|
+
getElementScreenshot?(elementId: string): Promise<string>;
|
|
144
|
+
|
|
145
|
+
// Appium W3C WebDriver Extension
|
|
146
|
+
mobileShake?(): Promise<void>;
|
|
147
|
+
getDeviceTime?(format?: string): Promise<string>;
|
|
148
|
+
lock?(seconds?: number): Promise<void>;
|
|
149
|
+
unlock?(): Promise<void>;
|
|
150
|
+
isLocked?(): Promise<boolean>;
|
|
151
|
+
startRecordingScreen?(options?: ScreenRecordOptions): Promise<void>;
|
|
152
|
+
stopRecordingScreen?(options?: ScreenRecordOptions): Promise<string>;
|
|
153
|
+
getPerformanceDataTypes?(): Promise<string[]>;
|
|
154
|
+
getPerformanceData?(
|
|
155
|
+
packageName: string,
|
|
156
|
+
dataType: string,
|
|
157
|
+
dataReadTimeout?: number,
|
|
158
|
+
): Promise<string[]>;
|
|
159
|
+
pressKeyCode?(
|
|
160
|
+
keycode: number,
|
|
161
|
+
metastate?: number,
|
|
162
|
+
flags?: number,
|
|
163
|
+
): Promise<void>;
|
|
164
|
+
longPressKeyCode?(
|
|
165
|
+
keycode: number,
|
|
166
|
+
metastate?: number,
|
|
167
|
+
flags?: number,
|
|
168
|
+
): Promise<void>;
|
|
169
|
+
fingerprint?(fingerprintId: number): Promise<void>;
|
|
170
|
+
sendSMS?(phoneNumber: string, message: string): Promise<void>;
|
|
171
|
+
gsmCall?(phoneNumber: string, action: string): Promise<void>;
|
|
172
|
+
gsmSignal?(signalStrength: string): Promise<void>;
|
|
173
|
+
gsmVoice?(state: string): Promise<void>;
|
|
174
|
+
powerCapacity?(percent: number): Promise<void>;
|
|
175
|
+
powerAC?(state: string): Promise<void>;
|
|
176
|
+
networkSpeed?(netspeed: string): Promise<void>;
|
|
177
|
+
keyevent?(keycode: string, metastate?: string): Promise<void>;
|
|
178
|
+
mobileRotation?(
|
|
179
|
+
x: number,
|
|
180
|
+
y: number,
|
|
181
|
+
radius: number,
|
|
182
|
+
rotation: number,
|
|
183
|
+
touchCount: number,
|
|
184
|
+
duration: string,
|
|
185
|
+
elementId?: string,
|
|
186
|
+
): Promise<void>;
|
|
187
|
+
getCurrentActivity?(): Promise<string>;
|
|
188
|
+
getCurrentPackage?(): Promise<string>;
|
|
189
|
+
installApp?(appPath: string, options?: unknown): Promise<void>;
|
|
190
|
+
activateApp?(appId: string, options?: unknown): Promise<void>;
|
|
191
|
+
removeApp?(appId: string, options?: unknown): Promise<void>;
|
|
192
|
+
terminateApp?(appId: string, options?: unknown): Promise<void>;
|
|
193
|
+
isAppInstalled?(appId: string): Promise<boolean>;
|
|
194
|
+
queryAppState?(appId: string): Promise<number>;
|
|
195
|
+
hideKeyboard?(
|
|
196
|
+
strategy?: string,
|
|
197
|
+
key?: string,
|
|
198
|
+
keyCode?: string,
|
|
199
|
+
keyName?: string,
|
|
200
|
+
): Promise<void>;
|
|
201
|
+
isKeyboardShown?(): Promise<boolean>;
|
|
202
|
+
pushFile?(path: string, data: string): Promise<void>;
|
|
203
|
+
pullFile?(path: string): Promise<string>;
|
|
204
|
+
pullFolder?(path: string): Promise<string>;
|
|
205
|
+
toggleFlightMode?(): Promise<void>;
|
|
206
|
+
toggleData?(): Promise<void>;
|
|
207
|
+
toggleWiFi?(): Promise<void>;
|
|
208
|
+
toggleLocationServices?(): Promise<void>;
|
|
209
|
+
openNotifications?(): Promise<void>;
|
|
210
|
+
startActivity?(
|
|
211
|
+
appPackage: string,
|
|
212
|
+
appActivity: string,
|
|
213
|
+
appWaitPackage?: string,
|
|
214
|
+
appWaitActivity?: string,
|
|
215
|
+
intentAction?: string,
|
|
216
|
+
intentCategory?: string,
|
|
217
|
+
intentFlags?: string,
|
|
218
|
+
optionalIntentArguments?: string,
|
|
219
|
+
dontStopAppOnReset?: boolean,
|
|
220
|
+
): Promise<void>;
|
|
221
|
+
getSystemBars?(): Promise<unknown[]>;
|
|
222
|
+
getDisplayDensity?(): Promise<number>;
|
|
223
|
+
touchId?(match: boolean): Promise<void>;
|
|
224
|
+
toggleEnrollTouchId?(enabled: boolean): Promise<void>;
|
|
225
|
+
launchApp?(): Promise<void>;
|
|
226
|
+
closeApp?(): Promise<void>;
|
|
227
|
+
background?(seconds: null | number): Promise<void>;
|
|
228
|
+
endCoverage?(intent: string, path: string): Promise<void>;
|
|
229
|
+
getStrings?(
|
|
230
|
+
language?: string,
|
|
231
|
+
stringFile?: string,
|
|
232
|
+
): Promise<Record<string, unknown>>;
|
|
233
|
+
setValueImmediate?(value: string, elementId: string): Promise<void>;
|
|
234
|
+
replaceValue?(value: string, elementId: string): Promise<void>;
|
|
235
|
+
receiveAsyncResponse?(response: unknown): Promise<void>;
|
|
236
|
+
setClipboard?(
|
|
237
|
+
content: string,
|
|
238
|
+
contentType?: string,
|
|
239
|
+
label?: string,
|
|
240
|
+
): Promise<void>;
|
|
241
|
+
getClipboard?(contentType?: string): Promise<string>;
|
|
242
|
+
|
|
243
|
+
// JSONWP
|
|
244
|
+
asyncScriptTimeout?(ms: number): Promise<void>;
|
|
245
|
+
getWindowSize?(): Promise<Size>;
|
|
246
|
+
getLocation?(elementId: string): Promise<Position>;
|
|
247
|
+
getLocationInView?(elementId: string): Promise<Position>;
|
|
248
|
+
getSize?(elementId: string): Promise<Size>;
|
|
249
|
+
elementShadowRoot?(elementId: string): Promise<Element>;
|
|
250
|
+
findElementFromShadowRoot?(
|
|
251
|
+
strategy: string,
|
|
252
|
+
selector: string,
|
|
253
|
+
shadowId: string
|
|
254
|
+
): Promise<Element>;
|
|
255
|
+
findElementsFromShadowRoot?(
|
|
256
|
+
strategy: string,
|
|
257
|
+
selector: string,
|
|
258
|
+
shadowId: string
|
|
259
|
+
): Promise<Element[]>;
|
|
260
|
+
equalsElement?(elementId: string, otherElementId: string): Promise<boolean>;
|
|
261
|
+
submit?(elementId: string): Promise<void>;
|
|
262
|
+
keys?(value: string[]): Promise<void>;
|
|
263
|
+
availableIMEEngines?(): Promise<string[]>;
|
|
264
|
+
getActiveIMEEngine?(): Promise<string>;
|
|
265
|
+
isIMEActivated?(): Promise<boolean>;
|
|
266
|
+
deactivateIMEEngine?(): Promise<void>;
|
|
267
|
+
activateIMEEngine?(engine: string): Promise<void>;
|
|
268
|
+
getOrientation?(): Promise<string>;
|
|
269
|
+
setOrientation?(orientation: string): Promise<void>;
|
|
270
|
+
moveTo?(
|
|
271
|
+
element?: null | string,
|
|
272
|
+
xOffset?: number,
|
|
273
|
+
yOffset?: number,
|
|
274
|
+
): Promise<void>;
|
|
275
|
+
buttonDown?(button?: number): Promise<void>;
|
|
276
|
+
buttonUp?(button?: number): Promise<void>;
|
|
277
|
+
clickCurrent?(button?: number): Promise<void>;
|
|
278
|
+
doubleClick?(): Promise<void>;
|
|
279
|
+
touchDown?(x: number, y: number): Promise<void>;
|
|
280
|
+
touchUp?(x: number, y: number): Promise<void>;
|
|
281
|
+
touchMove?(x: number, y: number): Promise<void>;
|
|
282
|
+
touchLongClick?(elementId: string): Promise<void>;
|
|
283
|
+
flick?(
|
|
284
|
+
element?: string,
|
|
285
|
+
xSpeed?: number,
|
|
286
|
+
ySpeed?: number,
|
|
287
|
+
xOffset?: number,
|
|
288
|
+
yOffset?: number,
|
|
289
|
+
speed?: number,
|
|
290
|
+
): Promise<void>;
|
|
291
|
+
getGeoLocation?(): Promise<Location>;
|
|
292
|
+
setGeoLocation?(location: Partial<Location>): Promise<void>;
|
|
293
|
+
|
|
294
|
+
// MJSONWIRE
|
|
295
|
+
getCurrentContext?(): Promise<string | null>;
|
|
296
|
+
setContext?(name: string): Promise<void>;
|
|
297
|
+
getContexts?(): Promise<string[]>;
|
|
298
|
+
getPageIndex?(elementId: string): Promise<string>;
|
|
299
|
+
getNetworkConnection?(): Promise<number>;
|
|
300
|
+
setNetworkConnection?(type: number): Promise<void>;
|
|
301
|
+
performTouch?(actions: unknown): Promise<void>;
|
|
302
|
+
performMultiAction?(actions: unknown, elementId: string): Promise<void>;
|
|
303
|
+
getRotation?(): Promise<Rotation>;
|
|
304
|
+
setRotation?(x: number, y: number, z: number): Promise<void>;
|
|
305
|
+
|
|
306
|
+
// Chromium DevTools
|
|
307
|
+
executeCdp?(cmd: string, params: unknown): Promise<unknown>;
|
|
308
|
+
|
|
309
|
+
// Web Authentication
|
|
310
|
+
addVirtualAuthenticator?(
|
|
311
|
+
protocol: string,
|
|
312
|
+
transport: string,
|
|
313
|
+
hasResidentKey?: boolean,
|
|
314
|
+
hasUserVerification?: boolean,
|
|
315
|
+
isUserConsenting?: boolean,
|
|
316
|
+
isUserVerified?: boolean,
|
|
317
|
+
): Promise<void>;
|
|
318
|
+
removeVirtualAuthenticator?(): Promise<void>;
|
|
319
|
+
addAuthCredential?(
|
|
320
|
+
credentialId: string,
|
|
321
|
+
isResidentCredential: boolean,
|
|
322
|
+
rpId: string,
|
|
323
|
+
privateKey: string,
|
|
324
|
+
userHandle?: string,
|
|
325
|
+
signCount?: number,
|
|
326
|
+
): Promise<void>;
|
|
327
|
+
getAuthCredential?(): Promise<Credential[]>;
|
|
328
|
+
removeAllAuthCredentials?(): Promise<void>;
|
|
329
|
+
removeAuthCredential?(): Promise<void>;
|
|
330
|
+
setUserAuthVerified?(isUserVerified: boolean): Promise<void>;
|
|
331
|
+
|
|
332
|
+
proxyCommand?(
|
|
333
|
+
url: string,
|
|
334
|
+
method: HTTPMethod,
|
|
335
|
+
body?: string,
|
|
336
|
+
): Promise<unknown>;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface Method<T extends ExternalDriver = ExternalDriver> {
|
|
340
|
+
command?: keyof T; // T[keyof T] needs to return a Promise.
|
|
341
|
+
neverProxy?: boolean;
|
|
342
|
+
payloadParams?: PayloadParams;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export interface PayloadParams {
|
|
346
|
+
wrap?: string;
|
|
347
|
+
unwrap?: string;
|
|
348
|
+
required?: Readonly<string[]> | MultidimensionalReadonlyArray<string, 2>;
|
|
349
|
+
optional?: Readonly<string[]> | MultidimensionalReadonlyArray<string, 2>;
|
|
350
|
+
validate?: (obj: any, protocol: string) => boolean | string | undefined;
|
|
351
|
+
makeArgs?: (obj: any) => any;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export type MethodMap<T extends ExternalDriver = ExternalDriver> = Record<string, Record<string, Method<T>>>;
|
|
355
|
+
|
|
356
|
+
export interface Constraint {
|
|
357
|
+
presence?: boolean | {allowEmpty: boolean};
|
|
358
|
+
isString?: boolean;
|
|
359
|
+
isNumber?: boolean;
|
|
360
|
+
isBoolean?: boolean;
|
|
361
|
+
isObject?: boolean;
|
|
362
|
+
isArray?: boolean;
|
|
363
|
+
deprecated?: boolean;
|
|
364
|
+
inclusion?: any[];
|
|
365
|
+
}
|
|
366
|
+
export type Constraints = Record<string, Constraint>;
|
|
367
|
+
|
|
368
|
+
export interface Element {
|
|
369
|
+
'element-6066-11e4-a52e-4f735466cecf': string;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export interface DriverHelpers {
|
|
373
|
+
configureApp: (
|
|
374
|
+
app: string,
|
|
375
|
+
supportedAppExtensions: string[],
|
|
376
|
+
) => Promise<string>;
|
|
377
|
+
isPackageOrBundle: (app: string) => boolean;
|
|
378
|
+
duplicateKeys: <T>(input: T, firstKey: string, secondKey: string) => T;
|
|
379
|
+
parseCapsArray: (cap: string | string[]) => string[];
|
|
380
|
+
generateDriverLogPrefix: (obj: Core, sessionId?: string) => string;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export type SettingsUpdateListener<
|
|
384
|
+
T extends Record<string, unknown> = Record<string, unknown>,
|
|
385
|
+
> = (prop: keyof T, newValue: unknown, curValue: unknown) => Promise<void>;
|
|
386
|
+
|
|
387
|
+
export interface DeviceSettings<
|
|
388
|
+
T extends Record<string, unknown> = Record<string, unknown>,
|
|
389
|
+
> {
|
|
390
|
+
update(newSettings: T): Promise<void>;
|
|
391
|
+
getSettings(): T;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface LogType<TDriver, LogEntry = string> {
|
|
395
|
+
description: string;
|
|
396
|
+
getter: (driver: TDriver) => Promise<LogEntry[]>;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// WebDriver
|
|
400
|
+
|
|
401
|
+
export interface Rect {
|
|
402
|
+
x: number;
|
|
403
|
+
y: number;
|
|
404
|
+
width: number;
|
|
405
|
+
height: number;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export interface Cookie {
|
|
409
|
+
name: string;
|
|
410
|
+
value: string;
|
|
411
|
+
path?: string;
|
|
412
|
+
domain?: string;
|
|
413
|
+
secure?: boolean;
|
|
414
|
+
httpOnly?: boolean;
|
|
415
|
+
expiry?: number;
|
|
416
|
+
sameSite?: 'Lax' | 'Strict';
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export interface Actions {
|
|
420
|
+
type?: string;
|
|
421
|
+
actions: Action[];
|
|
422
|
+
parameters?: {
|
|
423
|
+
pointerType?: string;
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export interface Action {
|
|
428
|
+
duration?: number;
|
|
429
|
+
type: string;
|
|
430
|
+
value?: string;
|
|
431
|
+
x?: number;
|
|
432
|
+
y?: number;
|
|
433
|
+
button?: number;
|
|
434
|
+
origin?: string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
// Appium W3C WebDriver Extension
|
|
438
|
+
|
|
439
|
+
export interface ScreenRecordOptions {
|
|
440
|
+
remotePath?: string;
|
|
441
|
+
username?: string;
|
|
442
|
+
password?: string;
|
|
443
|
+
method?: string;
|
|
444
|
+
forceRestart?: boolean;
|
|
445
|
+
timeLimit?: string;
|
|
446
|
+
videoType?: string;
|
|
447
|
+
videoQuality?: string;
|
|
448
|
+
videoFps?: string;
|
|
449
|
+
videoScale?: string;
|
|
450
|
+
bitRate?: string;
|
|
451
|
+
videoSize?: string;
|
|
452
|
+
bugReport?: string;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// JSONWP
|
|
456
|
+
|
|
457
|
+
export type Size = Pick<Rect, 'width' | 'height'>;
|
|
458
|
+
|
|
459
|
+
export type Position = Pick<Rect, 'x' | 'y'>;
|
|
460
|
+
|
|
461
|
+
export interface Location {
|
|
462
|
+
latitude: number;
|
|
463
|
+
longitude: number;
|
|
464
|
+
altitude: number;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export interface Rotation {
|
|
468
|
+
x: number;
|
|
469
|
+
y: number;
|
|
470
|
+
z: number;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
// Web Authentication
|
|
474
|
+
|
|
475
|
+
export interface Credential {
|
|
476
|
+
credentialId: string;
|
|
477
|
+
isResidentCredential: boolean;
|
|
478
|
+
rpId: string;
|
|
479
|
+
privateKey: string;
|
|
480
|
+
userHandle?: string;
|
|
481
|
+
signCount: number;
|
|
482
|
+
largeBlob?: string;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
export interface EventHistory {
|
|
486
|
+
commands: EventHistoryCommand[];
|
|
487
|
+
[key: string]: any;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface EventHistoryCommand {
|
|
491
|
+
cmd: string;
|
|
492
|
+
startTime: number;
|
|
493
|
+
endTime: number;
|
|
494
|
+
}
|
|
495
|
+
export type HTTPMethod = _Method;
|
|
496
|
+
|
|
497
|
+
export type Prefix = string|(() => string);
|
|
498
|
+
|
|
499
|
+
export interface AppiumLogger {
|
|
500
|
+
unwrap(): Logger;
|
|
501
|
+
level: string;
|
|
502
|
+
levels: string[];
|
|
503
|
+
prefix?: Prefix,
|
|
504
|
+
debug: (...args: any[]) => void;
|
|
505
|
+
info: (...args: any[]) => void;
|
|
506
|
+
warn: (...args: any[]) => void;
|
|
507
|
+
error: (...args: any[]) => void;
|
|
508
|
+
verbose: (...args: any[]) => void;
|
|
509
|
+
silly: (...args: any[]) => void;
|
|
510
|
+
http: (...args: any[]) => void;
|
|
511
|
+
errorAndThrow: (...args: any[]) => never;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
export type AppiumServer = Server & {
|
|
515
|
+
close: () => Promise<void>;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
export interface TimeoutCommands {
|
|
519
|
+
timeouts(
|
|
520
|
+
type: string,
|
|
521
|
+
ms: number | string,
|
|
522
|
+
script?: number,
|
|
523
|
+
pageLoad?: number,
|
|
524
|
+
implicit?: number | string,
|
|
525
|
+
): Promise<void>;
|
|
526
|
+
setNewCommandTimeout(ms: number): void;
|
|
527
|
+
implicitWait(ms: number | string): Promise<void>;
|
|
528
|
+
setImplicitWait(ms: number): void;
|
|
529
|
+
implicitWaitForCondition(condition: () => Promise<any>): Promise<unknown>;
|
|
530
|
+
getTimeouts(): Promise<Record<string, number>>;
|
|
531
|
+
implicitWaitW3C(ms: number): Promise<void>;
|
|
532
|
+
implicitWaitMJSONWP(ms: number): Promise<void>;
|
|
533
|
+
pageLoadTimeoutW3C(ms: number): Promise<void>;
|
|
534
|
+
pageLoadTimeoutMJSONWP(ms: number): Promise<void>;
|
|
535
|
+
scriptTimeoutW3C(ms: number): Promise<void>;
|
|
536
|
+
scriptTimeoutMJSONWP(ms: number): Promise<void>;
|
|
537
|
+
newCommandTimeout(ms: number): Promise<void>;
|
|
538
|
+
parseTimeoutArgument(ms: number | string): number;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
export interface EventCommands {
|
|
542
|
+
logCustomEvent(vendor: string, event: string): Promise<void>;
|
|
543
|
+
getLogEvents(type?: string | string[]): Promise<EventHistory | Record<string, number>>;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
export interface SessionCommands {
|
|
547
|
+
getSessions(): Promise<MultiSessionData[]>;
|
|
548
|
+
getSession(): Promise<SingularSessionData>;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
export interface MultiSessionData {
|
|
552
|
+
id: string;
|
|
553
|
+
capabilities: Capabilities;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
export type SingularSessionData = Capabilities & {events?: EventHistory};
|
|
557
|
+
|
|
558
|
+
export interface FindCommands {
|
|
559
|
+
findElement(strategy: string, selector: string): Promise<Element>;
|
|
560
|
+
findElements(strategy: string, selector: string): Promise<Element[]>;
|
|
561
|
+
findElementFromElement(
|
|
562
|
+
strategy: string,
|
|
563
|
+
selector: string,
|
|
564
|
+
elementId: string,
|
|
565
|
+
): Promise<Element>;
|
|
566
|
+
findElementsFromElement(
|
|
567
|
+
strategy: string,
|
|
568
|
+
selector: string,
|
|
569
|
+
elementId: string,
|
|
570
|
+
): Promise<Element[]>;
|
|
571
|
+
|
|
572
|
+
findElOrEls<Mult extends boolean>(
|
|
573
|
+
strategy: string,
|
|
574
|
+
selector: string,
|
|
575
|
+
mult: Mult,
|
|
576
|
+
context?: string,
|
|
577
|
+
): Promise<Mult extends true ? Element[] : Element>;
|
|
578
|
+
|
|
579
|
+
findElOrElsWithProcessing<Mult extends boolean>(
|
|
580
|
+
strategy: string,
|
|
581
|
+
selector: string,
|
|
582
|
+
mult: Mult,
|
|
583
|
+
context?: string,
|
|
584
|
+
): Promise<Mult extends true ? Element[] : Element>;
|
|
585
|
+
|
|
586
|
+
getPageSource(): Promise<string>;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
export interface LogCommands {
|
|
590
|
+
supportedLogTypes: Record<string, LogType<Driver>>;
|
|
591
|
+
getLogTypes(): Promise<string[]>;
|
|
592
|
+
getLog<T>(logType: LogType<T>): Promise<any[]>;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export interface SettingsCommands {
|
|
596
|
+
updateSettings: (settings: Record<string, any>) => Promise<void>;
|
|
597
|
+
getSettings(): Promise<Record<string, any>>;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
export interface SessionHandler<CreateResult, DeleteResult> {
|
|
601
|
+
createSession(
|
|
602
|
+
w3cCaps1: W3CCapabilities,
|
|
603
|
+
w3cCaps2?: W3CCapabilities,
|
|
604
|
+
w3cCaps?: W3CCapabilities,
|
|
605
|
+
driverData?: DriverData[],
|
|
606
|
+
): Promise<CreateResult>;
|
|
607
|
+
|
|
608
|
+
deleteSession(
|
|
609
|
+
sessionId?: string,
|
|
610
|
+
driverData?: DriverData[],
|
|
611
|
+
): Promise<DeleteResult>;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
export type DriverData = Record<string, unknown>;
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Wraps {@linkcode _Class `type-fest`'s `Class`} to include static members.
|
|
618
|
+
*/
|
|
619
|
+
export type Class<
|
|
620
|
+
Proto,
|
|
621
|
+
StaticMembers extends object = {},
|
|
622
|
+
Args extends unknown[] = any[],
|
|
623
|
+
> = _Class<Proto, Args> & StaticMembers;
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@appium/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Various type declarations used across Appium",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"appium",
|
|
7
|
+
"typescript",
|
|
8
|
+
"types"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://appium.io",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/appium/appium/issues"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/appium/appium.git",
|
|
17
|
+
"directory": "packages/types"
|
|
18
|
+
},
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"author": "https://github.com/appium",
|
|
21
|
+
"files": [
|
|
22
|
+
"build",
|
|
23
|
+
"lib"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node ./scripts/generate-schema-types.js",
|
|
27
|
+
"dev": "npm run build -- --watch",
|
|
28
|
+
"fix": "npm run lint -- --fix",
|
|
29
|
+
"lint": "eslint -c ../../.eslintrc --ignore-path ../../.eslintignore ."
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=12",
|
|
33
|
+
"npm": ">=6"
|
|
34
|
+
},
|
|
35
|
+
"types": "./build/index.d.ts",
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"gitHead": "3ec3a0efa590e22e264ffbd23316ee5714a12081",
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@appium/schema": "^0.0.1"
|
|
42
|
+
}
|
|
43
|
+
}
|