@appium/types 0.4.0 → 0.5.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.
@@ -0,0 +1,176 @@
1
+ /**
2
+ * @module
3
+ * Portions Copyright (c) 2017 Igor Muchychka
4
+ * @see https://github.com/w3c-webdriver/w3c-webdriver
5
+ */
6
+ export interface Element {
7
+ 'element-6066-11e4-a52e-4f735466cecf': string;
8
+ }
9
+ /**
10
+ * @group Actions
11
+ */
12
+ export declare type PauseAction = {
13
+ type: 'pause';
14
+ duration: number;
15
+ };
16
+ /**
17
+ * @group Actions
18
+ */
19
+ export declare type KeyDownAction = {
20
+ type: 'keyDown';
21
+ value: Key | string;
22
+ };
23
+ /**
24
+ * @group Actions
25
+ */
26
+ export declare type KeyUpAction = {
27
+ type: 'keyUp';
28
+ value: Key | string;
29
+ };
30
+ /**
31
+ * @group Actions
32
+ */
33
+ export declare type PointerMoveAction = {
34
+ type: 'pointerMove';
35
+ x: number;
36
+ y: number;
37
+ duration?: number;
38
+ origin?: 'viewport' | 'pointer' | Element;
39
+ };
40
+ /**
41
+ * @group Actions
42
+ */
43
+ export declare type PointerUpAction = {
44
+ type: 'pointerUp';
45
+ button: number;
46
+ };
47
+ /**
48
+ * @group Actions
49
+ */
50
+ export declare type PointerDownAction = {
51
+ type: 'pointerDown';
52
+ button: number;
53
+ };
54
+ /**
55
+ * @group Actions
56
+ */
57
+ export declare type NullAction = PauseAction;
58
+ /**
59
+ * @group Actions
60
+ */
61
+ export declare type KeyAction = PauseAction | KeyDownAction | KeyUpAction;
62
+ /**
63
+ * @group Actions
64
+ */
65
+ export declare type PointerAction = PauseAction | PointerMoveAction | PointerUpAction | PointerDownAction;
66
+ /**
67
+ * @group Actions
68
+ */
69
+ export declare type NullActionSequence = {
70
+ type: 'none';
71
+ id: string;
72
+ actions: NullAction[];
73
+ };
74
+ /**
75
+ * @group Actions
76
+ */
77
+ export declare type KeyActionSequence = {
78
+ type: 'key';
79
+ id: string;
80
+ actions: KeyAction[];
81
+ };
82
+ /**
83
+ * @group Actions
84
+ */
85
+ export declare type PointerParameters = {
86
+ pointerType: 'mouse' | 'pen' | 'touch';
87
+ };
88
+ /**
89
+ * @group Actions
90
+ */
91
+ export declare type PointerActionSequence = {
92
+ type: 'pointer';
93
+ id: string;
94
+ actions: PointerAction[];
95
+ parameters?: PointerParameters;
96
+ };
97
+ /**
98
+ * @group Actions
99
+ */
100
+ export declare type ActionSequence = NullActionSequence | KeyActionSequence | PointerActionSequence;
101
+ /**
102
+ * @group Actions
103
+ */
104
+ export declare enum Key {
105
+ NULL = "\uE000",
106
+ CANCEL = "\uE001",
107
+ HELP = "\uE002",
108
+ BACKSPACE = "\uE003",
109
+ TAB = "\uE004",
110
+ CLEAR = "\uE005",
111
+ RETURN = "\uE006",
112
+ ENTER = "\uE007",
113
+ SHIFT = "\uE008",
114
+ CONTROL = "\uE009",
115
+ ALT = "\uE00A",
116
+ PAUSE = "\uE00B",
117
+ ESCAPE = "\uE00C",
118
+ SPACE = "\uE00D",
119
+ PAGE_UP = "\uE00E",
120
+ PAGE_DOWN = "\uE00F",
121
+ END = "\uE010",
122
+ HOME = "\uE011",
123
+ LEFT = "\uE012",
124
+ UP = "\uE013",
125
+ RIGHT = "\uE014",
126
+ DOWN = "\uE015",
127
+ INSERT = "\uE016",
128
+ DELETE = "\uE017",
129
+ SEMICOLON = "\uE018",
130
+ EQUALS = "\uE019",
131
+ NUMPAD0 = "\uE01A",
132
+ NUMPAD1 = "\uE01B",
133
+ NUMPAD2 = "\uE01C",
134
+ NUMPAD3 = "\uE01D",
135
+ NUMPAD4 = "\uE01E",
136
+ NUMPAD5 = "\uE01F",
137
+ NUMPAD6 = "\uE020",
138
+ NUMPAD7 = "\uE021",
139
+ NUMPAD8 = "\uE022",
140
+ NUMPAD9 = "\uE023",
141
+ MULTIPLY = "\uE024",
142
+ ADD = "\uE025",
143
+ SEPARATOR = "\uE026",
144
+ SUBTRACT = "\uE027",
145
+ DECIMAL = "\uE028",
146
+ DIVIDE = "\uE029",
147
+ F1 = "\uE031",
148
+ F2 = "\uE032",
149
+ F3 = "\uE033",
150
+ F4 = "\uE034",
151
+ F5 = "\uE035",
152
+ F6 = "\uE036",
153
+ F7 = "\uE037",
154
+ F8 = "\uE038",
155
+ F9 = "\uE039",
156
+ F10 = "\uE03A",
157
+ F11 = "\uE03B",
158
+ F12 = "\uE03C",
159
+ META = "\uE03D",
160
+ ZENKAKUHANKAKU = "\uE040",
161
+ R_SHIFT = "\uE050",
162
+ R_CONTROL = "\uE051",
163
+ R_ALT = "\uE052",
164
+ R_META = "\uE053",
165
+ R_PAGEUP = "\uE054",
166
+ R_PAGEDOWN = "\uE055",
167
+ R_END = "\uE056",
168
+ R_HOME = "\uE057",
169
+ R_ARROWLEFT = "\uE058",
170
+ R_ARROWUP = "\uE059",
171
+ R_ARROWRIGHT = "\uE05A",
172
+ R_ARROWDOWN = "\uE05B",
173
+ R_INSERT = "\uE05C",
174
+ R_DELETE = "\uE05D"
175
+ }
176
+ //# sourceMappingURL=action.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../lib/action.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,OAAO;IACtB,qCAAqC,EAAE,MAAM,CAAC;CAC/C;AAED;;GAEG;AACH,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,oBAAY,WAAW,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,GAAG,GAAG,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,oBAAY,iBAAiB,GAAG;IAC9B,I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AAW,WAAW;IACtB,SAAS,WAAW;IACpB,YAAY,WAAW;IACvB,WAAW,WAAW;IACtB,QAAQ,WAAW;IACnB,QAAQ,WAAW;CACpB"}
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ /**
3
+ * @module
4
+ * Portions Copyright (c) 2017 Igor Muchychka
5
+ * @see https://github.com/w3c-webdriver/w3c-webdriver
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Key = void 0;
9
+ /**
10
+ * @group Actions
11
+ */
12
+ var Key;
13
+ (function (Key) {
14
+ Key["NULL"] = "\uE000";
15
+ Key["CANCEL"] = "\uE001";
16
+ Key["HELP"] = "\uE002";
17
+ Key["BACKSPACE"] = "\uE003";
18
+ Key["TAB"] = "\uE004";
19
+ Key["CLEAR"] = "\uE005";
20
+ Key["RETURN"] = "\uE006";
21
+ Key["ENTER"] = "\uE007";
22
+ Key["SHIFT"] = "\uE008";
23
+ Key["CONTROL"] = "\uE009";
24
+ Key["ALT"] = "\uE00A";
25
+ Key["PAUSE"] = "\uE00B";
26
+ Key["ESCAPE"] = "\uE00C";
27
+ Key["SPACE"] = "\uE00D";
28
+ Key["PAGE_UP"] = "\uE00E";
29
+ Key["PAGE_DOWN"] = "\uE00F";
30
+ Key["END"] = "\uE010";
31
+ Key["HOME"] = "\uE011";
32
+ Key["LEFT"] = "\uE012";
33
+ Key["UP"] = "\uE013";
34
+ Key["RIGHT"] = "\uE014";
35
+ Key["DOWN"] = "\uE015";
36
+ Key["INSERT"] = "\uE016";
37
+ Key["DELETE"] = "\uE017";
38
+ Key["SEMICOLON"] = "\uE018";
39
+ Key["EQUALS"] = "\uE019";
40
+ Key["NUMPAD0"] = "\uE01A";
41
+ Key["NUMPAD1"] = "\uE01B";
42
+ Key["NUMPAD2"] = "\uE01C";
43
+ Key["NUMPAD3"] = "\uE01D";
44
+ Key["NUMPAD4"] = "\uE01E";
45
+ Key["NUMPAD5"] = "\uE01F";
46
+ Key["NUMPAD6"] = "\uE020";
47
+ Key["NUMPAD7"] = "\uE021";
48
+ Key["NUMPAD8"] = "\uE022";
49
+ Key["NUMPAD9"] = "\uE023";
50
+ Key["MULTIPLY"] = "\uE024";
51
+ Key["ADD"] = "\uE025";
52
+ Key["SEPARATOR"] = "\uE026";
53
+ Key["SUBTRACT"] = "\uE027";
54
+ Key["DECIMAL"] = "\uE028";
55
+ Key["DIVIDE"] = "\uE029";
56
+ Key["F1"] = "\uE031";
57
+ Key["F2"] = "\uE032";
58
+ Key["F3"] = "\uE033";
59
+ Key["F4"] = "\uE034";
60
+ Key["F5"] = "\uE035";
61
+ Key["F6"] = "\uE036";
62
+ Key["F7"] = "\uE037";
63
+ Key["F8"] = "\uE038";
64
+ Key["F9"] = "\uE039";
65
+ Key["F10"] = "\uE03A";
66
+ Key["F11"] = "\uE03B";
67
+ Key["F12"] = "\uE03C";
68
+ Key["META"] = "\uE03D";
69
+ Key["ZENKAKUHANKAKU"] = "\uE040";
70
+ Key["R_SHIFT"] = "\uE050";
71
+ Key["R_CONTROL"] = "\uE051";
72
+ Key["R_ALT"] = "\uE052";
73
+ Key["R_META"] = "\uE053";
74
+ Key["R_PAGEUP"] = "\uE054";
75
+ Key["R_PAGEDOWN"] = "\uE055";
76
+ Key["R_END"] = "\uE056";
77
+ Key["R_HOME"] = "\uE057";
78
+ Key["R_ARROWLEFT"] = "\uE058";
79
+ Key["R_ARROWUP"] = "\uE059";
80
+ Key["R_ARROWRIGHT"] = "\uE05A";
81
+ Key["R_ARROWDOWN"] = "\uE05B";
82
+ Key["R_INSERT"] = "\uE05C";
83
+ Key["R_DELETE"] = "\uE05D";
84
+ })(Key = exports.Key || (exports.Key = {}));
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /**
4
+ * This file was automatically generated by json-schema-to-typescript.
5
+ * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
6
+ * and run json-schema-to-typescript to regenerate this file.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,47 +1,126 @@
1
1
  import type { Capabilities as WdioCaps } from '@wdio/types';
2
+ import { StringRecord, Constraint, Constraints } from '.';
3
+ import { BaseDriverCapConstraints } from './constraints';
4
+ export declare type StandardCapabilities = WdioCaps.Capabilities;
5
+ export declare type W3C_APPIUM_PREFIX = 'appium';
2
6
  /**
3
- * The mask of a W3C-style namespaced capability proped name.
7
+ * Base capabilities as derived from {@linkcode BaseDriverCapConstraints}.
4
8
  */
