appium-uiautomator2-driver 3.10.0 → 4.0.1

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 (73) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +19 -1
  3. package/build/lib/commands/actions.d.ts +13 -7
  4. package/build/lib/commands/actions.d.ts.map +1 -1
  5. package/build/lib/commands/actions.js +24 -10
  6. package/build/lib/commands/actions.js.map +1 -1
  7. package/build/lib/commands/alert.d.ts +8 -4
  8. package/build/lib/commands/alert.d.ts.map +1 -1
  9. package/build/lib/commands/alert.js +10 -6
  10. package/build/lib/commands/alert.js.map +1 -1
  11. package/build/lib/commands/app-management.d.ts +10 -6
  12. package/build/lib/commands/app-management.d.ts.map +1 -1
  13. package/build/lib/commands/app-management.js +13 -10
  14. package/build/lib/commands/app-management.js.map +1 -1
  15. package/build/lib/commands/clipboard.d.ts +0 -12
  16. package/build/lib/commands/clipboard.d.ts.map +1 -1
  17. package/build/lib/commands/clipboard.js +0 -18
  18. package/build/lib/commands/clipboard.js.map +1 -1
  19. package/build/lib/commands/element.d.ts +3 -2
  20. package/build/lib/commands/element.d.ts.map +1 -1
  21. package/build/lib/commands/element.js +3 -4
  22. package/build/lib/commands/element.js.map +1 -1
  23. package/build/lib/commands/gestures.d.ts +130 -22
  24. package/build/lib/commands/gestures.d.ts.map +1 -1
  25. package/build/lib/commands/gestures.js +130 -33
  26. package/build/lib/commands/gestures.js.map +1 -1
  27. package/build/lib/commands/keyboard.d.ts +11 -4
  28. package/build/lib/commands/keyboard.d.ts.map +1 -1
  29. package/build/lib/commands/keyboard.js +13 -7
  30. package/build/lib/commands/keyboard.js.map +1 -1
  31. package/build/lib/commands/navigation.d.ts +5 -2
  32. package/build/lib/commands/navigation.d.ts.map +1 -1
  33. package/build/lib/commands/navigation.js +5 -3
  34. package/build/lib/commands/navigation.js.map +1 -1
  35. package/build/lib/commands/screenshot.d.ts +4 -2
  36. package/build/lib/commands/screenshot.d.ts.map +1 -1
  37. package/build/lib/commands/screenshot.js +4 -3
  38. package/build/lib/commands/screenshot.js.map +1 -1
  39. package/build/lib/commands/types.d.ts +0 -387
  40. package/build/lib/commands/types.d.ts.map +1 -1
  41. package/build/lib/driver.d.ts +540 -8
  42. package/build/lib/driver.d.ts.map +1 -1
  43. package/build/lib/driver.js +2 -7
  44. package/build/lib/driver.js.map +1 -1
  45. package/build/lib/execute-method-map.d.ts +540 -0
  46. package/build/lib/execute-method-map.d.ts.map +1 -0
  47. package/build/lib/execute-method-map.js +257 -0
  48. package/build/lib/execute-method-map.js.map +1 -0
  49. package/build/tsconfig.tsbuildinfo +1 -1
  50. package/lib/commands/actions.js +32 -10
  51. package/lib/commands/alert.js +10 -6
  52. package/lib/commands/app-management.js +14 -11
  53. package/lib/commands/clipboard.js +0 -18
  54. package/lib/commands/element.js +3 -4
  55. package/lib/commands/gestures.js +184 -38
  56. package/lib/commands/keyboard.js +13 -8
  57. package/lib/commands/navigation.js +5 -3
  58. package/lib/commands/screenshot.js +4 -3
  59. package/lib/commands/types.ts +0 -406
  60. package/lib/driver.ts +2 -16
  61. package/lib/execute-method-map.ts +269 -0
  62. package/npm-shrinkwrap.json +41 -48
  63. package/package.json +3 -3
  64. package/build/lib/commands/app-strings.d.ts +0 -12
  65. package/build/lib/commands/app-strings.d.ts.map +0 -1
  66. package/build/lib/commands/app-strings.js +0 -19
  67. package/build/lib/commands/app-strings.js.map +0 -1
  68. package/build/lib/commands/execute.d.ts +0 -15
  69. package/build/lib/commands/execute.d.ts.map +0 -1
  70. package/build/lib/commands/execute.js +0 -83
  71. package/build/lib/commands/execute.js.map +0 -1
  72. package/lib/commands/app-strings.js +0 -16
  73. 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 {import('./types').ClickOptions} [opts={}]
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, opts?: import("./types").ClickOptions): Promise<void>;
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 {import('./types').LongClickOptions} [opts={}]
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, opts?: import("./types").LongClickOptions): Promise<void>;
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 {import('./types').DoubleClickOptions} [opts={}]
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, opts?: import("./types").DoubleClickOptions): Promise<void>;
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 {import('./types').DragOptions} opts
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, opts: import("./types").DragOptions): Promise<void>;
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 {import('./types').FlingOptions} opts
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, opts: import("./types").FlingOptions): Promise<boolean>;
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 {import('./types').PinchOptions} opts
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, opts: import("./types").PinchOptions): Promise<void>;
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 {import('./types').PinchOptions} opts
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, opts: import("./types").PinchOptions): Promise<void>;
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 {import('./types').SwipeOptions} opts
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, opts: import("./types").SwipeOptions): Promise<void>;
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 {import('./types').ScrollGestureOptions} opts
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, opts: import("./types").ScrollGestureOptions): Promise<boolean>;
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 {import('./types').ScrollElementToElementOpts} opts
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, opts: import("./types").ScrollElementToElementOpts): Promise<void>;
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 {import('./types').ScrollOptions} opts
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, opts: import("./types").ScrollOptions): Promise<void>;
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;;;;;;;GAOG;AACH,+FAJW,OAAO,SAAS,EAAE,YAAY,GAC5B,OAAO,CAAC,IAAI,CAAC,CAazB;AAED;;;;;;;GAOG;AACH,mGAJW,OAAO,SAAS,EAAE,gBAAgB,GAChC,OAAO,CAAC,IAAI,CAAC,CAczB;AAED;;;;;;GAMG;AACH,qGAJW,OAAO,SAAS,EAAE,kBAAkB,GAClC,OAAO,CAAC,IAAI,CAAC,CAazB;AAED;;;;;;GAMG;AACH,6FAJW,OAAO,SAAS,EAAE,WAAW,GAC3B,OAAO,CAAC,IAAI,CAAC,CAezB;AAED;;;;;;;GAOG;AACH,8FAHW,OAAO,SAAS,EAAE,YAAY,GAC5B,OAAO,CAAC,OAAO,CAAC,CAgB5B;AAED;;;;;;GAMG;AACH,mGAJW,OAAO,SAAS,EAAE,YAAY,GAC5B,OAAO,CAAC,IAAI,CAAC,CAezB;AAED;;;;;;GAMG;AACH,kGAJW,OAAO,SAAS,EAAE,YAAY,GAC5B,OAAO,CAAC,IAAI,CAAC,CAezB;AAED;;;;;;GAMG;AACH,8FAJW,OAAO,SAAS,EAAE,YAAY,GAC5B,OAAO,CAAC,IAAI,CAAC,CAgBzB;AAED;;;;;;;GAOG;AACH,+FAHW,OAAO,SAAS,EAAE,oBAAoB,GACpC,OAAO,CAAC,OAAO,CAAC,CAiB5B;AAED;;;;;;;;;;;GAWG;AACH,8FAJW,OAAO,SAAS,EAAE,0BAA0B,GAC1C,OAAO,CAAC,IAAI,CAAC,CAiBzB;AAED;;;;;;;;;;;GAWG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,MAAM,WACN,MAAM,UACN,MAAM,GAGJ,OAAO,CAAC,IAAI,CAAC,CAwBzB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,oGAjBW,MAAM,WAEN,MAAM,cAEN,MAAM,SAIN,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 {import('./types').ClickOptions} [opts={}]
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(opts = {}) {
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 {import('./types').LongClickOptions} [opts={}]
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(opts = {}) {
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 {import('./types').DoubleClickOptions} [opts={}]
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(opts = {}) {
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 {import('./types').DragOptions} opts
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(opts) {
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 {import('./types').FlingOptions} opts
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(opts) {
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 {import('./types').PinchOptions} opts
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(opts) {
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 {import('./types').PinchOptions} opts
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(opts) {
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 {import('./types').SwipeOptions} opts
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(opts) {
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 {import('./types').ScrollGestureOptions} opts
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(opts) {
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 {import('./types').ScrollElementToElementOpts} opts
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(opts) {
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 {import('./types').ScrollOptions} opts
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(opts) {
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"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X,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 {import('./types').PressKeyOptions} opts
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, opts: import("./types").PressKeyOptions): Promise<void>;
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 {import('./types').TypingOptions} opts
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, opts: import("./types").TypingOptions): Promise<boolean>;
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":"AAEA;;;;;;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;;;;GAIG;AACH,0FAHW,OAAO,SAAS,EAAE,eAAe,GAC/B,OAAO,CAAC,IAAI,CAAC,CAczB;AAED;;;;;;;;GAQG;AACH,sFAJW,OAAO,SAAS,EAAE,aAAa,GAC7B,OAAO,CAAC,OAAO,CAAC,CAS5B;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.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 {import('./types').PressKeyOptions} opts
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(opts) {
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 {import('./types').TypingOptions} opts
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(opts) {
64
- const { text } = opts;
70
+ async function mobileType(text) {
65
71
  if (lodash_1.default.isUndefined(text)) {
66
- throw this.log.errorWithException(`The 'text' argument is mandatory`);
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
  }