@weapp-vite/miniprogram-automator 0.0.0 → 1.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.
package/dist/index.d.cts DELETED
@@ -1,305 +0,0 @@
1
- import { EventEmitter } from "node:events";
2
- import WebSocket from "ws";
3
-
4
- //#region src/Transport.d.ts
5
- /** Transport 的实现。 */
6
- declare class Transport extends EventEmitter {
7
- private ws;
8
- constructor(ws: WebSocket);
9
- send(message: string): void;
10
- close(): void;
11
- }
12
- //#endregion
13
- //#region src/Connection.d.ts
14
- /** Connection 的实现。 */
15
- declare class Connection extends EventEmitter {
16
- private transport;
17
- private callbacks;
18
- constructor(transport: Transport);
19
- send(method: string, params?: Record<string, any>): Promise<any>;
20
- dispose(): void;
21
- private onMessage;
22
- private onClose;
23
- static create(url: string): Promise<Connection>;
24
- }
25
- //#endregion
26
- //#region src/Native.d.ts
27
- /** ISwitchTabOptions 的类型定义。 */
28
- interface ISwitchTabOptions {
29
- url: string;
30
- }
31
- /** Native 的实现。 */
32
- declare class Native extends EventEmitter {
33
- private connection;
34
- constructor(connection: Connection);
35
- goHome(): Promise<any>;
36
- navigateLeft(): Promise<any>;
37
- confirmModal(): Promise<any>;
38
- cancelModal(): Promise<any>;
39
- switchTab(params: ISwitchTabOptions): Promise<any>;
40
- authorizeCancel(): Promise<any>;
41
- authorizeAllow(): Promise<any>;
42
- closePaymentDialog(): Promise<any>;
43
- shareCancel(): Promise<any>;
44
- shareConfirm(): Promise<any>;
45
- private send;
46
- private sendNative;
47
- }
48
- //#endregion
49
- //#region src/Element.d.ts
50
- /** IElementOptions 的类型定义。 */
51
- interface IElementOptions {
52
- elementId: string;
53
- nodeId?: string;
54
- videoId?: string;
55
- pageId: number;
56
- tagName: string;
57
- }
58
- /** ITouch 的类型定义。 */
59
- interface ITouch {
60
- identifier?: number;
61
- pageX?: number;
62
- pageY?: number;
63
- clientX?: number;
64
- clientY?: number;
65
- }
66
- /** ITouchEventOptions 的类型定义。 */
67
- interface ITouchEventOptions {
68
- touches?: ITouch[];
69
- changeTouches?: ITouch[];
70
- }
71
- /** IEventOptions 的类型定义。 */
72
- interface IEventOptions {
73
- eventName: string;
74
- $?: string;
75
- touches?: ITouch[];
76
- changeTouches?: ITouch[];
77
- detail?: Record<string, any>;
78
- }
79
- type ElementMap = Map<string, Element>;
80
- /** Element 的实现。 */
81
- declare class Element {
82
- private connection;
83
- private elementMap;
84
- tagName: string;
85
- protected nodeId: string | null;
86
- private videoId;
87
- private id;
88
- private pageId;
89
- private publicProps?;
90
- constructor(connection: Connection, options: IElementOptions, elementMap: ElementMap);
91
- $(selector: string): Promise<Element | null>;
92
- $$(selector: string): Promise<any>;
93
- size(): Promise<{
94
- width: any;
95
- height: any;
96
- }>;
97
- offset(): Promise<any>;
98
- text(): Promise<any>;
99
- attribute(name: string): Promise<any>;
100
- value(): Promise<any>;
101
- property(name: string): Promise<any>;
102
- wxml(): Promise<any>;
103
- outerWxml(): Promise<any>;
104
- style(name: string): Promise<any>;
105
- tap(): Promise<void>;
106
- longpress(): Promise<void>;
107
- trigger(type: string, detail?: any): Promise<void>;
108
- touchstart(options?: ITouchEventOptions): Promise<void>;
109
- touchmove(options?: ITouchEventOptions): Promise<void>;
110
- touchend(options?: ITouchEventOptions): Promise<void>;
111
- dispatchEvent(options: IEventOptions): Promise<void>;
112
- protected _property(name: string | string[]): Promise<any>;
113
- protected send(method: string, params?: Record<string, any>): Promise<any>;
114
- protected callFunction(functionName: string, ...args: any[]): Promise<any>;
115
- private domProperty;
116
- private getter;
117
- static create(connection: Connection, options: IElementOptions, elementMap: ElementMap): Element;
118
- }
119
- /** CustomElement 的实现。 */
120
- declare class CustomElement extends Element {
121
- setData(data: any): Promise<void>;
122
- data(path?: string): Promise<any>;
123
- callMethod(method: string, ...args: any[]): Promise<any>;
124
- }
125
- /** InputElement 的实现。 */
126
- declare class InputElement extends Element {
127
- input(value: string): Promise<void>;
128
- }
129
- /** TextareaElement 的实现。 */
130
- declare class TextareaElement extends Element {
131
- input(value: string): Promise<void>;
132
- }
133
- /** ScrollViewElement 的实现。 */
134
- declare class ScrollViewElement extends Element {
135
- scrollTo(x: number, y: number): Promise<void>;
136
- property(name: string): Promise<any>;
137
- scrollWidth(): Promise<any>;
138
- scrollHeight(): Promise<any>;
139
- }
140
- /** SwiperElement 的实现。 */
141
- declare class SwiperElement extends Element {
142
- swipeTo(index: number): Promise<void>;
143
- }
144
- /** MovableViewElement 的实现。 */
145
- declare class MovableViewElement extends Element {
146
- moveTo(x: number, y: number): Promise<void>;
147
- property(name: string): Promise<any>;
148
- }
149
- /** SwitchElement 的实现。 */
150
- declare class SwitchElement extends Element {
151
- tap(): Promise<void>;
152
- }
153
- /** SliderElement 的实现。 */
154
- declare class SliderElement extends Element {
155
- slideTo(value: number): Promise<void>;
156
- }
157
- /** ContextElement 的实现。 */
158
- declare class ContextElement extends Element {
159
- callContextMethod(method: string, ...args: any[]): Promise<any>;
160
- }
161
- //#endregion
162
- //#region src/Page.d.ts
163
- /** IPageOptions 的类型定义。 */
164
- interface IPageOptions {
165
- id: number;
166
- path: string;
167
- query: any;
168
- }
169
- type PageMap = Map<number, Page>;
170
- type WaitCondition = string | number | (() => unknown | Promise<unknown>);
171
- /** Page 的实现。 */
172
- declare class Page {
173
- private connection;
174
- path: string;
175
- query: any;
176
- private id;
177
- private elementMap;
178
- constructor(connection: Connection, options: IPageOptions);
179
- waitFor(condition: WaitCondition): Promise<void>;
180
- $(selector: string): Promise<Element | null>;
181
- $$(selector: string): Promise<any>;
182
- getElementByXpath(selector: string): Promise<Element | null>;
183
- getElementsByXpath(selector: string): Promise<any>;
184
- xpath(selector: string): Promise<Element | null>;
185
- data(path?: string): Promise<any>;
186
- setData(data: any): Promise<void>;
187
- size(): Promise<{
188
- width: any;
189
- height: any;
190
- }>;
191
- callMethod(method: string, ...args: any[]): Promise<any>;
192
- scrollTop(): Promise<any>;
193
- private windowProperty;
194
- private send;
195
- static create(connection: Connection, options: IPageOptions, pageMap: PageMap): Page;
196
- }
197
- //#endregion
198
- //#region src/MiniProgram.d.ts
199
- interface IScreenshotOptions {
200
- path?: string;
201
- }
202
- interface IAuditsOptions {
203
- path?: string;
204
- }
205
- type AutomatorCallable = (...args: any[]) => any;
206
- /** MiniProgram 的实现。 */
207
- declare class MiniProgram extends EventEmitter {
208
- private connection;
209
- private appBindings;
210
- private pageMap;
211
- private nativeIns?;
212
- constructor(connection: Connection);
213
- pageStack(): Promise<any>;
214
- navigateTo(url: string): Promise<Page>;
215
- redirectTo(url: string): Promise<Page>;
216
- navigateBack(): Promise<Page>;
217
- reLaunch(url: string): Promise<Page>;
218
- switchTab(url: string): Promise<Page>;
219
- currentPage(): Promise<Page>;
220
- systemInfo(): Promise<any>;
221
- callWxMethod(method: string, ...args: any[]): Promise<any>;
222
- mockWxMethod(method: string, result: any, ...args: any[]): Promise<void>;
223
- restoreWxMethod(method: string): Promise<void>;
224
- callPluginWxMethod(pluginId: string, method: string, ...args: any[]): Promise<any>;
225
- mockPluginWxMethod(pluginId: string, method: string, result: any, ...args: any[]): Promise<void>;
226
- restorePluginWxMethod(pluginId: string, method: string): Promise<void>;
227
- evaluate(appFunction: AutomatorCallable | string, ...args: any[]): Promise<any>;
228
- pageScrollTo(scrollTop: number): Promise<void>;
229
- close(): Promise<void>;
230
- remote(auto?: boolean): Promise<void>;
231
- disconnect(): void;
232
- on(event: string | symbol, listener: (...args: any[]) => void): this;
233
- exposeFunction(name: string, bindingFunction: AutomatorCallable): Promise<void>;
234
- checkVersion(): Promise<void>;
235
- screenshot(options?: IScreenshotOptions): Promise<any>;
236
- testAccounts(): Promise<any>;
237
- stopAudits(options?: IAuditsOptions): Promise<any>;
238
- getTicket(): Promise<any>;
239
- setTicket(ticket: string): Promise<void>;
240
- refreshTicket(): Promise<void>;
241
- native(): Native;
242
- private changeRoute;
243
- private send;
244
- private onLogAdded;
245
- private onBindingCalled;
246
- private onExceptionThrown;
247
- }
248
- //#endregion
249
- //#region src/Launcher.d.ts
250
- /** IConnectOptions 的类型定义。 */
251
- interface IConnectOptions {
252
- wsEndpoint: string;
253
- }
254
- /** ILaunchOptions 的类型定义。 */
255
- interface ILaunchOptions {
256
- cliPath?: string;
257
- timeout?: number;
258
- port?: number;
259
- account?: string;
260
- ticket?: string;
261
- projectConfig?: any;
262
- projectPath: string;
263
- trustProject?: boolean;
264
- args?: string[];
265
- cwd?: string;
266
- runtimeProvider?: 'devtools' | 'headless';
267
- }
268
- /** Launcher 的实现。 */
269
- declare class Launcher {
270
- launch(options: ILaunchOptions): Promise<any>;
271
- connect(options: IConnectOptions): Promise<MiniProgram>;
272
- private extendProjectConfig;
273
- private connectTool;
274
- private resolveCliPath;
275
- }
276
- //#endregion
277
- //#region src/Automator.d.ts
278
- /** Automator 的实现。 */
279
- declare class Automator {
280
- Element: typeof Element;
281
- CustomElement: typeof CustomElement;
282
- InputElement: typeof InputElement;
283
- ScrollViewElement: typeof ScrollViewElement;
284
- SwiperElement: typeof SwiperElement;
285
- MovableViewElement: typeof MovableViewElement;
286
- SwitchElement: typeof SwitchElement;
287
- SliderElement: typeof SliderElement;
288
- ContextElement: typeof ContextElement;
289
- private launcher;
290
- connect(options: IConnectOptions): Promise<MiniProgram>;
291
- launch(options: ILaunchOptions): Promise<any>;
292
- }
293
- //#endregion
294
- //#region src/util.d.ts
295
- /** decodeQrCode 的方法封装。 */
296
- declare function decodeQrCode(qrCode: string): Promise<string>;
297
- /** printQrCode 的方法封装。 */
298
- declare function printQrCode(content: string): Promise<void>;
299
- /** isPluginPath 的方法封装。 */
300
- declare function isPluginPath(p: string): boolean;
301
- /** extractPluginId 的方法封装。 */
302
- declare function extractPluginId(p: string): string;
303
- //#endregion
304
- export { Automator, Connection, ContextElement, CustomElement, Element, IConnectOptions, ILaunchOptions, InputElement, Launcher, MiniProgram, MovableViewElement, Native, Page, ScrollViewElement, SliderElement, SwiperElement, SwitchElement, TextareaElement, Transport, decodeQrCode, extractPluginId, isPluginPath, printQrCode };
305
- //# sourceMappingURL=index.d.cts.map