ms-types 0.0.49 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/action.d.ts +105 -16
package/package.json
CHANGED
package/types/action.d.ts
CHANGED
|
@@ -138,22 +138,6 @@ declare namespace action {
|
|
|
138
138
|
endY: number,
|
|
139
139
|
duration?: number
|
|
140
140
|
): boolean;
|
|
141
|
-
/**
|
|
142
|
-
* 执行组合操作
|
|
143
|
-
* @param actions 操作列表
|
|
144
|
-
* @returns 执行组合操作是否成功
|
|
145
|
-
* @example action.actions({
|
|
146
|
-
* "type": "pointer",
|
|
147
|
-
* "id": "pointer1",
|
|
148
|
-
* "parameters": { "pointerType": "touch" },
|
|
149
|
-
* "actions": [
|
|
150
|
-
* { "type": "pointerMove", "duration": 0, "x": x1, "y": y1 },
|
|
151
|
-
* { "type": "pointerDown", "button": 0 },
|
|
152
|
-
* { "type": "pointerUp", "button": 0 }
|
|
153
|
-
* ]
|
|
154
|
-
* })
|
|
155
|
-
*/
|
|
156
|
-
function actions(actions: Record<string, any>): boolean;
|
|
157
141
|
/**
|
|
158
142
|
* 输入文本
|
|
159
143
|
* @param text 文本内容
|
|
@@ -198,4 +182,109 @@ declare namespace action {
|
|
|
198
182
|
button: "home" | "volumeup" | "volumedown" | "power" | "snapshot",
|
|
199
183
|
duration?: number
|
|
200
184
|
): boolean;
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* 创建 WebDriver Actions 构建器,支持链式调用构建复杂的多点触控动作
|
|
188
|
+
* @returns WDAActionBuilder 实例
|
|
189
|
+
* @example const builder = action.createActionBuilder()
|
|
190
|
+
*/
|
|
191
|
+
function createActionBuilder(): ActionBuilder;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* ActionBuilder 构建器接口
|
|
195
|
+
* 支持链式调用构建复杂的多点触控动作
|
|
196
|
+
*/
|
|
197
|
+
interface ActionBuilder {
|
|
198
|
+
/**
|
|
199
|
+
* 添加一个指针(手指)
|
|
200
|
+
* @param id 指针编号,如 1-10
|
|
201
|
+
* @returns PointerBuilder 用于配置该指针的动作
|
|
202
|
+
* @example builder.addPointer(1).moveTo(100, 100).tap(200, 200).done()
|
|
203
|
+
*/
|
|
204
|
+
addPointer(id: number): PointerBuilder;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* 快速创建单点点击
|
|
208
|
+
* @param x X 坐标
|
|
209
|
+
* @param y Y 坐标
|
|
210
|
+
* @param duration 点击持续时间,如果未定义则默认为 20ms
|
|
211
|
+
* @returns 返回自身,支持链式调用
|
|
212
|
+
* @example builder.singleTap(100, 100, 50).execute()
|
|
213
|
+
*/
|
|
214
|
+
singleTap(x: number, y: number, duration?: number): ActionBuilder;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* 快速创建多点点击
|
|
218
|
+
* @param points 点击坐标数组,每个元素包含 x 和 y 坐标
|
|
219
|
+
* @param duration 点击持续时间,如果未定义则默认为 20ms
|
|
220
|
+
* @returns 返回自身,支持链式调用
|
|
221
|
+
* @example builder.multiTap([{x: 100, y: 100}, {x: 200, y: 200}], 50).execute()
|
|
222
|
+
*/
|
|
223
|
+
multiTap(
|
|
224
|
+
points: Array<{ x: number; y: number }>,
|
|
225
|
+
duration?: number
|
|
226
|
+
): ActionBuilder;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* 执行构建的动作
|
|
230
|
+
* @returns 执行是否成功
|
|
231
|
+
* @example const success = builder.execute()
|
|
232
|
+
*/
|
|
233
|
+
execute(): boolean;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* 指针构建器接口
|
|
238
|
+
* 用于配置单个指针(手指)的动作序列
|
|
239
|
+
*/
|
|
240
|
+
interface PointerBuilder {
|
|
241
|
+
/**
|
|
242
|
+
* 移动到指定坐标
|
|
243
|
+
* @param x X 坐标
|
|
244
|
+
* @param y Y 坐标
|
|
245
|
+
* @param duration 移动持续时间,如果未定义则默认为 0ms
|
|
246
|
+
* @returns 返回自身,支持链式调用
|
|
247
|
+
* @example pointer.moveTo(100, 100, 200)
|
|
248
|
+
*/
|
|
249
|
+
moveTo(x: number, y: number, duration?: number): PointerBuilder;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* 按下手指
|
|
253
|
+
* @returns 返回自身,支持链式调用
|
|
254
|
+
* @example pointer.down()
|
|
255
|
+
*/
|
|
256
|
+
down(): PointerBuilder;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* 抬起手指
|
|
260
|
+
* @returns 返回自身,支持链式调用
|
|
261
|
+
* @example pointer.up()
|
|
262
|
+
*/
|
|
263
|
+
up(): PointerBuilder;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* 延迟指定时间(暂停)
|
|
267
|
+
* @param duration 延迟时间(毫秒),如果未定义则默认为 20ms
|
|
268
|
+
* @returns 返回自身,支持链式调用
|
|
269
|
+
* @example pointer.stay(100)
|
|
270
|
+
*/
|
|
271
|
+
stay(duration?: number): PointerBuilder;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* 执行点击动作(移动 -> 按下 -> 暂停 -> 抬起)
|
|
275
|
+
* @param x X 坐标
|
|
276
|
+
* @param y Y 坐标
|
|
277
|
+
* @param duration 按下持续时间,如果未定义则默认为 20ms
|
|
278
|
+
* @returns 返回自身,支持链式调用
|
|
279
|
+
* @example pointer.tap(100, 100, 50)
|
|
280
|
+
*/
|
|
281
|
+
tap(x: number, y: number, duration?: number): PointerBuilder;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* 完成当前指针配置,返回到主构建器
|
|
285
|
+
* @returns 返回 WDAActionBuilder,可以继续添加其他指针
|
|
286
|
+
* @example pointer.done().addPointer(2)
|
|
287
|
+
*/
|
|
288
|
+
done(): ActionBuilder;
|
|
289
|
+
}
|
|
201
290
|
}
|