5
- declare type Namespaced = `${string}:${string}`;
9
+ export declare type BaseCapabilities = ConstraintsToCaps<BaseDriverCapConstraints>;
6
10
  /**
7
- * An object with keys conforming to {@linkcode Namespaced}.
11
+ * Like {@linkcode BaseCapabilities}, except all Appium-specific keys are namespaced.
8
12
  */
9
- declare type NamespacedRecord = Record<Namespaced, any>;
13
+ export declare type BaseNSCapabilities = CapsToNSCaps<ConstraintsToCaps<BaseDriverCapConstraints>>;
10
14
  /**
11
- * An object with keys for strings.
15
+ * These may (or should) be reused by drivers.
12
16
  */
13
- declare type StringRecord = Record<string, any>;
17
+ export declare type AppiumAndroidCapabilities = WdioCaps.AppiumAndroidCapabilities;
18
+ export declare type AppiumIOSCapabilities = WdioCaps.AppiumIOSCapabilities;
19
+ export declare type AppiumXCUICommandTimeouts = WdioCaps.AppiumXCUICommandTimeouts;
20
+ export declare type AppiumXCUIProcessArguments = WdioCaps.AppiumXCUIProcessArguments;
21
+ export declare type AppiumXCUISafariGlobalPreferences = WdioCaps.AppiumXCUISafariGlobalPreferences;
22
+ export declare type AppiumXCUITestCapabilities = WdioCaps.AppiumXCUITestCapabilities;
14
23
  /**
15
- * All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type, accepting additional optional caps.
16
- * All properties are optional.
24
+ * Given a {@linkcode Constraint} `C` and a type `T`, see if `inclusion`/`inclusionCaseInsensitive` is present, and create a union of its allowed literals; otherwise just use `T`.
17
25
  */
