@mobilewright/protocol 0.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.
@@ -0,0 +1,28 @@
1
+ import type { AppInfo, ConnectionConfig, DeviceInfo, GestureSequence, HardwareButton, LaunchOptions, ListDevicesOptions, Orientation, RecordingOptions, RecordingResult, ScreenSize, ScreenshotOptions, Session, SwipeDirection, SwipeOptions, ViewNode } from './types.js';
2
+ export interface MobilewrightDriver {
3
+ connect(config: ConnectionConfig): Promise<Session>;
4
+ disconnect(): Promise<void>;
5
+ getViewHierarchy(): Promise<ViewNode[]>;
6
+ tap(x: number, y: number): Promise<void>;
7
+ doubleTap(x: number, y: number): Promise<void>;
8
+ longPress(x: number, y: number, duration?: number): Promise<void>;
9
+ typeText(text: string): Promise<void>;
10
+ swipe(direction: SwipeDirection, opts?: SwipeOptions): Promise<void>;
11
+ gesture(gestures: GestureSequence): Promise<void>;
12
+ pressButton(button: HardwareButton): Promise<void>;
13
+ screenshot(opts?: ScreenshotOptions): Promise<Buffer>;
14
+ getScreenSize(): Promise<ScreenSize>;
15
+ getOrientation(): Promise<Orientation>;
16
+ setOrientation(orientation: Orientation): Promise<void>;
17
+ launchApp(bundleId: string, opts?: LaunchOptions): Promise<void>;
18
+ terminateApp(bundleId: string): Promise<void>;
19
+ listApps(): Promise<AppInfo[]>;
20
+ getForegroundApp(): Promise<AppInfo>;
21
+ installApp(path: string): Promise<void>;
22
+ uninstallApp(bundleId: string): Promise<void>;
23
+ listDevices(opts?: ListDevicesOptions): Promise<DeviceInfo[]>;
24
+ openUrl(url: string): Promise<void>;
25
+ startRecording(opts: RecordingOptions): Promise<void>;
26
+ stopRecording(): Promise<RecordingResult>;
27
+ }
28
+ //# sourceMappingURL=driver.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,gBAAg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Ac,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGxD,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,QAAQ,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/B,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG9C,WAAW,CAAC,IAAI,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAGpC,cAAc,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,aAAa,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;CAC3C"}
package/dist/driver.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=driver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver.js","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export type * from './types.js';
2
+ export type * from './driver.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,aAAa,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,105 @@
1
+ export interface Bounds {
2
+ x: number;
3
+ y: number;
4
+ width: number;
5
+ height: number;
6
+ }
7
+ export interface ViewNode {
8
+ type: string;
9
+ label?: string;
10
+ identifier?: string;
11
+ value?: string;
12
+ text?: string;
13
+ placeholder?: string;
14
+ isVisible: boolean;
15
+ isEnabled: boolean;
16
+ isSelected?: boolean;
17
+ isFocused?: boolean;
18
+ bounds: Bounds;
19
+ children: ViewNode[];
20
+ /** Platform-specific raw attributes */
21
+ raw?: Record<string, unknown>;
22
+ }
23
+ export type Platform = 'ios' | 'android';
24
+ export type DeviceType = 'real' | 'simulator' | 'emulator';
25
+ export type DeviceState = 'online' | 'offline';
26
+ export interface DeviceInfo {
27
+ id: string;
28
+ name: string;
29
+ platform: Platform;
30
+ type: DeviceType;
31
+ state: DeviceState;
32
+ model?: string;
33
+ osVersion?: string;
34
+ }
35
+ export interface AppInfo {
36
+ bundleId: string;
37
+ name?: string;
38
+ version?: string;
39
+ }
40
+ export interface LaunchOptions {
41
+ /** BCP 47 locale tag (e.g. 'fr-FR') */
42
+ locale?: string;
43
+ }
44
+ export interface ConnectionConfig {
45
+ /** WebSocket or HTTP URL of the mobilecli server */
46
+ url?: string;
47
+ /** Target device id */
48
+ deviceId: string;
49
+ /** Known platform — skips device.info call if provided */
50
+ platform?: Platform;
51
+ /** Connection timeout in ms */
52
+ timeout?: number;
53
+ }
54
+ export interface Session {
55
+ deviceId: string;
56
+ platform: Platform;
57
+ }
58
+ export type SwipeDirection = 'up' | 'down' | 'left' | 'right';
59
+ export interface SwipeOptions {
60
+ /** Distance in points (default: 50% of screen dimension) */
61
+ distance?: number;
62
+ /** Duration of swipe in ms */
63
+ duration?: number;
64
+ /** Starting x,y (default: center of screen) */
65
+ startX?: number;
66
+ startY?: number;
67
+ }
68
+ export type HardwareButton = 'HOME' | 'BACK' | 'POWER' | 'VOLUME_UP' | 'VOLUME_DOWN' | 'ENTER' | 'DPAD_UP' | 'DPAD_DOWN' | 'DPAD_LEFT' | 'DPAD_RIGHT' | 'DPAD_CENTER' | 'APP_SWITCH';
69
+ export type Orientation = 'portrait' | 'landscape';
70
+ export interface GesturePoint {
71
+ x: number;
72
+ y: number;
73
+ /** Time offset from start in ms */
74
+ time?: number;
75
+ }
76
+ export interface GestureSequence {
77
+ /** Each sub-array is a finger/pointer path */
78
+ pointers: GesturePoint[][];
79
+ }
80
+ export type ScreenshotFormat = 'png' | 'jpeg';
81
+ export interface ScreenshotOptions {
82
+ format?: ScreenshotFormat;
83
+ quality?: number;
84
+ }
85
+ export interface ScreenSize {
86
+ width: number;
87
+ height: number;
88
+ }
89
+ export interface ListDevicesOptions {
90
+ platform?: Platform;
91
+ state?: DeviceState;
92
+ }
93
+ export interface RecordingOptions {
94
+ /** Output file path for the video (MP4) */
95
+ output: string;
96
+ /** Max recording duration in seconds (0 = no limit) */
97
+ timeLimit?: number;
98
+ }
99
+ export interface RecordingResult {
100
+ /** Path to the output video file */
101
+ output: string;
102
+ /** Human-readable duration string */
103
+ duration?: string;
104
+ }
105
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,SAAS,EAA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CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ // ─── View Hierarchy ──────────────────────────────────────────────
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oEAAoE"}
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@mobilewright/protocol",
3
+ "version": "0.0.1",
4
+ "description": "Protocol interfaces for Mobilewright drivers",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ }
13
+ },
14
+ "scripts": {
15
+ "build": "tsc -b",
16
+ "prepublishOnly": "tsc -b"
17
+ },
18
+ "files": ["dist"]
19
+ }