appium-uiautomator2-driver 3.10.0 → 4.0.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/CHANGELOG.md +63 -0
- package/build/lib/commands/actions.d.ts +13 -7
- package/build/lib/commands/actions.d.ts.map +1 -1
- package/build/lib/commands/actions.js +24 -10
- package/build/lib/commands/actions.js.map +1 -1
- package/build/lib/commands/alert.d.ts +8 -4
- package/build/lib/commands/alert.d.ts.map +1 -1
- package/build/lib/commands/alert.js +10 -6
- package/build/lib/commands/alert.js.map +1 -1
- package/build/lib/commands/app-management.d.ts +10 -6
- package/build/lib/commands/app-management.d.ts.map +1 -1
- package/build/lib/commands/app-management.js +13 -10
- package/build/lib/commands/app-management.js.map +1 -1
- package/build/lib/commands/clipboard.d.ts +0 -12
- package/build/lib/commands/clipboard.d.ts.map +1 -1
- package/build/lib/commands/clipboard.js +0 -18
- package/build/lib/commands/clipboard.js.map +1 -1
- package/build/lib/commands/element.d.ts +3 -2
- package/build/lib/commands/element.d.ts.map +1 -1
- package/build/lib/commands/element.js +3 -4
- package/build/lib/commands/element.js.map +1 -1
- package/build/lib/commands/gestures.d.ts +130 -22
- package/build/lib/commands/gestures.d.ts.map +1 -1
- package/build/lib/commands/gestures.js +130 -33
- package/build/lib/commands/gestures.js.map +1 -1
- package/build/lib/commands/keyboard.d.ts +11 -4
- package/build/lib/commands/keyboard.d.ts.map +1 -1
- package/build/lib/commands/keyboard.js +13 -7
- package/build/lib/commands/keyboard.js.map +1 -1
- package/build/lib/commands/navigation.d.ts +5 -2
- package/build/lib/commands/navigation.d.ts.map +1 -1
- package/build/lib/commands/navigation.js +5 -3
- package/build/lib/commands/navigation.js.map +1 -1
- package/build/lib/commands/screenshot.d.ts +4 -2
- package/build/lib/commands/screenshot.d.ts.map +1 -1
- package/build/lib/commands/screenshot.js +4 -3
- package/build/lib/commands/screenshot.js.map +1 -1
- package/build/lib/commands/types.d.ts +0 -387
- package/build/lib/commands/types.d.ts.map +1 -1
- package/build/lib/driver.d.ts +540 -8
- package/build/lib/driver.d.ts.map +1 -1
- package/build/lib/driver.js +2 -7
- package/build/lib/driver.js.map +1 -1
- package/build/lib/execute-method-map.d.ts +540 -0
- package/build/lib/execute-method-map.d.ts.map +1 -0
- package/build/lib/execute-method-map.js +257 -0
- package/build/lib/execute-method-map.js.map +1 -0
- package/build/tsconfig.tsbuildinfo +1 -1
- package/lib/commands/actions.js +32 -10
- package/lib/commands/alert.js +10 -6
- package/lib/commands/app-management.js +14 -11
- package/lib/commands/clipboard.js +0 -18
- package/lib/commands/element.js +3 -4
- package/lib/commands/gestures.js +184 -38
- package/lib/commands/keyboard.js +13 -8
- package/lib/commands/navigation.js +5 -3
- package/lib/commands/screenshot.js +4 -3
- package/lib/commands/types.ts +0 -406
- package/lib/driver.ts +2 -16
- package/lib/execute-method-map.ts +269 -0
- package/npm-shrinkwrap.json +34 -41
- package/package.json +2 -2
- package/build/lib/commands/app-strings.d.ts +0 -12
- package/build/lib/commands/app-strings.d.ts.map +0 -1
- package/build/lib/commands/app-strings.js +0 -19
- package/build/lib/commands/app-strings.js.map +0 -1
- package/build/lib/commands/execute.d.ts +0 -15
- package/build/lib/commands/execute.d.ts.map +0 -1
- package/build/lib/commands/execute.js +0 -83
- package/build/lib/commands/execute.js.map +0 -1
- package/lib/commands/app-strings.js +0 -16
- package/lib/commands/execute.js +0 -93
|
@@ -2,78 +2,169 @@
|
|
|
2
2
|
* Performs a simple click/tap gesture
|
|
3
3
|
*
|
|
4
4
|
* @this {AndroidUiautomator2Driver}
|
|
5
|
-
* @param {
|
|
5
|
+
* @param {string} [elementId] The id of the element to be clicked.
|
|
6
|
+
* If the element is missing then both click offset coordinates must be provided.
|
|
7
|
+
* If both the element id and offset are provided then the coordinates are parsed
|
|
8
|
+
* as relative offsets from the top left corner of the element.
|
|
9
|
+
* @param {number} [x] The x coordinate to click on.
|
|
10
|
+
* @param {number} [y] The y coordinate to click on.
|
|
6
11
|
* @returns {Promise<void>}
|
|
7
12
|
* @throws {Error} if provided options are not valid
|
|
8
13
|
*/
|
|
9
|
-
export function mobileClickGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
14
|
+
export function mobileClickGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, x?: number, y?: number): Promise<void>;
|
|
10
15
|
/**
|
|
11
16
|
* Performs a click that lasts for the given duration
|
|
12
17
|
*
|
|
13
18
|
* @this {AndroidUiautomator2Driver}
|
|
14
|
-
* @param {
|
|
19
|
+
* @param {string} [elementId] The id of the element to be clicked.
|
|
20
|
+
* If the element is missing then both click offset coordinates must be provided.
|
|
21
|
+
* If both the element id and offset are provided then the coordinates are parsed
|
|
22
|
+
* as relative offsets from the top left corner of the element.
|
|
23
|
+
* @param {number} [x] The x coordinate to click on.
|
|
24
|
+
* @param {number} [y] The y coordinate to click on.
|
|
25
|
+
* @param {number} [duration] Click duration in milliseconds. The value must not be negative.
|
|
26
|
+
* Default is 500.
|
|
15
27
|
* @returns {Promise<void>}
|
|
16
28
|
* @throws {Error} if provided options are not valid
|
|
17
29
|
*/
|
|
18
|
-
export function mobileLongClickGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
30
|
+
export function mobileLongClickGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, x?: number, y?: number, duration?: number): Promise<void>;
|
|
19
31
|
/**
|
|
20
32
|
* Performs a click that lasts for the given duration
|
|
21
33
|
* @this {AndroidUiautomator2Driver}
|
|
22
|
-
* @param {
|
|
34
|
+
* @param {string} [elementId] The id of the element to be clicked.
|
|
35
|
+
* If the element is missing then both click offset coordinates must be provided.
|
|
36
|
+
* If both the element id and offset are provided then the coordinates are parsed
|
|
37
|
+
* as relative offsets from the top left corner of the element.
|
|
38
|
+
* @param {number} [x] The x coordinate to click on.
|
|
39
|
+
* @param {number} [y] The y coordinate to click on.
|
|
23
40
|
* @returns {Promise<void>}
|
|
24
41
|
* @throws {Error} if provided options are not valid
|
|
25
42
|
*/
|
|
26
|
-
export function mobileDoubleClickGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
43
|
+
export function mobileDoubleClickGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, x?: number, y?: number): Promise<void>;
|
|
27
44
|
/**
|
|
28
45
|
* Drags this object to the specified location.
|
|
29
46
|
* @this {AndroidUiautomator2Driver}
|
|
30
|
-
* @param {
|
|
47
|
+
* @param {string} [elementId] The id of the element to be dragged.
|
|
48
|
+
* If the element id is missing then the start coordinates must be provided.
|
|
49
|
+
* If both the element id and the start coordinates are provided then these
|
|
50
|
+
* coordinates are considered as offsets from the top left element corner.
|
|
51
|
+
* @param {number} [startX] The x coordinate where the dragging starts
|
|
52
|
+
* @param {number} [startY] The y coordinate where the dragging starts
|
|
53
|
+
* @param {number} [endX] The x coordinate where the dragging ends
|
|
54
|
+
* @param {number} [endY] The y coordinate where the dragging ends
|
|
55
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
56
|
+
* The value must not be negative.
|
|
57
|
+
* Default is 2500 * displayDensity.
|
|
31
58
|
* @returns {Promise<void>}
|
|
32
59
|
* @throws {Error} if provided options are not valid
|
|
33
60
|
*/
|
|
34
|
-
export function mobileDragGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
61
|
+
export function mobileDragGesture(this: import("../driver").AndroidUiautomator2Driver, elementId?: string, startX?: number, startY?: number, endX?: number, endY?: number, speed?: number): Promise<void>;
|
|
35
62
|
/**
|
|
36
63
|
* Drags to the specified location.
|
|
37
64
|
*
|
|
38
65
|
* @throws {Error} if provided options are not valid
|
|
39
66
|
* @this {AndroidUiautomator2Driver}
|
|
40
|
-
* @param {
|
|
67
|
+
* @param {string} direction Direction of the fling.
|
|
68
|
+
* Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
|
|
69
|
+
* @param {string} [elementId] The id of the element to be flinged.
|
|
70
|
+
* If the element id is missing then fling bounding area must be provided.
|
|
71
|
+
* If both the element id and the fling bounding area are provided then this
|
|
72
|
+
* area is effectively ignored.
|
|
73
|
+
* @param {number} [left] The left coordinate of the fling bounding area.
|
|
74
|
+
* @param {number} [top] The top coordinate of the fling bounding area.
|
|
75
|
+
* @param {number} [width] The width of the fling bounding area.
|
|
76
|
+
* @param {number} [height] The height of the fling bounding area.
|
|
77
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
78
|
+
* The value must be greater than the minimum fling velocity for the given view (50 by default).
|
|
79
|
+
* Default is 7500 * displayDensity.
|
|
41
80
|
* @returns {Promise<boolean>} True if the object can still scroll in the given direction.
|
|
42
81
|
*/
|
|
43
|
-
export function mobileFlingGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
82
|
+
export function mobileFlingGesture(this: import("../driver").AndroidUiautomator2Driver, direction: string, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<boolean>;
|
|
44
83
|
/**
|
|
45
84
|
* Performs a pinch close gesture.
|
|
46
85
|
* @this {AndroidUiautomator2Driver}
|
|
47
|
-
* @param {
|
|
86
|
+
* @param {number} percent The size of the pinch as a percentage of the pinch area size.
|
|
87
|
+
* Valid values must be float numbers in range 0..1, where 1.0 is 100%
|
|
88
|
+
* @param {string} [elementId] The id of the element to be pinched.
|
|
89
|
+
* If the element id is missing then pinch bounding area must be provided.
|
|
90
|
+
* If both the element id and the pinch bounding area are provided then the
|
|
91
|
+
* area is effectively ignored.
|
|
92
|
+
* @param {number} [left] The left coordinate of the pinch bounding area.
|
|
93
|
+
* @param {number} [top] The top coordinate of the pinch bounding area.
|
|
94
|
+
* @param {number} [width] The width of the pinch bounding area.
|
|
95
|
+
* @param {number} [height] The height of the pinch bounding area.
|
|
96
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
97
|
+
* The value must not be negative.
|
|
98
|
+
* Default is 2500 * displayDensity.
|
|
48
99
|
* @returns {Promise<void>}
|
|
49
100
|
* @throws {Error} if provided options are not valid
|
|
50
101
|
*/
|
|
51
|
-
export function mobilePinchCloseGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
102
|
+
export function mobilePinchCloseGesture(this: import("../driver").AndroidUiautomator2Driver, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
|
|
52
103
|
/**
|
|
53
104
|
* Performs a pinch open gesture.
|
|
54
105
|
* @this {AndroidUiautomator2Driver}
|
|
55
|
-
* @param {
|
|
106
|
+
* @param {number} percent The size of the pinch as a percentage of the pinch area size.
|
|
107
|
+
* Valid values must be float numbers in range 0..1, where 1.0 is 100%
|
|
108
|
+
* @param {string} [elementId] The id of the element to be pinched.
|
|
109
|
+
* If the element id is missing then pinch bounding area must be provided.
|
|
110
|
+
* If both the element id and the pinch bounding area are provided then the
|
|
111
|
+
* area is effectively ignored.
|
|
112
|
+
* @param {number} [left] The left coordinate of the pinch bounding area.
|
|
113
|
+
* @param {number} [top] The top coordinate of the pinch bounding area.
|
|
114
|
+
* @param {number} [width] The width of the pinch bounding area.
|
|
115
|
+
* @param {number} [height] The height of the pinch bounding area.
|
|
116
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
117
|
+
* The value must not be negative.
|
|
118
|
+
* Default is 2500 * displayDensity.
|
|
56
119
|
* @returns {Promise<void>}
|
|
57
120
|
* @throws {Error} if provided options are not valid
|
|
58
121
|
*/
|
|
59
|
-
export function mobilePinchOpenGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
122
|
+
export function mobilePinchOpenGesture(this: import("../driver").AndroidUiautomator2Driver, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
|
|
60
123
|
/**
|
|
61
124
|
* Performs a swipe gesture.
|
|
62
125
|
* @this {AndroidUiautomator2Driver}
|
|
63
|
-
* @param {
|
|
126
|
+
* @param {string} direction Direction of the swipe.
|
|
127
|
+
* Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
|
|
128
|
+
* @param {number} percent The size of the swipe as a percentage of the swipe area size.
|
|
129
|
+
* Valid values must be float numbers in range 0..1, where 1.0 is 100%.
|
|
130
|
+
* @param {string} [elementId] The id of the element to be swiped.
|
|
131
|
+
* If the element id is missing then swipe bounding area must be provided.
|
|
132
|
+
* If both the element id and the swipe bounding area are provided then the
|
|
133
|
+
* area is effectively ignored.
|
|
134
|
+
* @param {number} [left] The left coordinate of the swipe bounding area.
|
|
135
|
+
* @param {number} [top] The top coordinate of the swipe bounding area.
|
|
136
|
+
* @param {number} [width] The width of the swipe bounding area.
|
|
137
|
+
* @param {number} [height] The height of the swipe bounding area.
|
|
138
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
139
|
+
* The value must not be negative.
|
|
140
|
+
* Default is 5000 * displayDensity.
|
|
64
141
|
* @returns {Promise<void>}
|
|
65
142
|
* @throws {Error} if provided options are not valid
|
|
66
143
|
*/
|
|
67
|
-
export function mobileSwipeGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
144
|
+
export function mobileSwipeGesture(this: import("../driver").AndroidUiautomator2Driver, direction: string, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<void>;
|
|
68
145
|
/**
|
|
69
146
|
* Performs a scroll gesture.
|
|
70
147
|
*
|
|
71
148
|
* @throws {Error} if provided options are not valid
|
|
72
149
|
* @this {AndroidUiautomator2Driver}
|
|
73
|
-
* @param {
|
|
150
|
+
* @param {string} direction Direction of the scroll.
|
|
151
|
+
* Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
|
|
152
|
+
* @param {number} percent The size of the scroll as a percentage of the scrolling area size.
|
|
153
|
+
* Valid values must be float numbers greater than zero, where 1.0 is 100%.
|
|
154
|
+
* @param {string} [elementId] The id of the element to be scrolled.
|
|
155
|
+
* If the element id is missing then scroll bounding area must be provided.
|
|
156
|
+
* If both the element id and the scroll bounding area are provided then this
|
|
157
|
+
* area is effectively ignored.
|
|
158
|
+
* @param {number} [left] The left coordinate of the scroll bounding area.
|
|
159
|
+
* @param {number} [top] The top coordinate of the scroll bounding area.
|
|
160
|
+
* @param {number} [width] The width of the scroll bounding area.
|
|
161
|
+
* @param {number} [height] The height of the scroll bounding area.
|
|
162
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
163
|
+
* The value must not be negative.
|
|
164
|
+
* Default is 5000 * displayDensity.
|
|
74
165
|
* @returns {Promise<boolean>} True if the object can still scroll in the given direction.
|
|
75
166
|
*/
|
|
76
|
-
export function mobileScrollGesture(this: import("../driver").AndroidUiautomator2Driver,
|
|
167
|
+
export function mobileScrollGesture(this: import("../driver").AndroidUiautomator2Driver, direction: string, percent: number, elementId?: string, left?: number, top?: number, width?: number, height?: number, speed?: number): Promise<boolean>;
|
|
77
168
|
/**
|
|
78
169
|
* Scrolls the given scrollable element `elementId` until `elementToId`
|
|
79
170
|
* becomes visible. This function returns immediately if the `elementToId`
|
|
@@ -82,11 +173,16 @@ export function mobileScrollGesture(this: import("../driver").AndroidUiautomator
|
|
|
82
173
|
* by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
|
|
83
174
|
* is detected automatically.
|
|
84
175
|
* @this {AndroidUiautomator2Driver}
|
|
85
|
-
* @param {
|
|
176
|
+
* @param {string} elementId The identifier of the scrollable element, which is going to be scrolled.
|
|
177
|
+
* It is required this element is a valid scrollable container and it was located
|
|
178
|
+
* by `-android uiautomator` strategy.
|
|
179
|
+
* @param {string} elementToId The identifier of the item, which belongs to the scrollable element above,
|
|
180
|
+
* and which should become visible after the scrolling operation is finished.
|
|
181
|
+
* It is required this element was located by `-android uiautomator` strategy.
|
|
86
182
|
* @returns {Promise<void>}
|
|
87
183
|
* @throws {Error} if the scrolling operation cannot be performed
|
|
88
184
|
*/
|
|
89
|
-
export function mobileScrollBackTo(this: import("../driver").AndroidUiautomator2Driver,
|
|
185
|
+
export function mobileScrollBackTo(this: import("../driver").AndroidUiautomator2Driver, elementId: string, elementToId: string): Promise<void>;
|
|
90
186
|
/**
|
|
91
187
|
* Scrolls the given scrollable element until the element identified
|
|
92
188
|
* by `strategy` and `selector` becomes visible. This function returns immediately if the
|
|
@@ -94,11 +190,23 @@ export function mobileScrollBackTo(this: import("../driver").AndroidUiautomator2
|
|
|
94
190
|
* to the very beginning of the scrollable control and tries to reach the destination element
|
|
95
191
|
* by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
|
|
96
192
|
* is detected automatically.
|
|
193
|
+
*
|
|
97
194
|
* @this {AndroidUiautomator2Driver}
|
|
98
|
-
* @param {
|
|
195
|
+
* @param {string} strategy The following strategies are supported:
|
|
196
|
+
* - `accessibility id` (UiSelector().description)
|
|
197
|
+
* - `class name` (UiSelector().className)
|
|
198
|
+
* - `-android uiautomator` (UiSelector)
|
|
199
|
+
* @param {string} selector The corresponding lookup value for the given strategy.
|
|
200
|
+
* @param {string} [elementId] The identifier of an element. It is required this element is a valid scrollable container
|
|
201
|
+
* and it was located by `-android uiautomator` strategy.
|
|
202
|
+
* If this property is not provided then the first currently available scrollable view
|
|
203
|
+
* is selected for the interaction.
|
|
204
|
+
* @param {number} [maxSwipes] The maximum number of swipes to perform on the target scrollable view in order to reach
|
|
205
|
+
* the destination element. In case this value is unset then it would be retrieved from the
|
|
206
|
+
* scrollable element itself (via `getMaxSearchSwipes()` property).
|
|
99
207
|
* @returns {Promise<void>}
|
|
100
208
|
* @throws {Error} if the scrolling operation cannot be performed
|
|
101
209
|
*/
|
|
102
|
-
export function mobileScroll(this: import("../driver").AndroidUiautomator2Driver,
|
|
210
|
+
export function mobileScroll(this: import("../driver").AndroidUiautomator2Driver, strategy: string, selector: string, elementId?: string, maxSwipes?: number): Promise<void>;
|
|
103
211
|
export type AndroidUiautomator2Driver = import("../driver").AndroidUiautomator2Driver;
|
|
104
212
|
//# sourceMappingURL=gestures.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.d.ts","sourceRoot":"","sources":["../../../lib/commands/gestures.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"gestures.d.ts","sourceRoot":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IN,MAAM,QACN,MAAM,UACN,MAAM,WACN,MAAM,UACN,MAAM,GAGJ,OAAO,CAAC,OAAO,CAAC,CAyB5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,mGATW,MAAM,eAGN,MAAM,GAGJ,OAAO,CAAC,IAAI,CAAC,CAgBzB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,4FAfW,MAAM,YAIN,MAAM,cACN,MAAM,cAIN,MAAM,GAGJ,OAAO,CAAC,IAAI,CAAC,CAsBzB;wCAwCY,OAAO,WAAW,EAAE,yBAAyB"}
|
|
@@ -21,12 +21,16 @@ const driver_1 = require("appium/driver");
|
|
|
21
21
|
* Performs a simple click/tap gesture
|
|
22
22
|
*
|
|
23
23
|
* @this {AndroidUiautomator2Driver}
|
|
24
|
-
* @param {
|
|
24
|
+
* @param {string} [elementId] The id of the element to be clicked.
|
|
25
|
+
* If the element is missing then both click offset coordinates must be provided.
|
|
26
|
+
* If both the element id and offset are provided then the coordinates are parsed
|
|
27
|
+
* as relative offsets from the top left corner of the element.
|
|
28
|
+
* @param {number} [x] The x coordinate to click on.
|
|
29
|
+
* @param {number} [y] The y coordinate to click on.
|
|
25
30
|
* @returns {Promise<void>}
|
|
26
31
|
* @throws {Error} if provided options are not valid
|
|
27
32
|
*/
|
|
28
|
-
async function mobileClickGesture(
|
|
29
|
-
const { elementId, x, y } = opts;
|
|
33
|
+
async function mobileClickGesture(elementId, x, y) {
|
|
30
34
|
await this.uiautomator2.jwproxy.command('/appium/gestures/click', 'POST', {
|
|
31
35
|
origin: toOrigin(elementId),
|
|
32
36
|
offset: toPoint(x, y),
|
|
@@ -36,12 +40,18 @@ async function mobileClickGesture(opts = {}) {
|
|
|
36
40
|
* Performs a click that lasts for the given duration
|
|
37
41
|
*
|
|
38
42
|
* @this {AndroidUiautomator2Driver}
|
|
39
|
-
* @param {
|
|
43
|
+
* @param {string} [elementId] The id of the element to be clicked.
|
|
44
|
+
* If the element is missing then both click offset coordinates must be provided.
|
|
45
|
+
* If both the element id and offset are provided then the coordinates are parsed
|
|
46
|
+
* as relative offsets from the top left corner of the element.
|
|
47
|
+
* @param {number} [x] The x coordinate to click on.
|
|
48
|
+
* @param {number} [y] The y coordinate to click on.
|
|
49
|
+
* @param {number} [duration] Click duration in milliseconds. The value must not be negative.
|
|
50
|
+
* Default is 500.
|
|
40
51
|
* @returns {Promise<void>}
|
|
41
52
|
* @throws {Error} if provided options are not valid
|
|
42
53
|
*/
|
|
43
|
-
async function mobileLongClickGesture(
|
|
44
|
-
const { elementId, x, y, duration } = opts;
|
|
54
|
+
async function mobileLongClickGesture(elementId, x, y, duration) {
|
|
45
55
|
await this.uiautomator2.jwproxy.command('/appium/gestures/long_click', 'POST', {
|
|
46
56
|
origin: toOrigin(elementId),
|
|
47
57
|
offset: toPoint(x, y),
|
|
@@ -51,12 +61,16 @@ async function mobileLongClickGesture(opts = {}) {
|
|
|
51
61
|
/**
|
|
52
62
|
* Performs a click that lasts for the given duration
|
|
53
63
|
* @this {AndroidUiautomator2Driver}
|
|
54
|
-
* @param {
|
|
64
|
+
* @param {string} [elementId] The id of the element to be clicked.
|
|
65
|
+
* If the element is missing then both click offset coordinates must be provided.
|
|
66
|
+
* If both the element id and offset are provided then the coordinates are parsed
|
|
67
|
+
* as relative offsets from the top left corner of the element.
|
|
68
|
+
* @param {number} [x] The x coordinate to click on.
|
|
69
|
+
* @param {number} [y] The y coordinate to click on.
|
|
55
70
|
* @returns {Promise<void>}
|
|
56
71
|
* @throws {Error} if provided options are not valid
|
|
57
72
|
*/
|
|
58
|
-
async function mobileDoubleClickGesture(
|
|
59
|
-
const { elementId, x, y } = opts;
|
|
73
|
+
async function mobileDoubleClickGesture(elementId, x, y) {
|
|
60
74
|
await this.uiautomator2.jwproxy.command('/appium/gestures/double_click', 'POST', {
|
|
61
75
|
origin: toOrigin(elementId),
|
|
62
76
|
offset: toPoint(x, y),
|
|
@@ -65,12 +79,21 @@ async function mobileDoubleClickGesture(opts = {}) {
|
|
|
65
79
|
/**
|
|
66
80
|
* Drags this object to the specified location.
|
|
67
81
|
* @this {AndroidUiautomator2Driver}
|
|
68
|
-
* @param {
|
|
82
|
+
* @param {string} [elementId] The id of the element to be dragged.
|
|
83
|
+
* If the element id is missing then the start coordinates must be provided.
|
|
84
|
+
* If both the element id and the start coordinates are provided then these
|
|
85
|
+
* coordinates are considered as offsets from the top left element corner.
|
|
86
|
+
* @param {number} [startX] The x coordinate where the dragging starts
|
|
87
|
+
* @param {number} [startY] The y coordinate where the dragging starts
|
|
88
|
+
* @param {number} [endX] The x coordinate where the dragging ends
|
|
89
|
+
* @param {number} [endY] The y coordinate where the dragging ends
|
|
90
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
91
|
+
* The value must not be negative.
|
|
92
|
+
* Default is 2500 * displayDensity.
|
|
69
93
|
* @returns {Promise<void>}
|
|
70
94
|
* @throws {Error} if provided options are not valid
|
|
71
95
|
*/
|
|
72
|
-
async function mobileDragGesture(
|
|
73
|
-
const { elementId, startX, startY, endX, endY, speed } = opts;
|
|
96
|
+
async function mobileDragGesture(elementId, startX, startY, endX, endY, speed) {
|
|
74
97
|
await this.uiautomator2.jwproxy.command('/appium/gestures/drag', 'POST', {
|
|
75
98
|
origin: toOrigin(elementId),
|
|
76
99
|
start: toPoint(startX, startY),
|
|
@@ -83,11 +106,22 @@ async function mobileDragGesture(opts) {
|
|
|
83
106
|
*
|
|
84
107
|
* @throws {Error} if provided options are not valid
|
|
85
108
|
* @this {AndroidUiautomator2Driver}
|
|
86
|
-
* @param {
|
|
109
|
+
* @param {string} direction Direction of the fling.
|
|
110
|
+
* Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
|
|
111
|
+
* @param {string} [elementId] The id of the element to be flinged.
|
|
112
|
+
* If the element id is missing then fling bounding area must be provided.
|
|
113
|
+
* If both the element id and the fling bounding area are provided then this
|
|
114
|
+
* area is effectively ignored.
|
|
115
|
+
* @param {number} [left] The left coordinate of the fling bounding area.
|
|
116
|
+
* @param {number} [top] The top coordinate of the fling bounding area.
|
|
117
|
+
* @param {number} [width] The width of the fling bounding area.
|
|
118
|
+
* @param {number} [height] The height of the fling bounding area.
|
|
119
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
120
|
+
* The value must be greater than the minimum fling velocity for the given view (50 by default).
|
|
121
|
+
* Default is 7500 * displayDensity.
|
|
87
122
|
* @returns {Promise<boolean>} True if the object can still scroll in the given direction.
|
|
88
123
|
*/
|
|
89
|
-
async function mobileFlingGesture(
|
|
90
|
-
const { elementId, left, top, width, height, direction, speed } = opts;
|
|
124
|
+
async function mobileFlingGesture(direction, elementId, left, top, width, height, speed) {
|
|
91
125
|
return /** @type {boolean} */ (await this.uiautomator2.jwproxy.command('/appium/gestures/fling', 'POST', {
|
|
92
126
|
origin: toOrigin(elementId),
|
|
93
127
|
area: toRect(left, top, width, height),
|
|
@@ -98,12 +132,23 @@ async function mobileFlingGesture(opts) {
|
|
|
98
132
|
/**
|
|
99
133
|
* Performs a pinch close gesture.
|
|
100
134
|
* @this {AndroidUiautomator2Driver}
|
|
101
|
-
* @param {
|
|
135
|
+
* @param {number} percent The size of the pinch as a percentage of the pinch area size.
|
|
136
|
+
* Valid values must be float numbers in range 0..1, where 1.0 is 100%
|
|
137
|
+
* @param {string} [elementId] The id of the element to be pinched.
|
|
138
|
+
* If the element id is missing then pinch bounding area must be provided.
|
|
139
|
+
* If both the element id and the pinch bounding area are provided then the
|
|
140
|
+
* area is effectively ignored.
|
|
141
|
+
* @param {number} [left] The left coordinate of the pinch bounding area.
|
|
142
|
+
* @param {number} [top] The top coordinate of the pinch bounding area.
|
|
143
|
+
* @param {number} [width] The width of the pinch bounding area.
|
|
144
|
+
* @param {number} [height] The height of the pinch bounding area.
|
|
145
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
146
|
+
* The value must not be negative.
|
|
147
|
+
* Default is 2500 * displayDensity.
|
|
102
148
|
* @returns {Promise<void>}
|
|
103
149
|
* @throws {Error} if provided options are not valid
|
|
104
150
|
*/
|
|
105
|
-
async function mobilePinchCloseGesture(
|
|
106
|
-
const { elementId, left, top, width, height, percent, speed } = opts;
|
|
151
|
+
async function mobilePinchCloseGesture(percent, elementId, left, top, width, height, speed) {
|
|
107
152
|
await this.uiautomator2.jwproxy.command('/appium/gestures/pinch_close', 'POST', {
|
|
108
153
|
origin: toOrigin(elementId),
|
|
109
154
|
area: toRect(left, top, width, height),
|
|
@@ -114,12 +159,23 @@ async function mobilePinchCloseGesture(opts) {
|
|
|
114
159
|
/**
|
|
115
160
|
* Performs a pinch open gesture.
|
|
116
161
|
* @this {AndroidUiautomator2Driver}
|
|
117
|
-
* @param {
|
|
162
|
+
* @param {number} percent The size of the pinch as a percentage of the pinch area size.
|
|
163
|
+
* Valid values must be float numbers in range 0..1, where 1.0 is 100%
|
|
164
|
+
* @param {string} [elementId] The id of the element to be pinched.
|
|
165
|
+
* If the element id is missing then pinch bounding area must be provided.
|
|
166
|
+
* If both the element id and the pinch bounding area are provided then the
|
|
167
|
+
* area is effectively ignored.
|
|
168
|
+
* @param {number} [left] The left coordinate of the pinch bounding area.
|
|
169
|
+
* @param {number} [top] The top coordinate of the pinch bounding area.
|
|
170
|
+
* @param {number} [width] The width of the pinch bounding area.
|
|
171
|
+
* @param {number} [height] The height of the pinch bounding area.
|
|
172
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
173
|
+
* The value must not be negative.
|
|
174
|
+
* Default is 2500 * displayDensity.
|
|
118
175
|
* @returns {Promise<void>}
|
|
119
176
|
* @throws {Error} if provided options are not valid
|
|
120
177
|
*/
|
|
121
|
-
async function mobilePinchOpenGesture(
|
|
122
|
-
const { elementId, left, top, width, height, percent, speed } = opts;
|
|
178
|
+
async function mobilePinchOpenGesture(percent, elementId, left, top, width, height, speed) {
|
|
123
179
|
await this.uiautomator2.jwproxy.command('/appium/gestures/pinch_open', 'POST', {
|
|
124
180
|
origin: toOrigin(elementId),
|
|
125
181
|
area: toRect(left, top, width, height),
|
|
@@ -130,12 +186,25 @@ async function mobilePinchOpenGesture(opts) {
|
|
|
130
186
|
/**
|
|
131
187
|
* Performs a swipe gesture.
|
|
132
188
|
* @this {AndroidUiautomator2Driver}
|
|
133
|
-
* @param {
|
|
189
|
+
* @param {string} direction Direction of the swipe.
|
|
190
|
+
* Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
|
|
191
|
+
* @param {number} percent The size of the swipe as a percentage of the swipe area size.
|
|
192
|
+
* Valid values must be float numbers in range 0..1, where 1.0 is 100%.
|
|
193
|
+
* @param {string} [elementId] The id of the element to be swiped.
|
|
194
|
+
* If the element id is missing then swipe bounding area must be provided.
|
|
195
|
+
* If both the element id and the swipe bounding area are provided then the
|
|
196
|
+
* area is effectively ignored.
|
|
197
|
+
* @param {number} [left] The left coordinate of the swipe bounding area.
|
|
198
|
+
* @param {number} [top] The top coordinate of the swipe bounding area.
|
|
199
|
+
* @param {number} [width] The width of the swipe bounding area.
|
|
200
|
+
* @param {number} [height] The height of the swipe bounding area.
|
|
201
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
202
|
+
* The value must not be negative.
|
|
203
|
+
* Default is 5000 * displayDensity.
|
|
134
204
|
* @returns {Promise<void>}
|
|
135
205
|
* @throws {Error} if provided options are not valid
|
|
136
206
|
*/
|
|
137
|
-
async function mobileSwipeGesture(
|
|
138
|
-
const { elementId, left, top, width, height, direction, percent, speed } = opts;
|
|
207
|
+
async function mobileSwipeGesture(direction, percent, elementId, left, top, width, height, speed) {
|
|
139
208
|
await this.uiautomator2.jwproxy.command('/appium/gestures/swipe', 'POST', {
|
|
140
209
|
origin: toOrigin(elementId),
|
|
141
210
|
area: toRect(left, top, width, height),
|
|
@@ -149,11 +218,24 @@ async function mobileSwipeGesture(opts) {
|
|
|
149
218
|
*
|
|
150
219
|
* @throws {Error} if provided options are not valid
|
|
151
220
|
* @this {AndroidUiautomator2Driver}
|
|
152
|
-
* @param {
|
|
221
|
+
* @param {string} direction Direction of the scroll.
|
|
222
|
+
* Acceptable values are: `up`, `down`, `left` and `right` (case insensitive).
|
|
223
|
+
* @param {number} percent The size of the scroll as a percentage of the scrolling area size.
|
|
224
|
+
* Valid values must be float numbers greater than zero, where 1.0 is 100%.
|
|
225
|
+
* @param {string} [elementId] The id of the element to be scrolled.
|
|
226
|
+
* If the element id is missing then scroll bounding area must be provided.
|
|
227
|
+
* If both the element id and the scroll bounding area are provided then this
|
|
228
|
+
* area is effectively ignored.
|
|
229
|
+
* @param {number} [left] The left coordinate of the scroll bounding area.
|
|
230
|
+
* @param {number} [top] The top coordinate of the scroll bounding area.
|
|
231
|
+
* @param {number} [width] The width of the scroll bounding area.
|
|
232
|
+
* @param {number} [height] The height of the scroll bounding area.
|
|
233
|
+
* @param {number} [speed] The speed at which to perform this gesture in pixels per second.
|
|
234
|
+
* The value must not be negative.
|
|
235
|
+
* Default is 5000 * displayDensity.
|
|
153
236
|
* @returns {Promise<boolean>} True if the object can still scroll in the given direction.
|
|
154
237
|
*/
|
|
155
|
-
async function mobileScrollGesture(
|
|
156
|
-
const { elementId, left, top, width, height, direction, percent, speed } = opts;
|
|
238
|
+
async function mobileScrollGesture(direction, percent, elementId, left, top, width, height, speed) {
|
|
157
239
|
return /** @type {boolean} */ (await this.uiautomator2.jwproxy.command('/appium/gestures/scroll', 'POST', {
|
|
158
240
|
origin: toOrigin(elementId),
|
|
159
241
|
area: toRect(left, top, width, height),
|
|
@@ -170,12 +252,16 @@ async function mobileScrollGesture(opts) {
|
|
|
170
252
|
* by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
|
|
171
253
|
* is detected automatically.
|
|
172
254
|
* @this {AndroidUiautomator2Driver}
|
|
173
|
-
* @param {
|
|
255
|
+
* @param {string} elementId The identifier of the scrollable element, which is going to be scrolled.
|
|
256
|
+
* It is required this element is a valid scrollable container and it was located
|
|
257
|
+
* by `-android uiautomator` strategy.
|
|
258
|
+
* @param {string} elementToId The identifier of the item, which belongs to the scrollable element above,
|
|
259
|
+
* and which should become visible after the scrolling operation is finished.
|
|
260
|
+
* It is required this element was located by `-android uiautomator` strategy.
|
|
174
261
|
* @returns {Promise<void>}
|
|
175
262
|
* @throws {Error} if the scrolling operation cannot be performed
|
|
176
263
|
*/
|
|
177
|
-
async function mobileScrollBackTo(
|
|
178
|
-
const { elementId, elementToId } = opts;
|
|
264
|
+
async function mobileScrollBackTo(elementId, elementToId) {
|
|
179
265
|
if (!elementId || !elementToId) {
|
|
180
266
|
throw new driver_1.errors.InvalidArgumentError(`Both elementId and elementToId arguments must be provided`);
|
|
181
267
|
}
|
|
@@ -188,13 +274,24 @@ async function mobileScrollBackTo(opts) {
|
|
|
188
274
|
* to the very beginning of the scrollable control and tries to reach the destination element
|
|
189
275
|
* by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
|
|
190
276
|
* is detected automatically.
|
|
277
|
+
*
|
|
191
278
|
* @this {AndroidUiautomator2Driver}
|
|
192
|
-
* @param {
|
|
279
|
+
* @param {string} strategy The following strategies are supported:
|
|
280
|
+
* - `accessibility id` (UiSelector().description)
|
|
281
|
+
* - `class name` (UiSelector().className)
|
|
282
|
+
* - `-android uiautomator` (UiSelector)
|
|
283
|
+
* @param {string} selector The corresponding lookup value for the given strategy.
|
|
284
|
+
* @param {string} [elementId] The identifier of an element. It is required this element is a valid scrollable container
|
|
285
|
+
* and it was located by `-android uiautomator` strategy.
|
|
286
|
+
* If this property is not provided then the first currently available scrollable view
|
|
287
|
+
* is selected for the interaction.
|
|
288
|
+
* @param {number} [maxSwipes] The maximum number of swipes to perform on the target scrollable view in order to reach
|
|
289
|
+
* the destination element. In case this value is unset then it would be retrieved from the
|
|
290
|
+
* scrollable element itself (via `getMaxSearchSwipes()` property).
|
|
193
291
|
* @returns {Promise<void>}
|
|
194
292
|
* @throws {Error} if the scrolling operation cannot be performed
|
|
195
293
|
*/
|
|
196
|
-
async function mobileScroll(
|
|
197
|
-
const { elementId, strategy, selector, maxSwipes, } = opts;
|
|
294
|
+
async function mobileScroll(strategy, selector, elementId, maxSwipes) {
|
|
198
295
|
if (!strategy || !selector) {
|
|
199
296
|
throw new driver_1.errors.InvalidArgumentError(`Both strategy and selector arguments must be provided`);
|
|
200
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.js"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gestures.js","sourceRoot":"","sources":["../../../lib/commands/gestures.js"],"names":[],"mappings":";;;;;AAiBA,gDASC;AAiBD,wDAUC;AAcD,4DASC;AAmBD,8CAkBC;AAsBD,gDAqBC;AAqBD,0DAmBC;AAqBD,wDAmBC;AAuBD,gDAqBC;AAwBD,kDAuBC;AAmBD,gDAaC;AA0BD,oCAmBC;AApZD,4CAAoC;AACpC,oDAAuB;AACvB,0CAAqC;AAErC;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,kBAAkB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC;IACtD,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,wBAAwB,EACxB,MAAM,EACN;QACE,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;QAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;KACtB,CACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,sBAAsB,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ;IACpE,MAAM,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CACrC,6BAA6B,EAC7B,MAAM,EACN;QACE,MAAM,EAAE,QAAQ,CAAC,SAAS,CAAC;QAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;QACrB,QAAQ;KACT,CACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,wBAAw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C,CAAC,CAAC,cAAI,CAAC,WAAW,CAAC,cAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7E,CAAC;AAED;;;;;GAKG;AACH,SAAS,OAAO,CAAC,CAAC,EAAE,CAAC;IACnB,OAAO,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM;IACtC,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,gBAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC3D,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,EAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAC,CAAC;AACjC,CAAC;AAED,aAAa;AAEb;;GAEG"}
|
|
@@ -16,20 +16,27 @@ export function pressKeyCode(this: import("../driver").AndroidUiautomator2Driver
|
|
|
16
16
|
export function longPressKeyCode(this: import("../driver").AndroidUiautomator2Driver, keycode: string | number, metastate: number, flags?: number): Promise<void>;
|
|
17
17
|
/**
|
|
18
18
|
* @this {AndroidUiautomator2Driver}
|
|
19
|
-
* @param {
|
|
19
|
+
* @param {number} keycode A valid Android key code. See https://developer.android.com/reference/android/view/KeyEvent
|
|
20
|
+
* for the list of available key codes.
|
|
21
|
+
* @param {number} [metastate] An integer in which each bit set to 1 represents a pressed meta key. See
|
|
22
|
+
* https://developer.android.com/reference/android/view/KeyEvent for more details.
|
|
23
|
+
* @param {string} [flags] Flags for the particular key event. See
|
|
24
|
+
* https://developer.android.com/reference/android/view/KeyEvent for more details.
|
|
25
|
+
* @param {boolean} [isLongPress=false] Whether to emulate long key press
|
|
20
26
|
* @returns {Promise<void>}
|
|
21
27
|
*/
|
|
22
|
-
export function mobilePressKey(this: import("../driver").AndroidUiautomator2Driver,
|
|
28
|
+
export function mobilePressKey(this: import("../driver").AndroidUiautomator2Driver, keycode: number, metastate?: number, flags?: string, isLongPress?: boolean): Promise<void>;
|
|
23
29
|
/**
|
|
24
30
|
* Types the given Unicode string.
|
|
25
31
|
* It is expected that the focus is already put
|
|
26
32
|
* to the destination input field before this method is called.
|
|
33
|
+
*
|
|
27
34
|
* @this {AndroidUiautomator2Driver}
|
|
28
|
-
* @param {
|
|
35
|
+
* @param {string | number | boolean} text The text to type. Can be a string, number or boolean.
|
|
29
36
|
* @returns {Promise<boolean>} `true` if the input text has been successfully sent to adb
|
|
30
37
|
* @throws {Error} if `text` property has not been provided
|
|
31
38
|
*/
|
|
32
|
-
export function mobileType(this: import("../driver").AndroidUiautomator2Driver,
|
|
39
|
+
export function mobileType(this: import("../driver").AndroidUiautomator2Driver, text: string | number | boolean): Promise<boolean>;
|
|
33
40
|
/**
|
|
34
41
|
* @this {AndroidUiautomator2Driver}
|
|
35
42
|
* @param {import('appium-android-driver').SendKeysOpts} params
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.js"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,2FALW,MAAM,GAAC,MAAM,cACb,MAAM,UACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAYzB;AAED;;;;;;GAMG;AACH,+FALW,MAAM,GAAC,MAAM,aACb,MAAM,UACN,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAYzB;AAED;;;;;;;;;;GAUG;AACH,6FATW,MAAM,cAEN,MAAM,UAEN,MAAM,gBAEN,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CAYzB;AAED;;;;;;;;;GASG;AACH,sFAJW,MAAM,GAAG,MAAM,GAAG,OAAO,GACvB,OAAO,CAAC,OAAO,CAAC,CAQ5B;AAED;;;;GAIG;AACH,wFAHW,OAAO,uBAAuB,EAAE,YAAY,GAC1C,OAAO,CAAC,IAAI,CAAC,CAQzB;AAED;;;;;GAKG;AACH,uFAJW,MAAM,GAAC,MAAM,cACb,MAAM,GACJ,OAAO,CAAC,IAAI,CAAC,CAKzB;wCAGY,OAAO,WAAW,EAAE,yBAAyB"}
|
|
@@ -9,6 +9,7 @@ exports.mobilePressKey = mobilePressKey;
|
|
|
9
9
|
exports.mobileType = mobileType;
|
|
10
10
|
exports.doSendKeys = doSendKeys;
|
|
11
11
|
exports.keyevent = keyevent;
|
|
12
|
+
const driver_1 = require("appium/driver");
|
|
12
13
|
const lodash_1 = __importDefault(require("lodash"));
|
|
13
14
|
/**
|
|
14
15
|
* @this {AndroidUiautomator2Driver}
|
|
@@ -40,11 +41,16 @@ async function longPressKeyCode(keycode, metastate, flags) {
|
|
|
40
41
|
}
|
|
41
42
|
/**
|
|
42
43
|
* @this {AndroidUiautomator2Driver}
|
|
43
|
-
* @param {
|
|
44
|
+
* @param {number} keycode A valid Android key code. See https://developer.android.com/reference/android/view/KeyEvent
|
|
45
|
+
* for the list of available key codes.
|
|
46
|
+
* @param {number} [metastate] An integer in which each bit set to 1 represents a pressed meta key. See
|
|
47
|
+
* https://developer.android.com/reference/android/view/KeyEvent for more details.
|
|
48
|
+
* @param {string} [flags] Flags for the particular key event. See
|
|
49
|
+
* https://developer.android.com/reference/android/view/KeyEvent for more details.
|
|
50
|
+
* @param {boolean} [isLongPress=false] Whether to emulate long key press
|
|
44
51
|
* @returns {Promise<void>}
|
|
45
52
|
*/
|
|
46
|
-
async function mobilePressKey(
|
|
47
|
-
const { keycode, metastate, flags, isLongPress = false } = opts;
|
|
53
|
+
async function mobilePressKey(keycode, metastate, flags, isLongPress = false) {
|
|
48
54
|
await this.uiautomator2.jwproxy.command(`/appium/device/${isLongPress ? 'long_' : ''}press_keycode`, 'POST', {
|
|
49
55
|
keycode,
|
|
50
56
|
metastate,
|
|
@@ -55,15 +61,15 @@ async function mobilePressKey(opts) {
|
|
|
55
61
|
* Types the given Unicode string.
|
|
56
62
|
* It is expected that the focus is already put
|
|
57
63
|
* to the destination input field before this method is called.
|
|
64
|
+
*
|
|
58
65
|
* @this {AndroidUiautomator2Driver}
|
|
59
|
-
* @param {
|
|
66
|
+
* @param {string | number | boolean} text The text to type. Can be a string, number or boolean.
|
|
60
67
|
* @returns {Promise<boolean>} `true` if the input text has been successfully sent to adb
|
|
61
68
|
* @throws {Error} if `text` property has not been provided
|
|
62
69
|
*/
|
|
63
|
-
async function mobileType(
|
|
64
|
-
const { text } = opts;
|
|
70
|
+
async function mobileType(text) {
|
|
65
71
|
if (lodash_1.default.isUndefined(text)) {
|
|
66
|
-
throw
|
|
72
|
+
throw new driver_1.errors.InvalidArgumentError(`The 'text' argument is mandatory`);
|
|
67
73
|
}
|
|
68
74
|
return await this.settingsApp.typeUnicode(String(text));
|
|
69
75
|
}
|