assistsx-js 0.0.2024 → 0.0.2025

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.
@@ -10,81 +10,95 @@ export declare class AssistsXAsync {
10
10
  * 执行异步调用
11
11
  * @param method 方法名
12
12
  * @param args 参数对象
13
+ * @param timeout 超时时间(秒),默认30秒
13
14
  * @returns Promise<调用响应>
14
15
  */
15
16
  private static asyncCall;
16
17
  /**
17
18
  * 设置悬浮窗标志
18
19
  * @param flags 标志
20
+ * @param timeout 超时时间(秒),默认30秒
19
21
  * @returns 是否设置成功
20
22
  */
21
- static setOverlayFlags(flags: number): Promise<boolean>;
23
+ static setOverlayFlags(flags: number, timeout?: number): Promise<boolean>;
22
24
  /**
23
25
  * 设置悬浮窗标志
24
26
  * @param flags 标志
27
+ * @param timeout 超时时间(秒),默认30秒
25
28
  * @returns 是否设置成功
26
29
  */
27
- static setOverlayFlagList(flags: number[]): Promise<boolean>;
30
+ static setOverlayFlagList(flags: number[], timeout?: number): Promise<boolean>;
28
31
  /**
29
32
  * 获取所有符合条件的节点
30
33
  * @param filterClass 类名过滤
31
34
  * @param filterViewId 视图ID过滤
32
35
  * @param filterDes 描述过滤
33
36
  * @param filterText 文本过滤
37
+ * @param timeout 超时时间(秒),默认30秒
34
38
  * @returns 节点数组
35
39
  */
36
- static getAllNodes({ filterClass, filterViewId, filterDes, filterText, }?: {
40
+ static getAllNodes({ filterClass, filterViewId, filterDes, filterText, timeout, }?: {
37
41
  filterClass?: string;
38
42
  filterViewId?: string;
39
43
  filterDes?: string;
40
44
  filterText?: string;
45
+ timeout?: number;
41
46
  }): Promise<Node[]>;
42
47
  /**
43
48
  * 设置节点文本
44
49
  * @param node 目标节点
45
50
  * @param text 要设置的文本
51
+ * @param timeout 超时时间(秒),默认30秒
46
52
  * @returns 是否设置成功
47
53
  */
48
- static setNodeText(node: Node, text: string): Promise<boolean>;
54
+ static setNodeText(node: Node, text: string, timeout?: number): Promise<boolean>;
49
55
  /**
50
56
  * 对指定节点进行截图
51
57
  * @param nodes 要截图的节点数组
52
58
  * @param overlayHiddenScreenshotDelayMillis 截图延迟时间(毫秒)
59
+ * @param timeout 超时时间(秒),默认30秒
53
60
  * @returns 截图路径数组
54
61
  */
55
- static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number): Promise<string[]>;
56
- static scanQR(): Promise<string>;
57
- static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions): Promise<any>;
62
+ static takeScreenshotNodes(nodes: Node[], overlayHiddenScreenshotDelayMillis?: number, timeout?: number): Promise<string[]>;
63
+ static scanQR(timeout?: number): Promise<string>;
64
+ static loadWebViewOverlay(url: string, options?: WebFloatingWindowOptions & {
65
+ timeout?: number;
66
+ }): Promise<any>;
58
67
  /**
59
68
  * 点击节点
60
69
  * @param node 要点击的节点
70
+ * @param timeout 超时时间(秒),默认30秒
61
71
  * @returns 是否点击成功
62
72
  */
63
- static click(node: Node): Promise<boolean>;
73
+ static click(node: Node, timeout?: number): Promise<boolean>;
64
74
  /**
65
75
  * 长按节点
66
76
  * @param node 要长按的节点
77
+ * @param timeout 超时时间(秒),默认30秒
67
78
  * @returns 是否长按成功
68
79
  */
69
- static longClick(node: Node): Promise<boolean>;
80
+ static longClick(node: Node, timeout?: number): Promise<boolean>;
70
81
  /**
71
82
  * 启动应用
72
83
  * @param packageName 应用包名
84
+ * @param timeout 超时时间(秒),默认30秒
73
85
  * @returns 是否启动成功
74
86
  */
75
- static launchApp(packageName: string): Promise<boolean>;
87
+ static launchApp(packageName: string, timeout?: number): Promise<boolean>;
76
88
  /**
77
89
  * 获取当前应用包名
90
+ * @param timeout 超时时间(秒),默认30秒
78
91
  * @returns 包名
79
92
  */
80
- static getPackageName(): Promise<string>;
93
+ static getPackageName(timeout?: number): Promise<string>;
81
94
  /**
82
95
  * 显示悬浮提示
83
96
  * @param text 提示文本
84
97
  * @param delay 显示时长(毫秒)
98
+ * @param timeout 超时时间(秒),默认30秒
85
99
  * @returns 是否显示成功
86
100
  */
87
- static overlayToast(text: string, delay?: number): Promise<boolean>;
101
+ static overlayToast(text: string, delay?: number, timeout?: number): Promise<boolean>;
88
102
  /**
89
103
  * 通过ID查找节点
90
104
  * @param id 节点ID
@@ -92,13 +106,15 @@ export declare class AssistsXAsync {
92
106
  * @param filterText 文本过滤
93
107
  * @param filterDes 描述过滤
94
108
  * @param node 父节点范围
109
+ * @param timeout 超时时间(秒),默认30秒
95
110
  * @returns 节点数组
96
111
  */
97
- static findById(id: string, { filterClass, filterText, filterDes, node, }?: {
112
+ static findById(id: string, { filterClass, filterText, filterDes, node, timeout, }?: {
98
113
  filterClass?: string;
99
114
  filterText?: string;
100
115
  filterDes?: string;
101
116
  node?: Node;
117
+ timeout?: number;
102
118
  }): Promise<Node[]>;
103
119
  /**
104
120
  * 通过文本查找节点
@@ -107,13 +123,15 @@ export declare class AssistsXAsync {
107
123
  * @param filterViewId 视图ID过滤
108
124
  * @param filterDes 描述过滤
109
125
  * @param node 父节点范围
126
+ * @param timeout 超时时间(秒),默认30秒
110
127
  * @returns 节点数组
111
128
  */
112
- static findByText(text: string, { filterClass, filterViewId, filterDes, node, }?: {
129
+ static findByText(text: string, { filterClass, filterViewId, filterDes, node, timeout, }?: {
113
130
  filterClass?: string;
114
131
  filterViewId?: string;
115
132
  filterDes?: string;
116
133
  node?: Node;
134
+ timeout?: number;
117
135
  }): Promise<Node[]>;
118
136
  /**
119
137
  * 通过标签查找节点
@@ -122,128 +140,149 @@ export declare class AssistsXAsync {
122
140
  * @param filterViewId 视图ID过滤
123
141
  * @param filterDes 描述过滤
124
142
  * @param node 父节点范围
143
+ * @param timeout 超时时间(秒),默认30秒
125
144
  * @returns 节点数组
126
145
  */
127
- static findByTags(className: string, { filterText, filterViewId, filterDes, node, }?: {
146
+ static findByTags(className: string, { filterText, filterViewId, filterDes, node, timeout, }?: {
128
147
  filterText?: string;
129
148
  filterViewId?: string;
130
149
  filterDes?: string;
131
150
  node?: Node;
151
+ timeout?: number;
132
152
  }): Promise<Node[]>;
133
153
  /**
134
154
  * 查找所有匹配文本的节点
135
155
  * @param text 要查找的文本
156
+ * @param timeout 超时时间(秒),默认30秒
136
157
  * @returns 节点数组
137
158
  */
138
- static findByTextAllMatch(text: string): Promise<Node[]>;
159
+ static findByTextAllMatch(text: string, timeout?: number): Promise<Node[]>;
139
160
  /**
140
161
  * 检查是否包含指定文本
141
162
  * @param text 要检查的文本
163
+ * @param timeout 超时时间(秒),默认30秒
142
164
  * @returns 是否包含
143
165
  */
144
- static containsText(text: string): Promise<boolean>;
166
+ static containsText(text: string, timeout?: number): Promise<boolean>;
145
167
  /**
146
168
  * 获取所有文本
169
+ * @param timeout 超时时间(秒),默认30秒
147
170
  * @returns 文本数组
148
171
  */
149
- static getAllText(): Promise<string[]>;
172
+ static getAllText(timeout?: number): Promise<string[]>;
150
173
  /**
151
174
  * 查找第一个匹配标签的父节点
152
175
  * @param className 类名
176
+ * @param timeout 超时时间(秒),默认30秒
153
177
  * @returns 父节点
154
178
  */
155
- static findFirstParentByTags(node: Node, className: string): Promise<Node>;
179
+ static findFirstParentByTags(node: Node, className: string, timeout?: number): Promise<Node>;
156
180
  /**
157
181
  * 获取节点的所有子节点
158
182
  * @param node 父节点
183
+ * @param timeout 超时时间(秒),默认30秒
159
184
  * @returns 子节点数组
160
185
  */
161
- static getNodes(node: Node): Promise<Node[]>;
186
+ static getNodes(node: Node, timeout?: number): Promise<Node[]>;
162
187
  /**
163
188
  * 获取节点的直接子节点
164
189
  * @param node 父节点
190
+ * @param timeout 超时时间(秒),默认30秒
165
191
  * @returns 子节点数组
166
192
  */
167
- static getChildren(node: Node): Promise<Node[]>;
193
+ static getChildren(node: Node, timeout?: number): Promise<Node[]>;
168
194
  /**
169
195
  * 查找第一个可点击的父节点
170
196
  * @param node 起始节点
197
+ * @param timeout 超时时间(秒),默认30秒
171
198
  * @returns 可点击的父节点
172
199
  */
173
- static findFirstParentClickable(node: Node): Promise<Node>;
200
+ static findFirstParentClickable(node: Node, timeout?: number): Promise<Node>;
174
201
  /**
175
202
  * 获取节点在屏幕中的边界
176
203
  * @param node 目标节点
204
+ * @param timeout 超时时间(秒),默认30秒
177
205
  * @returns 边界对象
178
206
  */
179
- static getBoundsInScreen(node: Node): Promise<Bounds>;
207
+ static getBoundsInScreen(node: Node, timeout?: number): Promise<Bounds>;
180
208
  /**
181
209
  * 检查节点是否可见
182
210
  * @param node 目标节点
183
211
  * @param compareNode 比较节点
184
212
  * @param isFullyByCompareNode 是否完全可见
213
+ * @param timeout 超时时间(秒),默认30秒
185
214
  * @returns 是否可见
186
215
  */
187
- static isVisible(node: Node, { compareNode, isFullyByCompareNode, }?: {
216
+ static isVisible(node: Node, { compareNode, isFullyByCompareNode, timeout, }?: {
188
217
  compareNode?: Node;
189
218
  isFullyByCompareNode?: boolean;
219
+ timeout?: number;
190
220
  }): Promise<boolean>;
191
221
  /**
192
222
  * 执行点击手势
193
223
  * @param x 横坐标
194
224
  * @param y 纵坐标
195
225
  * @param duration 持续时间
226
+ * @param timeout 超时时间(秒),默认30秒
196
227
  * @returns 是否成功
197
228
  */
198
- static clickByGesture(x: number, y: number, duration: number): Promise<boolean>;
229
+ static clickByGesture(x: number, y: number, duration: number, timeout?: number): Promise<boolean>;
199
230
  /**
200
231
  * 返回操作
232
+ * @param timeout 超时时间(秒),默认30秒
201
233
  * @returns 是否成功
202
234
  */
203
- static back(): Promise<boolean>;
235
+ static back(timeout?: number): Promise<boolean>;
204
236
  /**
205
237
  * 回到主页
238
+ * @param timeout 超时时间(秒),默认30秒
206
239
  * @returns 是否成功
207
240
  */
208
- static home(): Promise<boolean>;
241
+ static home(timeout?: number): Promise<boolean>;
209
242
  /**
210
243
  * 打开通知栏
244
+ * @param timeout 超时时间(秒),默认30秒
211
245
  * @returns 是否成功
212
246
  */
213
- static notifications(): Promise<boolean>;
247
+ static notifications(timeout?: number): Promise<boolean>;
214
248
  /**
215
249
  * 显示最近应用
250
+ * @param timeout 超时时间(秒),默认30秒
216
251
  * @returns 是否成功
217
252
  */
218
- static recentApps(): Promise<boolean>;
253
+ static recentApps(timeout?: number): Promise<boolean>;
219
254
  /**
220
255
  * 在节点中粘贴文本
221
256
  * @param node 目标节点
222
257
  * @param text 要粘贴的文本
258
+ * @param timeout 超时时间(秒),默认30秒
223
259
  * @returns 是否成功
224
260
  */
225
- static paste(node: Node, text: string): Promise<boolean>;
226
- static focus(node: Node): Promise<boolean>;
261
+ static paste(node: Node, text: string, timeout?: number): Promise<boolean>;
262
+ static focus(node: Node, timeout?: number): Promise<boolean>;
227
263
  /**
228
264
  * 选择文本
229
265
  * @param node 目标节点
230
266
  * @param selectionStart 选择起始位置
231
267
  * @param selectionEnd 选择结束位置
268
+ * @param timeout 超时时间(秒),默认30秒
232
269
  * @returns 是否成功
233
270
  */
234
- static selectionText(node: Node, selectionStart: number, selectionEnd: number): Promise<boolean>;
271
+ static selectionText(node: Node, selectionStart: number, selectionEnd: number, timeout?: number): Promise<boolean>;
235
272
  /**
236
273
  * 向前滚动
237
274
  * @param node 可滚动节点
275
+ * @param timeout 超时时间(秒),默认30秒
238
276
  * @returns 是否成功
239
277
  */
240
- static scrollForward(node: Node): Promise<boolean>;
278
+ static scrollForward(node: Node, timeout?: number): Promise<boolean>;
241
279
  /**
242
280
  * 向后滚动
243
281
  * @param node 可滚动节点
282
+ * @param timeout 超时时间(秒),默认30秒
244
283
  * @returns 是否成功
245
284
  */
246
- static scrollBackward(node: Node): Promise<boolean>;
285
+ static scrollBackward(node: Node, timeout?: number): Promise<boolean>;
247
286
  /**
248
287
  * 对节点执行点击手势
249
288
  * @param node 目标节点
@@ -251,13 +290,15 @@ export declare class AssistsXAsync {
251
290
  * @param offsetY Y轴偏移
252
291
  * @param switchWindowIntervalDelay 窗口切换延迟
253
292
  * @param clickDuration 点击持续时间
293
+ * @param timeout 超时时间(秒),默认30秒
254
294
  * @returns 是否成功
255
295
  */
256
- static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, }?: {
296
+ static clickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, timeout, }?: {
257
297
  offsetX?: number;
258
298
  offsetY?: number;
259
299
  switchWindowIntervalDelay?: number;
260
300
  clickDuration?: number;
301
+ timeout?: number;
261
302
  }): Promise<boolean>;
262
303
  /**
263
304
  * 对节点执行双击手势
@@ -267,20 +308,23 @@ export declare class AssistsXAsync {
267
308
  * @param switchWindowIntervalDelay 窗口切换延迟
268
309
  * @param clickDuration 点击持续时间
269
310
  * @param clickInterval 点击间隔
311
+ * @param timeout 超时时间(秒),默认30秒
270
312
  * @returns 是否成功
271
313
  */
272
- static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, }?: {
314
+ static doubleClickNodeByGesture(node: Node, { offsetX, offsetY, switchWindowIntervalDelay, clickDuration, clickInterval, timeout, }?: {
273
315
  offsetX?: number;
274
316
  offsetY?: number;
275
317
  switchWindowIntervalDelay?: number;
276
318
  clickDuration?: number;
277
319
  clickInterval?: number;
320
+ timeout?: number;
278
321
  }): Promise<boolean>;
279
322
  /**
280
323
  * 执行线型手势
281
324
  * @param startPoint
282
325
  * @param endPoint
283
326
  * @param param2
327
+ * @param timeout 超时时间(秒),默认30秒
284
328
  * @returns
285
329
  */
286
330
  static performLinearGesture(startPoint: {
@@ -289,37 +333,42 @@ export declare class AssistsXAsync {
289
333
  }, endPoint: {
290
334
  x: number;
291
335
  y: number;
292
- }, { duration }?: {
336
+ }, { duration, timeout }?: {
293
337
  duration?: number;
338
+ timeout?: number;
294
339
  }): Promise<boolean>;
295
- static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
340
+ static longPressNodeByGestureAutoPaste(node: Node, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
296
341
  matchedPackageName?: string;
297
342
  matchedText?: string;
298
343
  timeoutMillis?: number;
299
344
  longPressDuration?: number;
345
+ timeout?: number;
300
346
  }): Promise<boolean>;
301
347
  static longPressGestureAutoPaste(point: {
302
348
  x: number;
303
349
  y: number;
304
- }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, }?: {
350
+ }, text: string, { matchedPackageName, matchedText, timeoutMillis, longPressDuration, timeout, }?: {
305
351
  matchedPackageName?: string;
306
352
  matchedText?: string;
307
353
  timeoutMillis?: number;
308
354
  longPressDuration?: number;
355
+ timeout?: number;
309
356
  }): Promise<boolean>;
310
- static getAppInfo(packageName: string): Promise<any>;
311
- static getUniqueDeviceId(): Promise<any>;
312
- static getAndroidID(): Promise<any>;
313
- static getMacAddress(): Promise<any>;
314
- static getDeviceInfo(): Promise<any>;
357
+ static getAppInfo(packageName: string, timeout?: number): Promise<any>;
358
+ static getUniqueDeviceId(timeout?: number): Promise<any>;
359
+ static getAndroidID(timeout?: number): Promise<any>;
360
+ static getMacAddress(timeout?: number): Promise<any>;
361
+ static getDeviceInfo(timeout?: number): Promise<any>;
315
362
  /**
316
363
  * 获取屏幕尺寸
364
+ * @param timeout 超时时间(秒),默认30秒
317
365
  * @returns 屏幕尺寸对象
318
366
  */
319
- static getScreenSize(): Promise<any>;
367
+ static getScreenSize(timeout?: number): Promise<any>;
320
368
  /**
321
369
  * 获取应用窗口尺寸
370
+ * @param timeout 超时时间(秒),默认30秒
322
371
  * @returns 应用窗口尺寸对象
323
372
  */
324
- static getAppScreenSize(): Promise<any>;
373
+ static getAppScreenSize(timeout?: number): Promise<any>;
325
374
  }