@appium/types 0.2.2 → 0.2.5
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/build/capabilities.d.ts.map +1 -1
- package/build/config.d.ts.map +1 -1
- package/build/driver.d.ts +440 -0
- package/build/driver.d.ts.map +1 -0
- package/build/index.d.ts +100 -399
- package/build/index.d.ts.map +1 -1
- package/build/plugin.d.ts +79 -0
- package/build/plugin.d.ts.map +1 -0
- package/lib/capabilities.ts +11 -12
- package/lib/config.ts +20 -23
- package/lib/driver.ts +601 -0
- package/lib/index.ts +117 -600
- package/lib/plugin.ts +92 -0
- package/package.json +9 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../lib/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,YAAY,EAAC,MAAM,GAAG,CAAC;AACvE,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM;IACrD;;OAEG;IACH,YAAY,CAAC,EAAE,oBAAoB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC;IACrB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B;;OAEG;IACH,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF;;;OAGG;IACH,MAAM,CAAC,EAAE,CACP,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,kBAAkB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AAErD;;GAEG;AACH,oBAAY,aAAa,CAAC,KAAK,GAAG,GAAG,IAAI,CACvC,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,cAAc,EACtB,GAAG,IAAI,EAAE,KAAK,EAAE,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB;;;;GAIG;AACH,oBAAY,WAAW,GAAG,KAAK,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
package/lib/capabilities.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {Capabilities as WdioCaps} from '@wdio/types';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The mask of a W3C-style namespaced capability proped name.
|
|
@@ -19,31 +19,31 @@ type StringRecord = Record<string, any>;
|
|
|
19
19
|
* All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type, accepting additional optional caps.
|
|
20
20
|
* All properties are optional.
|
|
21
21
|
*/
|
|
22
|
-
type BaseCapabilities<OptionalCaps extends StringRecord = StringRecord> =
|
|
23
|
-
|
|
22
|
+
type BaseCapabilities<OptionalCaps extends StringRecord = StringRecord> = Partial<
|
|
23
|
+
WdioCaps.Capabilities & OptionalCaps
|
|
24
|
+
>;
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type and wdio's {@linkcode WdioCaps.AppiumCapabilities} type, accepting additional optional caps.
|
|
27
|
-
*
|
|
28
|
+
*
|
|
28
29
|
* In practice, the properties `platformName` and `automationName` are required by Appium.
|
|
29
30
|
*/
|
|
30
|
-
export type Capabilities<OptionalCaps extends StringRecord = StringRecord> =
|
|
31
|
-
|
|
31
|
+
export type Capabilities<OptionalCaps extends StringRecord = StringRecord> = BaseCapabilities<
|
|
32
|
+
WdioCaps.AppiumCapabilities & OptionalCaps
|
|
33
|
+
>;
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
36
|
* All known capabilities derived from wdio's {@linkcode WdioCaps.Capabilities Capabilities} type and wdio's {@linkcode WdioCaps.AppiumW3CCapabilities} type, accepting additional optional _namespaced_ caps.
|
|
35
37
|
*/
|
|
36
38
|
export type AppiumW3CCapabilities<
|
|
37
|
-
OptionalNamespacedCaps extends NamespacedRecord = NamespacedRecord
|
|
39
|
+
OptionalNamespacedCaps extends NamespacedRecord = NamespacedRecord
|
|
38
40
|
> = BaseCapabilities<WdioCaps.AppiumW3CCapabilities & OptionalNamespacedCaps>;
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* 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`).
|
|
42
44
|
* In practice, the properties `appium:platformName` and `appium:automationName` are required by Appium _somewhere_ in this object; this cannot be expressed in TypeScript.
|
|
43
45
|
*/
|
|
44
|
-
export type W3CCapabilities<
|
|
45
|
-
OptionalNamespacedCaps extends NamespacedRecord = NamespacedRecord,
|
|
46
|
-
> = {
|
|
46
|
+
export type W3CCapabilities<OptionalNamespacedCaps extends NamespacedRecord = NamespacedRecord> = {
|
|
47
47
|
alwaysMatch: AppiumW3CCapabilities<OptionalNamespacedCaps>;
|
|
48
48
|
firstMatch: AppiumW3CCapabilities<OptionalNamespacedCaps>[];
|
|
49
49
|
};
|
|
@@ -55,6 +55,5 @@ export type AppiumAndroidCapabilities = WdioCaps.AppiumAndroidCapabilities;
|
|
|
55
55
|
export type AppiumIOSCapabilities = WdioCaps.AppiumIOSCapabilities;
|
|
56
56
|
export type AppiumXCUICommandTimeouts = WdioCaps.AppiumXCUICommandTimeouts;
|
|
57
57
|
export type AppiumXCUIProcessArguments = WdioCaps.AppiumXCUIProcessArguments;
|
|
58
|
-
export type AppiumXCUISafariGlobalPreferences =
|
|
59
|
-
WdioCaps.AppiumXCUISafariGlobalPreferences;
|
|
58
|
+
export type AppiumXCUISafariGlobalPreferences = WdioCaps.AppiumXCUISafariGlobalPreferences;
|
|
60
59
|
export type AppiumXCUITestCapabilities = WdioCaps.AppiumXCUITestCapabilities;
|
package/lib/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type {AppiumConfigJsonSchema} from '@appium/schema';
|
|
2
|
+
import {AppiumConfiguration, ServerConfig} from './appium-config';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The Appium configuration as it would be in a user-provided configuration file.
|
|
@@ -9,8 +9,7 @@ export type AppiumConfig = Partial<AppiumConfiguration>;
|
|
|
9
9
|
/**
|
|
10
10
|
* Derive the "constant" type of the server properties from the schema.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
typeof AppiumConfigJsonSchema['properties']['server']['properties'];
|
|
12
|
+
type AppiumServerJsonSchema = typeof AppiumConfigJsonSchema['properties']['server']['properties'];
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* This type associates the types generated from the schema ({@linkcode AppiumConfiguration})
|
|
@@ -67,35 +66,34 @@ export type ServerArgs = {
|
|
|
67
66
|
/**
|
|
68
67
|
* Converts a kebab-cased string into a camel-cased string.
|
|
69
68
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
: Lowercase<S>;
|
|
69
|
+
type KebabToCamel<S extends string> = S extends `${infer P1}-${infer P2}${infer P3}`
|
|
70
|
+
? `${Lowercase<P1>}${Uppercase<P2>}${KebabToCamel<P3>}`
|
|
71
|
+
: Lowercase<S>;
|
|
74
72
|
|
|
75
73
|
/**
|
|
76
|
-
* Converts an object with kebab-cased keys into camel-cased keys.
|
|
77
|
-
*/
|
|
74
|
+
* Converts an object with kebab-cased keys into camel-cased keys.
|
|
75
|
+
*/
|
|
78
76
|
type ObjectToCamel<T> = {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
[K in keyof T as KebabToCamel<string & K>]: T[K] extends Record<string, any>
|
|
78
|
+
? KeysToCamelCase<T[K]>
|
|
79
|
+
: T[K];
|
|
82
80
|
};
|
|
83
81
|
|
|
84
82
|
/**
|
|
85
|
-
* Converts an object or array to have camel-cased keys.
|
|
86
|
-
*/
|
|
83
|
+
* Converts an object or array to have camel-cased keys.
|
|
84
|
+
*/
|
|
87
85
|
type KeysToCamelCase<T> = {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
[K in keyof T as KebabToCamel<string & K>]: T[K] extends Array<any>
|
|
87
|
+
? KeysToCamelCase<T[K][number]>[]
|
|
88
|
+
: ObjectToCamel<T[K]>;
|
|
91
89
|
};
|
|
92
90
|
|
|
93
91
|
/**
|
|
94
|
-
* Object `B` has all the keys as object `A` (even if those keys in `A` are otherwise optional).
|
|
92
|
+
* Object `B` has all the keys as object `A` (even if those keys in `A` are otherwise optional).
|
|
95
93
|
*/
|
|
96
|
-
type Associated<A extends object, B extends {
|
|
94
|
+
type Associated<A extends object, B extends {[key in keyof Required<A>]: unknown}> = {
|
|
97
95
|
[Prop in keyof Required<A>]: B[Prop];
|
|
98
|
-
}
|
|
96
|
+
};
|
|
99
97
|
|
|
100
98
|
// end utils
|
|
101
99
|
|
|
@@ -109,7 +107,7 @@ type Associated<A extends object, B extends { [key in keyof Required<A>]: unknow
|
|
|
109
107
|
*
|
|
110
108
|
* See `appium/lib/schema/keywords` for definition of `appiumCliDest`.
|
|
111
109
|
*/
|
|
112
|
-
|
|
110
|
+
interface WithDest {
|
|
113
111
|
appiumCliDest: string;
|
|
114
112
|
}
|
|
115
113
|
|
|
@@ -125,4 +123,3 @@ interface WithDefault<T = any> {
|
|
|
125
123
|
}
|
|
126
124
|
|
|
127
125
|
// end conditionals
|
|
128
|
-
|