appium-uiautomator2-driver 6.7.5 → 6.7.7

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/lib/commands/actions.d.ts +26 -29
  3. package/build/lib/commands/actions.d.ts.map +1 -1
  4. package/build/lib/commands/actions.js +19 -27
  5. package/build/lib/commands/actions.js.map +1 -1
  6. package/build/lib/commands/alert.d.ts +14 -22
  7. package/build/lib/commands/alert.d.ts.map +1 -1
  8. package/build/lib/commands/alert.js +8 -19
  9. package/build/lib/commands/alert.js.map +1 -1
  10. package/build/lib/commands/app-management.d.ts +7 -10
  11. package/build/lib/commands/app-management.d.ts.map +1 -1
  12. package/build/lib/commands/app-management.js +4 -14
  13. package/build/lib/commands/app-management.js.map +1 -1
  14. package/build/lib/commands/battery.d.ts +4 -5
  15. package/build/lib/commands/battery.d.ts.map +1 -1
  16. package/build/lib/commands/battery.js +4 -9
  17. package/build/lib/commands/battery.js.map +1 -1
  18. package/build/lib/commands/clipboard.d.ts +9 -13
  19. package/build/lib/commands/clipboard.d.ts.map +1 -1
  20. package/build/lib/commands/clipboard.js +7 -14
  21. package/build/lib/commands/clipboard.js.map +1 -1
  22. package/build/lib/commands/element.d.ts +64 -69
  23. package/build/lib/commands/element.d.ts.map +1 -1
  24. package/build/lib/commands/element.js +64 -84
  25. package/build/lib/commands/element.js.map +1 -1
  26. package/build/lib/commands/find.d.ts +13 -9
  27. package/build/lib/commands/find.d.ts.map +1 -1
  28. package/build/lib/commands/find.js +4 -16
  29. package/build/lib/commands/find.js.map +1 -1
  30. package/build/lib/commands/gestures.d.ts +87 -189
  31. package/build/lib/commands/gestures.d.ts.map +1 -1
  32. package/build/lib/commands/gestures.js +77 -204
  33. package/build/lib/commands/gestures.js.map +1 -1
  34. package/build/lib/commands/keyboard.d.ts +30 -41
  35. package/build/lib/commands/keyboard.d.ts.map +1 -1
  36. package/build/lib/commands/keyboard.js +22 -37
  37. package/build/lib/commands/keyboard.js.map +1 -1
  38. package/build/lib/commands/misc.d.ts +19 -35
  39. package/build/lib/commands/misc.d.ts.map +1 -1
  40. package/build/lib/commands/misc.js +15 -30
  41. package/build/lib/commands/misc.js.map +1 -1
  42. package/build/lib/commands/navigation.d.ts +11 -16
  43. package/build/lib/commands/navigation.d.ts.map +1 -1
  44. package/build/lib/commands/navigation.js +9 -17
  45. package/build/lib/commands/navigation.js.map +1 -1
  46. package/build/lib/commands/viewport.d.ts +23 -22
  47. package/build/lib/commands/viewport.d.ts.map +1 -1
  48. package/build/lib/commands/viewport.js +17 -24
  49. package/build/lib/commands/viewport.js.map +1 -1
  50. package/build/tsconfig.tsbuildinfo +1 -1
  51. package/lib/commands/actions.ts +95 -0
  52. package/lib/commands/alert.ts +46 -0
  53. package/lib/commands/app-management.ts +25 -0
  54. package/lib/commands/battery.ts +19 -0
  55. package/lib/commands/clipboard.ts +29 -0
  56. package/lib/commands/element.ts +180 -0
  57. package/lib/commands/find.ts +48 -0
  58. package/lib/commands/gestures.ts +297 -0
  59. package/lib/commands/keyboard.ts +102 -0
  60. package/lib/commands/misc.ts +67 -0
  61. package/lib/commands/navigation.ts +32 -0
  62. package/lib/commands/viewport.ts +78 -0
  63. package/npm-shrinkwrap.json +16 -46
  64. package/package.json +1 -1
  65. package/lib/commands/actions.js +0 -107
  66. package/lib/commands/alert.js +0 -63
  67. package/lib/commands/app-management.js +0 -32
  68. package/lib/commands/battery.js +0 -23
  69. package/lib/commands/clipboard.js +0 -37
  70. package/lib/commands/element.js +0 -261
  71. package/lib/commands/find.js +0 -47
  72. package/lib/commands/gestures.js +0 -446
  73. package/lib/commands/keyboard.js +0 -108
  74. package/lib/commands/misc.js +0 -109
  75. package/lib/commands/navigation.js +0 -33
  76. package/lib/commands/viewport.js +0 -100