18
- declare type BaseCapabilities<OptionalCaps extends StringRecord = StringRecord> = Partial<WdioCaps.Capabilities & OptionalCaps>;
26
+ declare type ConstraintChoice<C extends Constraint, T> = C['inclusionCaseInsensitive'] extends ReadonlyArray<T> ? AnyCase<C['inclusionCaseInsensitive'][number]> : C['inclusion'] extends ReadonlyArray<T> ? C['inclusion'][number] : T;
19
27
  /**
20
- * All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type and wdio's {@linkcode WdioCaps.AppiumCapabilities} type, accepting additional optional caps.
28
+ * Given {@linkcode Constraint} `C`, determine the associated type of the capability.
29
+ *
30
+ * Notes:
21
31
  *
22
- * In practice, the properties `platformName` and `automationName` are required by Appium.
32
+ * - Only `number` and `string` values can have "choices" (`inclusion`/`inclusionCaseInesnsitive`) associated with them.
33
+ * - If `isArray` is `true`, the type is always of type `string[]`. If this is incorrect, then it will be `any[]`.
34
+ * - There is no way to express the shape of an object if `ifObject` is `true`.
23
35
  */
24
- export declare type Capabilities<OptionalCaps extends StringRecord = StringRecord> = BaseCapabilities<WdioCaps.AppiumCapabilities & OptionalCaps>;
36
+ declare type ConstraintToCapKind<C extends Constraint> = C['isString'] extends true ? ConstraintChoice<C, string> : C['isNumber'] extends true ? ConstraintChoice<C, number> : C['isBoolean'] extends true ? boolean : C['isArray'] extends true ? string[] : C['isObject'] extends true ? object : any;
25
37
  /**
26
- * All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type and wdio's {@linkcode WdioCaps.AppiumW3CCapabilities} type, accepting additional optional _namespaced_ caps.
38
+ * Given {@linkcode Constraint} `C`, determine if it is required or optional.
39
+ *
40
+ * In practice, _all_ capabilities are considered optional per types, but various errors might be thrown if some are not present.
27
41
  */