@@ -14,21 +14,14 @@ exports.mobileSwipeGesture = mobileSwipeGesture;
14
14
  exports.mobileScrollGesture = mobileScrollGesture;
15
15
  exports.mobileScrollBackTo = mobileScrollBackTo;
16
16
  exports.mobileScroll = mobileScroll;
17
+ const driver_1 = require("appium/driver");
17
18
  const support_1 = require("appium/support");
18
19
  const lodash_1 = __importDefault(require("lodash"));
19
- const driver_1 = require("appium/driver");
20
20
  /**
21
- * Performs a simple click/tap gesture
22
- *
23
- * @this {AndroidUiautomator2Driver}
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.
30
- * @returns {Promise<void>}
31
- * @throws {Error} if provided options are not valid
21
+ * Performs a simple click/tap gesture.
22
+ * @param elementId - Optional element to use as the origin for the click. If not provided, uses screen coordinates.
23
+ * @param x - Optional X offset from the element origin or screen.
24
+ * @param y - Optional Y offset from the element origin or screen.
32
25
  */
33
26
  async function mobileClickGesture(elementId, x, y) {
34
27
  await this.uiautomator2.jwproxy.command('/appium/gestures/click', 'POST', {
@@ -37,19 +30,11 @@ async function mobileClickGesture(elementId, x, y) {
37
30
  });
38
31
  }
39
32
  /**
40
- * Performs a click that lasts for the given duration
41
- *
42
- * @this {AndroidUiautomator2Driver}
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.
51
- * @returns {Promise<void>}
52
- * @throws {Error} if provided options are not valid
33
+ * Performs a long click with an optional duration.
34
+ * @param elementId - Optional element to use as the origin for the long click.
35
+ * @param x - Optional X offset from the element origin or screen.
36
+ * @param y - Optional Y offset from the element origin or screen.
37
+ * @param duration - Optional duration of the long press in milliseconds.
53
38
  */
54
39
  async function mobileLongClickGesture(elementId, x, y, duration) {
55
40
  await this.uiautomator2.jwproxy.command('/appium/gestures/long_click', 'POST', {
@@ -59,16 +44,10 @@ async function mobileLongClickGesture(elementId, x, y, duration) {
59
44
  });
60
45
  }
61
46
  /**
62
- * Performs a click that lasts for the given duration
63
- * @this {AndroidUiautomator2Driver}
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.
70
- * @returns {Promise<void>}
71
- * @throws {Error} if provided options are not valid
47
+ * Performs a double-click gesture.
48
+ * @param elementId - Optional element to use as the origin for the double click.
49
+ * @param x - Optional X offset from the element origin or screen.
50
+ * @param y - Optional Y offset from the element origin or screen.
72
51
  */
73
52
  async function mobileDoubleClickGesture(elementId, x, y) {
74
53
  await this.uiautomator2.jwproxy.command('/appium/gestures/double_click', 'POST', {
@@ -77,21 +56,13 @@ async function mobileDoubleClickGesture(elementId, x, y) {
77
56
  });
78
57
  }
79
58
  /**
80
- * Drags this object to the specified location.
81
- * @this {AndroidUiautomator2Driver}
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.
93
- * @returns {Promise<void>}
94
- * @throws {Error} if provided options are not valid
59
+ * Drags from a start point to an end point.
60
+ * @param elementId - Optional element to use as the origin for the drag.
61
+ * @param startX - X coordinate of the drag start point.
62
+ * @param startY - Y coordinate of the drag start point.
63
+ * @param endX - X coordinate of the drag end point.
64
+ * @param endY - Y coordinate of the drag end point.
65
+ * @param speed - Optional speed of the drag gesture.
95
66
  */
96
67
  async function mobileDragGesture(elementId, startX, startY, endX, endY, speed) {
97
68
  await this.uiautomator2.jwproxy.command('/appium/gestures/drag', 'POST', {
@@ -102,27 +73,18 @@ async function mobileDragGesture(elementId, startX, startY, endX, endY, speed) {
102
73
  });
103
74
  }
104
75
  /**
105
- * Drags to the specified location.
106
- *
107
- * @throws {Error} if provided options are not valid
108
- * @this {AndroidUiautomator2Driver}
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.
122
- * @returns {Promise<boolean>} True if the object can still scroll in the given direction.
76
+ * Performs a fling gesture and reports if further scrolling is possible.
77
+ * @param direction - Direction of the fling ('up', 'down', 'left', 'right').
78
+ * @param elementId - Optional element to use as the origin for the fling.
79
+ * @param left - Optional left coordinate of the fling area.
80
+ * @param top - Optional top coordinate of the fling area.
81
+ * @param width - Optional width of the fling area.
82
+ * @param height - Optional height of the fling area.
83
+ * @param speed - Optional speed of the fling gesture.
84
+ * @returns True if further scrolling is possible, false otherwise.
123
85
  */
124
86
  async function mobileFlingGesture(direction, elementId, left, top, width, height, speed) {
125
- return /** @type {boolean} */ (await this.uiautomator2.jwproxy.command('/appium/gestures/fling', 'POST', {
87
+ return (await this.uiautomator2.jwproxy.command('/appium/gestures/fling', 'POST', {
126
88
  origin: toOrigin(elementId),
127
89
  area: toRect(left, top, width, height),
128
90
  direction,
@@ -130,23 +92,14 @@ async function mobileFlingGesture(direction, elementId, left, top, width, height
130
92
  }));
131
93
  }
132
94
  /**
133
- * Performs a pinch close gesture.
134
- * @this {AndroidUiautomator2Driver}
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.
148
- * @returns {Promise<void>}
149
- * @throws {Error} if provided options are not valid
95
+ * Performs a pinch-close gesture.
96
+ * @param percent - Percentage of the pinch (0-100).
97
+ * @param elementId - Optional element to use as the origin for the pinch.
98
+ * @param left - Optional left coordinate of the pinch area.
99
+ * @param top - Optional top coordinate of the pinch area.
100
+ * @param width - Optional width of the pinch area.
101
+ * @param height - Optional height of the pinch area.
102
+ * @param speed - Optional speed of the pinch gesture.
150
103
  */
151
104
  async function mobilePinchCloseGesture(percent, elementId, left, top, width, height, speed) {
152
105
  await this.uiautomator2.jwproxy.command('/appium/gestures/pinch_close', 'POST', {
@@ -157,23 +110,14 @@ async function mobilePinchCloseGesture(percent, elementId, left, top, width, hei
157
110
  });
158
111
  }
159
112
  /**
160
- * Performs a pinch open gesture.
161
- * @this {AndroidUiautomator2Driver}
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.
175
- * @returns {Promise<void>}
176
- * @throws {Error} if provided options are not valid
113
+ * Performs a pinch-open gesture.
114
+ * @param percent - Percentage of the pinch (0-100).
115
+ * @param elementId - Optional element to use as the origin for the pinch.
116
+ * @param left - Optional left coordinate of the pinch area.
117
+ * @param top - Optional top coordinate of the pinch area.
118
+ * @param width - Optional width of the pinch area.
119
+ * @param height - Optional height of the pinch area.
120
+ * @param speed - Optional speed of the pinch gesture.
177
121
  */
178
122
  async function mobilePinchOpenGesture(percent, elementId, left, top, width, height, speed) {
179
123
  await this.uiautomator2.jwproxy.command('/appium/gestures/pinch_open', 'POST', {
@@ -184,25 +128,15 @@ async function mobilePinchOpenGesture(percent, elementId, left, top, width, heig
184
128
  });
185
129
  }
186
130
  /**
187
- * Performs a swipe gesture.
188
- * @this {AndroidUiautomator2Driver}
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.
204
- * @returns {Promise<void>}
205
- * @throws {Error} if provided options are not valid
131
+ * Performs a swipe gesture for the given direction and percent.
132
+ * @param direction - Direction of the swipe ('up', 'down', 'left', 'right').
133
+ * @param percent - Percentage of the swipe distance (0-100).
134
+ * @param elementId - Optional element to use as the origin for the swipe.
135
+ * @param left - Optional left coordinate of the swipe area.
136
+ * @param top - Optional top coordinate of the swipe area.
137
+ * @param width - Optional width of the swipe area.
138
+ * @param height - Optional height of the swipe area.
139
+ * @param speed - Optional speed of the swipe gesture.
206
140
  */
207
141
  async function mobileSwipeGesture(direction, percent, elementId, left, top, width, height, speed) {
208
142
  await this.uiautomator2.jwproxy.command('/appium/gestures/swipe', 'POST', {
@@ -214,29 +148,19 @@ async function mobileSwipeGesture(direction, percent, elementId, left, top, widt
214
148
  });
215
149
  }
216
150
  /**
217
- * Performs a scroll gesture.
218
- *
219
- * @throws {Error} if provided options are not valid
220
- * @this {AndroidUiautomator2Driver}
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.
236
- * @returns {Promise<boolean>} True if the object can still scroll in the given direction.
151
+ * Performs a scroll gesture and reports if further scrolling is possible.
152
+ * @param direction - Direction of the scroll ('up', 'down', 'left', 'right').
153
+ * @param percent - Percentage of the scroll distance (0-100).
154
+ * @param elementId - Optional element to use as the origin for the scroll.
155
+ * @param left - Optional left coordinate of the scroll area.
156
+ * @param top - Optional top coordinate of the scroll area.
157
+ * @param width - Optional width of the scroll area.
158
+ * @param height - Optional height of the scroll area.
159
+ * @param speed - Optional speed of the scroll gesture.
160
+ * @returns True if further scrolling is possible, false otherwise.
237
161
  */
238
162
  async function mobileScrollGesture(direction, percent, elementId, left, top, width, height, speed) {
239
- return /** @type {boolean} */ (await this.uiautomator2.jwproxy.command('/appium/gestures/scroll', 'POST', {
163
+ return (await this.uiautomator2.jwproxy.command('/appium/gestures/scroll', 'POST', {
240
164
  origin: toOrigin(elementId),
241
165
  area: toRect(left, top, width, height),
242
166
  direction,
@@ -245,21 +169,10 @@ async function mobileScrollGesture(direction, percent, elementId, left, top, wid
245
169
  }));
246
170
  }
247
171
  /**
248
- * Scrolls the given scrollable element `elementId` until `elementToId`
249
- * becomes visible. This function returns immediately if the `elementToId`
250
- * is already visible in the view port. Otherwise it would scroll
251
- * to the very beginning of the scrollable control and tries to reach the destination element
252
- * by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
253
- * is detected automatically.
254
- * @this {AndroidUiautomator2Driver}
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.
261
- * @returns {Promise<void>}
262
- * @throws {Error} if the scrolling operation cannot be performed
172
+ * Scrolls a scrollable element until a target element becomes visible.
173
+ * @param elementId - ID of the scrollable element.
174
+ * @param elementToId - ID of the target element to scroll to.
175
+ * @throws {errors.InvalidArgumentError} If either elementId or elementToId is not provided.
263
176
  */
264
177
  async function mobileScrollBackTo(elementId, elementToId) {
265
178
  if (!elementId || !elementToId) {
@@ -268,28 +181,12 @@ async function mobileScrollBackTo(elementId, elementToId) {
268
181
  await this.uiautomator2.jwproxy.command(`/appium/element/${support_1.util.unwrapElement(elementId)}/scroll_to/${support_1.util.unwrapElement(elementToId)}`, 'POST', {});
269
182
  }
270
183
  /**
271
- * Scrolls the given scrollable element until the element identified
272
- * by `strategy` and `selector` becomes visible. This function returns immediately if the
273
- * destination element is already visible in the view port. Otherwise it would scroll
274
- * to the very beginning of the scrollable control and tries to reach the destination element
275
- * by scrolling its parent to the end step by step. The scroll direction (vertical or horizontal)
276
- * is detected automatically.
277
- *
278
- * @this {AndroidUiautomator2Driver}
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).
291
- * @returns {Promise<void>}
292
- * @throws {Error} if the scrolling operation cannot be performed
184
+ * Scrolls until an element located by the given strategy is visible.
185
+ * @param strategy - Locator strategy to use (e.g., 'id', 'xpath', 'class name').
186
+ * @param selector - Selector string for the element to find.
187
+ * @param elementId - Optional element to use as the origin for scrolling.
188
+ * @param maxSwipes - Optional maximum number of swipes to perform.
189
+ * @throws {errors.InvalidArgumentError} If either strategy or selector is not provided.
293
190
  */
294
191
  async function mobileScroll(strategy, selector, elementId, maxSwipes) {
295
192
  if (!strategy || !selector) {
@@ -300,39 +197,15 @@ async function mobileScroll(strategy, selector, elementId, maxSwipes) {
300
197
  params: { strategy, selector, maxSwipes },
301
198
  });
302
199
  }
303
- // #region Internal Helpers
304
- /**
305
- *
306
- * @param {import('@appium/types').Element|string} [element]
307
- * @returns {import('@appium/types').Element|undefined}
308
- */
309
200
  function toOrigin(element) {
310
201
  return element ? support_1.util.wrapElement(support_1.util.unwrapElement(element)) : undefined;
311
202
  }
312
- /**
313
- *
314
- * @param {number} [x]
315
- * @param {number} [y]
316
- * @returns {Partial<import('@appium/types').Position>|undefined}
317
- */
318
203
  function toPoint(x, y) {
319
204
  return lodash_1.default.isFinite(x) && lodash_1.default.isFinite(y) ? { x, y } : undefined;
320
205
  }
321
- /**
322
- *
323
- * @param {number} [left]
324
- * @param {number} [top]
325
- * @param {number} [width]
326
- * @param {number} [height]
327
- * @returns {Partial<import('./types').RelativeRect>|undefined}
328
- */
329
206
  function toRect(left, top, width, height) {
330
207
  return [left, top, width, height].some((v) => !lodash_1.default.isFinite(v))
331
208
  ? undefined
332
209
  : { left, top, width, height };
333
210
  }
334
- // #endregion
335
- /**
336
- * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
337
- */
338
211
  //# sourceMappingURL=gestures.js.map
@@ -1 +1 @@
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,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,GAAG,EAAE,KAAK,EAAE,MAAM,EAAkB,CAAC;AACnD,CAAC"}
@@ -1,54 +1,43 @@
1
+ import type { AndroidUiautomator2Driver } from '../driver';
2
+ import type { SendKeysOpts } from 'appium-android-driver';
1
3
  /**
2
- * @this {AndroidUiautomator2Driver}
3
- * @param {string|number} keycode
4
- * @param {number} [metastate]
5
- * @param {number} [flags]
6
- * @returns {Promise<void>}
4
+ * Presses a key code with optional metastate and flags.
5
+ * @param keycode - Android key code to press.
6
+ * @param metastate - Optional meta state modifier keys.
7
+ * @param flags - Optional flags for the key event.
7
8
  */
8
- export function pressKeyCode(this: import("../driver").AndroidUiautomator2Driver, keycode: string | number, metastate?: number, flags?: number): Promise<void>;
9
+ export declare function pressKeyCode(this: AndroidUiautomator2Driver, keycode: string | number, metastate?: number, flags?: number): Promise<void>;
9
10
  /**
10
- * @this {AndroidUiautomator2Driver}
11
- * @param {string|number} keycode
12
- * @param {number} metastate
13
- * @param {number} [flags]
14
- * @returns {Promise<void>}
11
+ * Long presses a key code with optional metastate and flags.
12
+ * @param keycode - Android key code to long press.
13
+ * @param metastate - Meta state modifier keys.
14
+ * @param flags - Optional flags for the key event.
15
15
  */
16
- export function longPressKeyCode(this: import("../driver").AndroidUiautomator2Driver, keycode: string | number, metastate: number, flags?: number): Promise<void>;
16
+ export declare function longPressKeyCode(this: AndroidUiautomator2Driver, keycode: string | number, metastate: number, flags?: number): Promise<void>;
17
17
  /**
18
- * @this {AndroidUiautomator2Driver}
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
26
- * @returns {Promise<void>}
18
+ * Presses a key code with optional metastate, flags, and long press support.
19
+ * @param keycode - Android key code to press.
20
+ * @param metastate - Optional meta state modifier keys.
21
+ * @param flags - Optional flags for the key event.
22
+ * @param isLongPress - Whether to perform a long press. Defaults to false.
27
23
  */
28
- export function mobilePressKey(this: import("../driver").AndroidUiautomator2Driver, keycode: number, metastate?: number, flags?: string, isLongPress?: boolean): Promise<void>;
24
+ export declare function mobilePressKey(this: AndroidUiautomator2Driver, keycode: number, metastate?: number, flags?: string, isLongPress?: boolean): Promise<void>;
29
25
  /**
30
- * Types the given Unicode string.
31
- * It is expected that the focus is already put
32
- * to the destination input field before this method is called.
33
- *
34
- * @this {AndroidUiautomator2Driver}
35
- * @param {string | number | boolean} text The text to type. Can be a string, number or boolean.
36
- * @returns {Promise<boolean>} `true` if the input text has been successfully sent to adb
37
- * @throws {Error} if `text` property has not been provided
26
+ * Types the given Unicode string. The focus should already be on the destination input field.
27
+ * @param text - Text to type. Can be a string, number, or boolean.
28
+ * @returns True if the input text has been successfully sent to adb.
29
+ * @throws {errors.InvalidArgumentError} If the text argument is not provided.
38
30
  */
39
- export function mobileType(this: import("../driver").AndroidUiautomator2Driver, text: string | number | boolean): Promise<boolean>;
31
+ export declare function mobileType(this: AndroidUiautomator2Driver, text: string | number | boolean): Promise<boolean>;
40
32
  /**
41
- * @this {AndroidUiautomator2Driver}
42
- * @param {import('appium-android-driver').SendKeysOpts} params
43
- * @returns {Promise<void>}
33
+ * Sends keys to the current element.
34
+ * @param params - Options containing the text to send and optional replace flag.
44
35
  */
45
- export function doSendKeys(this: import("../driver").AndroidUiautomator2Driver, params: import("appium-android-driver").SendKeysOpts): Promise<void>;
36
+ export declare function doSendKeys(this: AndroidUiautomator2Driver, params: SendKeysOpts): Promise<void>;
46
37
  /**
47
- * @this {AndroidUiautomator2Driver}
48
- * @param {string|number} keycode
49
- * @param {number} [metastate]
50
- * @returns {Promise<void>}
38
+ * Sends a key event to the device.
39
+ * @param keycode - Android key code to send.
40
+ * @param metastate - Optional meta state (ignored in this implementation).
51
41
  */
52
- export function keyevent(this: import("../driver").AndroidUiautomator2Driver, keycode: string | number, metastate?: number): Promise<void>;
53
- export type AndroidUiautomator2Driver = import("../driver").AndroidUiautomator2Driver;
42
+ export declare function keyevent(this: AndroidUiautomator2Driver, keycode: string | number, metastate?: number): Promise<void>;
54
43
  //# sourceMappingURL=keyboard.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../lib/commands/keyboard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAExD;;;;;GAKG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,CAAC,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,EACd,WAAW,GAAE,OAAe,GAC3B,OAAO,CAAC,IAAI,CAAC,CAMf;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,yBAAyB,EAC/B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAC9B,OAAO,CAAC,OAAO,CAAC,CAKlB;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAErG;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,IAAI,EAAE,yBAAyB,EAC/B,OAAO,EAAE,MAAM,GAAG,MAAM,EACxB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CAGf"}
@@ -12,11 +12,10 @@ exports.keyevent = keyevent;
12
12
  const driver_1 = require("appium/driver");
13
13
  const lodash_1 = __importDefault(require("lodash"));
14
14
  /**
15
- * @this {AndroidUiautomator2Driver}
16
- * @param {string|number} keycode
17
- * @param {number} [metastate]
18
- * @param {number} [flags]
19
- * @returns {Promise<void>}
15
+ * Presses a key code with optional metastate and flags.
16
+ * @param keycode - Android key code to press.
17
+ * @param metastate - Optional meta state modifier keys.
18
+ * @param flags - Optional flags for the key event.
20
19
  */
21
20
  async function pressKeyCode(keycode, metastate, flags) {
22
21
  await this.uiautomator2.jwproxy.command('/appium/device/press_keycode', 'POST', {
@@ -26,11 +25,10 @@ async function pressKeyCode(keycode, metastate, flags) {
26
25
  });
27
26
  }
28
27
  /**
29
- * @this {AndroidUiautomator2Driver}
30
- * @param {string|number} keycode
31
- * @param {number} metastate
32
- * @param {number} [flags]
33
- * @returns {Promise<void>}
28
+ * Long presses a key code with optional metastate and flags.
29
+ * @param keycode - Android key code to long press.
30
+ * @param metastate - Meta state modifier keys.
31
+ * @param flags - Optional flags for the key event.
34
32
  */
35
33
  async function longPressKeyCode(keycode, metastate, flags) {
36
34
  await this.uiautomator2.jwproxy.command('/appium/device/long_press_keycode', 'POST', {
@@ -40,15 +38,11 @@ async function longPressKeyCode(keycode, metastate, flags) {
40
38
  });
41
39
  }
42
40
  /**
43
- * @this {AndroidUiautomator2Driver}
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
51
- * @returns {Promise<void>}
41
+ * Presses a key code with optional metastate, flags, and long press support.
42
+ * @param keycode - Android key code to press.
43
+ * @param metastate - Optional meta state modifier keys.
44
+ * @param flags - Optional flags for the key event.
45
+ * @param isLongPress - Whether to perform a long press. Defaults to false.
52
46
  */
53
47
  async function mobilePressKey(keycode, metastate, flags, isLongPress = false) {
54
48
  await this.uiautomator2.jwproxy.command(`/appium/device/${isLongPress ? 'long_' : ''}press_keycode`, 'POST', {
@@ -58,14 +52,10 @@ async function mobilePressKey(keycode, metastate, flags, isLongPress = false) {
58
52
  });
59
53
  }
60
54
  /**
61
- * Types the given Unicode string.
62
- * It is expected that the focus is already put
63
- * to the destination input field before this method is called.
64
- *
65
- * @this {AndroidUiautomator2Driver}
66
- * @param {string | number | boolean} text The text to type. Can be a string, number or boolean.
67
- * @returns {Promise<boolean>} `true` if the input text has been successfully sent to adb
68
- * @throws {Error} if `text` property has not been provided
55
+ * Types the given Unicode string. The focus should already be on the destination input field.
56
+ * @param text - Text to type. Can be a string, number, or boolean.
57
+ * @returns True if the input text has been successfully sent to adb.
58
+ * @throws {errors.InvalidArgumentError} If the text argument is not provided.
69
59
  */
70
60
  async function mobileType(text) {
71
61
  if (lodash_1.default.isUndefined(text)) {
@@ -74,24 +64,19 @@ async function mobileType(text) {
74
64
  return await this.settingsApp.typeUnicode(String(text));
75
65
  }
76
66
  /**
77
- * @this {AndroidUiautomator2Driver}
78
- * @param {import('appium-android-driver').SendKeysOpts} params
79
- * @returns {Promise<void>}
67
+ * Sends keys to the current element.
68
+ * @param params - Options containing the text to send and optional replace flag.
80
69
  */
81
70
  async function doSendKeys(params) {
82
71
  await this.uiautomator2.jwproxy.command('/keys', 'POST', params);
83
72
  }
84
73
  /**
85
- * @this {AndroidUiautomator2Driver}
86
- * @param {string|number} keycode
87
- * @param {number} [metastate]
88
- * @returns {Promise<void>}
74
+ * Sends a key event to the device.
75
+ * @param keycode - Android key code to send.
76
+ * @param metastate - Optional meta state (ignored in this implementation).
89
77
  */
90
78
  async function keyevent(keycode, metastate) {
91
79
  this.log.debug(`Ignoring metastate ${metastate}`);
92
80
  await this.adb.keyevent(keycode);
93
81
  }
94
- /**
95
- * @typedef {import('../driver').AndroidUiautomator2Driver} AndroidUiautomator2Driver
96
- */
97
82
  //# sourceMappingURL=keyboard.js.map