28
- export declare type AppiumW3CCapabilities<OptionalNamespacedCaps extends NamespacedRecord = NamespacedRecord> = BaseCapabilities<WdioCaps.AppiumW3CCapabilities & OptionalNamespacedCaps>;
42
+ export declare type ConstraintToCap<C extends Constraint> = C['presence'] extends true | {
43
+ allowEmpty: boolean;
44
+ } ? ConstraintToCapKind<C> : ConstraintToCapKind<C> | undefined;
29
45
  /**
30
- * All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type and wdio's {@linkcode WdioCaps.AppiumW3Capabilities} type, accepting additional optional _namespaced_ caps, in W3C-compatible format (`alwaysMatch`/`firstMatch`).
31
- * In practice, the properties `appium:platformName` and `appium:automationName` are required by Appium _somewhere_ in this object; this cannot be expressed in TypeScript.
46
+ * Given `string` `T`, this is a case-insensitive version of `T`.
32
47
  */
33
- export declare type W3CCapabilities<OptionalNamespacedCaps extends NamespacedRecord = NamespacedRecord> = {
34
- alwaysMatch: AppiumW3CCapabilities<OptionalNamespacedCaps>;
35
- firstMatch: AppiumW3CCapabilities<OptionalNamespacedCaps>[];
48
+ export declare type AnyCase<T extends string> = string extends T ? string : T extends `${infer F1}${infer F2}${infer R}` ? `${Uppercase<F1> | Lowercase<F1>}${Uppercase<F2> | Lowercase<F2>}${AnyCase<R>}` : T extends `${infer F}${infer R}` ? `${Uppercase<F> | Lowercase<F>}${AnyCase<R>}` : '';
49
+ /**
50
+ * Given {@linkcode StringRecord} `T` and namespace string `NS`, a type with the key names prefixed by `${NS}:` _except_ for standard capabilities. `NS` defaults to `appium`.
51
+ *
52
+ * If `T` is already namespaced, well, it'll get _double_-namespaced.
53
+ */
54
+ export declare type CapsToNSCaps<T extends StringRecord, NS extends string = W3C_APPIUM_PREFIX> = {
55
+ [K in keyof T as K extends keyof StandardCapabilities ? K : NamespacedString<K & string, NS>]: T[K];
36
56
  };
57
+ export declare type NamespacedString<S extends string, NS extends string = W3C_APPIUM_PREFIX> = `${NS}:${S}`;
37
58
  /**
38
- * These may (or should) be reused by drivers.
59
+ * Converts {@linkcode Constraint} `C` to a {@linkcode Capabilities} object.
39
60
  */
40
- export declare type AppiumAndroidCapabilities = WdioCaps.AppiumAndroidCapabilities;
41
- export declare type AppiumIOSCapabilities = WdioCaps.AppiumIOSCapabilities;
42
- export declare type AppiumXCUICommandTimeouts = WdioCaps.AppiumXCUICommandTimeouts;
43
- export declare type AppiumXCUIProcessArguments = WdioCaps.AppiumXCUIProcessArguments;
44
- export declare type AppiumXCUISafariGlobalPreferences = WdioCaps.AppiumXCUISafariGlobalPreferences;
45
- export declare type AppiumXCUITestCapabilities = WdioCaps.AppiumXCUITestCapabilities;
61
+ export declare type ConstraintsToCaps<C extends Constraints> = {
62
+ -readonly [K in keyof C]: ConstraintToCap<C[K]>;
63
+ };
64
+ /**
65
+ * Given some constraints, return the entire set of supported capabilities it supports (including whatever is in its desired caps).
66
+ *
67
+ * Does not contain {@linkcode BaseCapabilities}; see {@linkcode DriverCaps}.
68
+ */
69
+ export declare type Capabilities<C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> = Partial<ConstraintsToCaps<C> & Extra>;
70
+ /**
71
+ * Like {@linkcode Capabilities}, except W3C-style.
72
+ *
73
+ * Does not contain {@linkcode BaseCapabilities}; see {@linkcode W3CDriverCaps}.
74
+ */
75
+ export declare type W3CCapabilities<C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void> = {
76
+ alwaysMatch: NSCapabilities<C, Extra>;
77
+ firstMatch: NSCapabilities<C, Extra>[];
78
+ };
79
+ /**
80
+ * Namespaced caps (where appropriate).
81
+ *
82
+ * Does not contain {@linkcode BaseCapabilities}; see {@linkcode NSDriverCaps}.
83
+ */
84
+ export declare type NSCapabilities<C extends Constraints = BaseDriverCapConstraints, Extra extends StringRecord | void = void, NS extends string = W3C_APPIUM_PREFIX> = Partial<CapsToNSCaps<ConstraintsToCaps<C> & Extra, NS>>;
85
+ /**
86
+ * Capabilities for drivers extending `BaseDriver`.
87
+ *
88
+ * Includes {@linkcode BaseCapabilities}.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * class MyDriver extends BaseDriver {
93
+ * async createSession (w3ccaps: W3CDriverCaps<MyDriverConstraints>, ...args: any[]) {
94
+ * const [
95
+ * sessionId: string,
96
+ * caps: DriverCaps<MyDriverConstraints>
97
+ * ] = await super.createSession(w3ccaps, ...args);
98
+ * // ...
99
+ * }
100
+ * }
101
+ * ```
102
+ */
103
+ export declare type DriverCaps<C extends Constraints, Extra extends StringRecord | void = void> = Capabilities<BaseDriverCapConstraints & C, Extra>;
104
+ /**
105
+ * W3C-style capabilities for drivers extending `BaseDriver`.
106
+ *
107
+ * Includes {@linkcode BaseCapabilities}.
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * class MyDriver extends BaseDriver {
112
+ * async createSession (w3ccaps: W3CDriverCaps<MyDriverConstraints>, ...args: any[]) {
113
+ * // ...
114
+ * }
115
+ * }
116
+ * ```
117
+ */
118
+ export declare type W3CDriverCaps<C extends Constraints, Extra extends StringRecord | void = void> = W3CCapabilities<BaseDriverCapConstraints & C, Extra>;
119
+ /**
120
+ * Namespaced capabilities for drivers extending `BaseDriver`.
121
+ *
122
+ * Includes {@linkcode BaseCapabilities}.
123
+ */
124
+ export declare type NSDriverCaps<C extends Constraints, Extra extends StringRecord | void = void> = NSCapabilities<BaseDriverCapConstraints & C, Extra>;
46
125
  export {};
47
126
  //# sourceMappingURL=capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../lib/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,IAAI,QAAQ,EAAC,MAAM,aAAa,CAAC;AAE1D;;GAEG;AACH,aAAK,UAAU,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;AAExC;;GAEG;AACH,aAAK,gBAAgB,GAAG,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAEhD;;GAEG;AACH,aAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAExC;;;GAGG;AACH,aAAK,gBAAgB,CAAC,YAAY,SAAS,YAAY,GAAG,YAAY,IAAI,OAAO,CAC/E,QAAQ,CAAC,YAAY,GAAG,YAAY,CACrC,CAAC;AAEF;;;;GAIG;AACH,oBAAY,YAAY,CAAC,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G,IAAI,IACtC,cAAc,CAAC,wBAAwB,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // end conditionals
@@ -0,0 +1,53 @@
1
+ export declare const BASE_DESIRED_CAP_CONSTRAINTS: {
2
+ readonly platformName: {
3
+ readonly presence: true;
4
+ readonly isString: true;
5
+ };
6
+ readonly app: {
7
+ readonly isString: true;
8
+ };
9
+ readonly deviceName: {
10
+ readonly isString: true;
11
+ };
12
+ readonly platformVersion: {
13
+ readonly isString: true;
14
+ };
15
+ readonly newCommandTimeout: {
16
+ readonly isNumber: true;
17
+ };
18
+ readonly automationName: {
19
+ readonly isString: true;
20
+ };
21
+ readonly autoLaunch: {
22
+ readonly isBoolean: true;
23
+ };
24
+ readonly udid: {
25
+ readonly isString: true;
26
+ };
27
+ readonly orientation: {
28
+ readonly inclusion: readonly ["LANDSCAPE", "PORTRAIT"];
29
+ };
30
+ readonly autoWebview: {
31
+ readonly isBoolean: true;
32
+ };
33
+ readonly noReset: {
34
+ readonly isBoolean: true;
35
+ };
36
+ readonly fullReset: {
37
+ readonly isBoolean: true;
38
+ };
39
+ readonly language: {
40
+ readonly isString: true;
41
+ };
42
+ readonly locale: {
43
+ readonly isString: true;
44
+ };
45
+ readonly eventTimings: {
46
+ readonly isBoolean: true;
47
+ };
48
+ readonly printPageSourceOnFindFailure: {
49
+ readonly isBoolean: true;
50
+ };
51
+ };
52
+ export declare type BaseDriverCapConstraints = typeof BASE_DESIRED_CAP_CONSTRAINTS;
53
+ //# sourceMappingURL=constraints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraints.d.ts","sourceRoot":"","sources":["../lib/constraints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD/B,CAAC;AAEX,oBAAY,wBAAwB,GAAG,OAAO,4BAA4B,CAAC"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BASE_DESIRED_CAP_CONSTRAINTS = void 0;
4
+ exports.BASE_DESIRED_CAP_CONSTRAINTS = {
5
+ platformName: {
6
+ presence: true,
7
+ isString: true,
8
+ },
9
+ app: {
10
+ isString: true,
11
+ },
12
+ deviceName: {
13
+ isString: true,
14
+ },
15
+ platformVersion: {
16
+ isString: true,
17
+ },
18
+ newCommandTimeout: {
19
+ isNumber: true,
20
+ },
21
+ automationName: {
22
+ isString: true,
23
+ },
24
+ autoLaunch: {
25
+ isBoolean: true,
26
+ },
27
+ udid: {
28
+ isString: true,
29
+ },
30
+ orientation: {
31
+ inclusion: ['LANDSCAPE', 'PORTRAIT'],
32
+ },
33
+ autoWebview: {
34
+ isBoolean: true,
35
+ },
36
+ noReset: {
37
+ isBoolean: true,
38
+ },
39
+ fullReset: {
40
+ isBoolean: true,
41
+ },
42
+ language: {
43
+ isString: true,
44
+ },
45
+ locale: {
46
+ isString: true,
47
+ },
48
+ eventTimings: {
49
+ isBoolean: true,
50
+ },
51
+ printPageSourceOnFindFailure: {
52
+ isBoolean: true,
53
+ },
54
+ };