@react-three-dom/playwright 0.1.0
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.cjs +391 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +279 -0
- package/dist/index.d.ts +279 -0
- package/dist/index.js +378 -0
- package/dist/index.js.map +1 -0
- package/package.json +37 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as _playwright_test from '@playwright/test';
|
|
2
|
+
import { Page } from '@playwright/test';
|
|
3
|
+
|
|
4
|
+
interface ObjectMetadata {
|
|
5
|
+
uuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
testId?: string;
|
|
10
|
+
geometryType?: string;
|
|
11
|
+
materialType?: string;
|
|
12
|
+
vertexCount?: number;
|
|
13
|
+
triangleCount?: number;
|
|
14
|
+
instanceCount?: number;
|
|
15
|
+
position: [number, number, number];
|
|
16
|
+
rotation: [number, number, number];
|
|
17
|
+
scale: [number, number, number];
|
|
18
|
+
parentUuid: string | null;
|
|
19
|
+
childrenUuids: string[];
|
|
20
|
+
boundsDirty: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface ObjectInspection {
|
|
23
|
+
metadata: ObjectMetadata;
|
|
24
|
+
worldMatrix: number[];
|
|
25
|
+
bounds: {
|
|
26
|
+
min: [number, number, number];
|
|
27
|
+
max: [number, number, number];
|
|
28
|
+
};
|
|
29
|
+
geometry?: {
|
|
30
|
+
type: string;
|
|
31
|
+
attributes: Record<string, {
|
|
32
|
+
itemSize: number;
|
|
33
|
+
count: number;
|
|
34
|
+
}>;
|
|
35
|
+
index?: {
|
|
36
|
+
count: number;
|
|
37
|
+
};
|
|
38
|
+
boundingSphere?: {
|
|
39
|
+
center: [number, number, number];
|
|
40
|
+
radius: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
material?: {
|
|
44
|
+
type: string;
|
|
45
|
+
color?: string;
|
|
46
|
+
map?: string;
|
|
47
|
+
uniforms?: Record<string, unknown>;
|
|
48
|
+
transparent?: boolean;
|
|
49
|
+
opacity?: number;
|
|
50
|
+
side?: number;
|
|
51
|
+
};
|
|
52
|
+
userData: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
interface SnapshotNode {
|
|
55
|
+
uuid: string;
|
|
56
|
+
name: string;
|
|
57
|
+
type: string;
|
|
58
|
+
testId?: string;
|
|
59
|
+
visible: boolean;
|
|
60
|
+
position: [number, number, number];
|
|
61
|
+
rotation: [number, number, number];
|
|
62
|
+
scale: [number, number, number];
|
|
63
|
+
children: SnapshotNode[];
|
|
64
|
+
}
|
|
65
|
+
interface SceneSnapshot {
|
|
66
|
+
timestamp: number;
|
|
67
|
+
objectCount: number;
|
|
68
|
+
tree: SnapshotNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface WaitForSceneReadyOptions {
|
|
72
|
+
/** How many consecutive stable polls are required. Default: 3 */
|
|
73
|
+
stableChecks?: number;
|
|
74
|
+
/** Interval between polls in ms. Default: 100 */
|
|
75
|
+
pollIntervalMs?: number;
|
|
76
|
+
/** Overall timeout in ms. Default: 10_000 */
|
|
77
|
+
timeout?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Wait until `window.__R3F_DOM__` is available and the scene's object count
|
|
81
|
+
* has stabilised (no additions or removals) over several consecutive checks.
|
|
82
|
+
*/
|
|
83
|
+
declare function waitForSceneReady(page: Page, options?: WaitForSceneReadyOptions): Promise<void>;
|
|
84
|
+
interface WaitForIdleOptions {
|
|
85
|
+
/** Number of consecutive idle frames required. Default: 10 */
|
|
86
|
+
idleFrames?: number;
|
|
87
|
+
/** Overall timeout in ms. Default: 10_000 */
|
|
88
|
+
timeout?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Wait until no object properties have changed for a number of consecutive
|
|
92
|
+
* animation frames. Useful after triggering animations or interactions.
|
|
93
|
+
*
|
|
94
|
+
* This works by taking successive snapshots and comparing them. When the
|
|
95
|
+
* JSON representation is unchanged for `idleFrames` consecutive rAF
|
|
96
|
+
* callbacks, the scene is considered idle.
|
|
97
|
+
*/
|
|
98
|
+
declare function waitForIdle(page: Page, options?: WaitForIdleOptions): Promise<void>;
|
|
99
|
+
|
|
100
|
+
declare class R3FFixture {
|
|
101
|
+
private readonly _page;
|
|
102
|
+
constructor(_page: Page);
|
|
103
|
+
/** The underlying Playwright Page. */
|
|
104
|
+
get page(): Page;
|
|
105
|
+
/** Get object metadata by testId or uuid. Returns null if not found. */
|
|
106
|
+
getObject(idOrUuid: string): Promise<ObjectMetadata | null>;
|
|
107
|
+
/** Get heavy inspection data (Tier 2) by testId or uuid. */
|
|
108
|
+
inspect(idOrUuid: string): Promise<ObjectInspection | null>;
|
|
109
|
+
/** Take a full scene snapshot. */
|
|
110
|
+
snapshot(): Promise<SceneSnapshot | null>;
|
|
111
|
+
/** Get the total number of tracked objects. */
|
|
112
|
+
getCount(): Promise<number>;
|
|
113
|
+
/** Click a 3D object by testId or uuid. */
|
|
114
|
+
click(idOrUuid: string): Promise<void>;
|
|
115
|
+
/** Double-click a 3D object by testId or uuid. */
|
|
116
|
+
doubleClick(idOrUuid: string): Promise<void>;
|
|
117
|
+
/** Right-click / context-menu a 3D object by testId or uuid. */
|
|
118
|
+
contextMenu(idOrUuid: string): Promise<void>;
|
|
119
|
+
/** Hover over a 3D object by testId or uuid. */
|
|
120
|
+
hover(idOrUuid: string): Promise<void>;
|
|
121
|
+
/** Drag a 3D object with a world-space delta vector. */
|
|
122
|
+
drag(idOrUuid: string, delta: {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
z: number;
|
|
126
|
+
}): Promise<void>;
|
|
127
|
+
/** Dispatch a wheel/scroll event on a 3D object. */
|
|
128
|
+
wheel(idOrUuid: string, options?: {
|
|
129
|
+
deltaY?: number;
|
|
130
|
+
deltaX?: number;
|
|
131
|
+
}): Promise<void>;
|
|
132
|
+
/** Click empty space to trigger onPointerMissed handlers. */
|
|
133
|
+
pointerMiss(): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Wait until the scene is ready — `window.__R3F_DOM__` is available and
|
|
136
|
+
* the object count has stabilised across several consecutive checks.
|
|
137
|
+
*/
|
|
138
|
+
waitForSceneReady(options?: WaitForSceneReadyOptions): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Wait until no object properties have changed for a number of consecutive
|
|
141
|
+
* animation frames. Useful after triggering interactions or animations.
|
|
142
|
+
*/
|
|
143
|
+
waitForIdle(options?: WaitForIdleOptions): Promise<void>;
|
|
144
|
+
/** Select a 3D object by testId or uuid (highlights in scene). */
|
|
145
|
+
select(idOrUuid: string): Promise<void>;
|
|
146
|
+
/** Clear the current selection. */
|
|
147
|
+
clearSelection(): Promise<void>;
|
|
148
|
+
}
|
|
149
|
+
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & {
|
|
150
|
+
r3f: R3FFixture;
|
|
151
|
+
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Extend Playwright's `expect` with 3D-native matchers.
|
|
155
|
+
*
|
|
156
|
+
* Usage:
|
|
157
|
+
* ```ts
|
|
158
|
+
* import { test, expect } from '@react-three-dom/playwright';
|
|
159
|
+
*
|
|
160
|
+
* test('chair exists', async ({ page, r3f }) => {
|
|
161
|
+
* await r3f.waitForSceneReady();
|
|
162
|
+
* await expect(r3f).toExist('chair-primary');
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare const expect: _playwright_test.Expect<{
|
|
167
|
+
toExist(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string): Promise<{
|
|
168
|
+
pass: boolean;
|
|
169
|
+
message: () => string;
|
|
170
|
+
name: string;
|
|
171
|
+
expected: string;
|
|
172
|
+
actual: ObjectMetadata | null;
|
|
173
|
+
}>;
|
|
174
|
+
toBeVisible(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string): Promise<{
|
|
175
|
+
pass: false;
|
|
176
|
+
message: () => string;
|
|
177
|
+
name: string;
|
|
178
|
+
expected?: undefined;
|
|
179
|
+
actual?: undefined;
|
|
180
|
+
} | {
|
|
181
|
+
pass: boolean;
|
|
182
|
+
message: () => string;
|
|
183
|
+
name: string;
|
|
184
|
+
expected: boolean;
|
|
185
|
+
actual: boolean;
|
|
186
|
+
}>;
|
|
187
|
+
toBeInFrustum(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string): Promise<{
|
|
188
|
+
pass: false;
|
|
189
|
+
message: () => string;
|
|
190
|
+
name: string;
|
|
191
|
+
expected?: undefined;
|
|
192
|
+
actual?: undefined;
|
|
193
|
+
} | {
|
|
194
|
+
pass: boolean;
|
|
195
|
+
message: () => string;
|
|
196
|
+
name: string;
|
|
197
|
+
expected: string;
|
|
198
|
+
actual: {
|
|
199
|
+
min: [number, number, number];
|
|
200
|
+
max: [number, number, number];
|
|
201
|
+
};
|
|
202
|
+
}>;
|
|
203
|
+
toHavePosition(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string, expected: [number, number, number], tolerance?: any): Promise<{
|
|
204
|
+
pass: false;
|
|
205
|
+
message: () => string;
|
|
206
|
+
name: string;
|
|
207
|
+
expected?: undefined;
|
|
208
|
+
actual?: undefined;
|
|
209
|
+
} | {
|
|
210
|
+
pass: boolean;
|
|
211
|
+
message: () => string;
|
|
212
|
+
name: string;
|
|
213
|
+
expected: [number, number, number];
|
|
214
|
+
actual: [number, number, number];
|
|
215
|
+
}>;
|
|
216
|
+
toHaveBounds(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string, expected: {
|
|
217
|
+
min: [number, number, number];
|
|
218
|
+
max: [number, number, number];
|
|
219
|
+
}, tolerance?: any): Promise<{
|
|
220
|
+
pass: false;
|
|
221
|
+
message: () => string;
|
|
222
|
+
name: string;
|
|
223
|
+
expected?: undefined;
|
|
224
|
+
actual?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
pass: boolean;
|
|
227
|
+
message: () => string;
|
|
228
|
+
name: string;
|
|
229
|
+
expected: {
|
|
230
|
+
min: [number, number, number];
|
|
231
|
+
max: [number, number, number];
|
|
232
|
+
};
|
|
233
|
+
actual: {
|
|
234
|
+
min: [number, number, number];
|
|
235
|
+
max: [number, number, number];
|
|
236
|
+
};
|
|
237
|
+
}>;
|
|
238
|
+
toHaveInstanceCount(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string, expectedCount: number): Promise<{
|
|
239
|
+
pass: false;
|
|
240
|
+
message: () => string;
|
|
241
|
+
name: string;
|
|
242
|
+
expected?: undefined;
|
|
243
|
+
actual?: undefined;
|
|
244
|
+
} | {
|
|
245
|
+
pass: boolean;
|
|
246
|
+
message: () => string;
|
|
247
|
+
name: string;
|
|
248
|
+
expected: number;
|
|
249
|
+
actual: number;
|
|
250
|
+
}>;
|
|
251
|
+
}>;
|
|
252
|
+
interface R3FMatcherReceiver {
|
|
253
|
+
getObject(idOrUuid: string): Promise<ObjectMetadata | null>;
|
|
254
|
+
inspect(idOrUuid: string): Promise<ObjectInspection | null>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Click a 3D object by its testId or uuid. */
|
|
258
|
+
declare function click(page: Page, idOrUuid: string): Promise<void>;
|
|
259
|
+
/** Double-click a 3D object by its testId or uuid. */
|
|
260
|
+
declare function doubleClick(page: Page, idOrUuid: string): Promise<void>;
|
|
261
|
+
/** Right-click / context-menu a 3D object by its testId or uuid. */
|
|
262
|
+
declare function contextMenu(page: Page, idOrUuid: string): Promise<void>;
|
|
263
|
+
/** Hover over a 3D object by its testId or uuid. */
|
|
264
|
+
declare function hover(page: Page, idOrUuid: string): Promise<void>;
|
|
265
|
+
/** Drag a 3D object by its testId or uuid with a given world-space delta. */
|
|
266
|
+
declare function drag(page: Page, idOrUuid: string, delta: {
|
|
267
|
+
x: number;
|
|
268
|
+
y: number;
|
|
269
|
+
z: number;
|
|
270
|
+
}): Promise<void>;
|
|
271
|
+
/** Dispatch a wheel/scroll event on a 3D object. */
|
|
272
|
+
declare function wheel(page: Page, idOrUuid: string, options?: {
|
|
273
|
+
deltaY?: number;
|
|
274
|
+
deltaX?: number;
|
|
275
|
+
}): Promise<void>;
|
|
276
|
+
/** Click empty space to trigger onPointerMissed handlers. */
|
|
277
|
+
declare function pointerMiss(page: Page): Promise<void>;
|
|
278
|
+
|
|
279
|
+
export { type ObjectInspection, type ObjectMetadata, R3FFixture, type SceneSnapshot, type SnapshotNode, type WaitForIdleOptions, type WaitForSceneReadyOptions, click, contextMenu, doubleClick, drag, expect, hover, pointerMiss, test, waitForIdle, waitForSceneReady, wheel };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as _playwright_test from '@playwright/test';
|
|
2
|
+
import { Page } from '@playwright/test';
|
|
3
|
+
|
|
4
|
+
interface ObjectMetadata {
|
|
5
|
+
uuid: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
visible: boolean;
|
|
9
|
+
testId?: string;
|
|
10
|
+
geometryType?: string;
|
|
11
|
+
materialType?: string;
|
|
12
|
+
vertexCount?: number;
|
|
13
|
+
triangleCount?: number;
|
|
14
|
+
instanceCount?: number;
|
|
15
|
+
position: [number, number, number];
|
|
16
|
+
rotation: [number, number, number];
|
|
17
|
+
scale: [number, number, number];
|
|
18
|
+
parentUuid: string | null;
|
|
19
|
+
childrenUuids: string[];
|
|
20
|
+
boundsDirty: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface ObjectInspection {
|
|
23
|
+
metadata: ObjectMetadata;
|
|
24
|
+
worldMatrix: number[];
|
|
25
|
+
bounds: {
|
|
26
|
+
min: [number, number, number];
|
|
27
|
+
max: [number, number, number];
|
|
28
|
+
};
|
|
29
|
+
geometry?: {
|
|
30
|
+
type: string;
|
|
31
|
+
attributes: Record<string, {
|
|
32
|
+
itemSize: number;
|
|
33
|
+
count: number;
|
|
34
|
+
}>;
|
|
35
|
+
index?: {
|
|
36
|
+
count: number;
|
|
37
|
+
};
|
|
38
|
+
boundingSphere?: {
|
|
39
|
+
center: [number, number, number];
|
|
40
|
+
radius: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
material?: {
|
|
44
|
+
type: string;
|
|
45
|
+
color?: string;
|
|
46
|
+
map?: string;
|
|
47
|
+
uniforms?: Record<string, unknown>;
|
|
48
|
+
transparent?: boolean;
|
|
49
|
+
opacity?: number;
|
|
50
|
+
side?: number;
|
|
51
|
+
};
|
|
52
|
+
userData: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
interface SnapshotNode {
|
|
55
|
+
uuid: string;
|
|
56
|
+
name: string;
|
|
57
|
+
type: string;
|
|
58
|
+
testId?: string;
|
|
59
|
+
visible: boolean;
|
|
60
|
+
position: [number, number, number];
|
|
61
|
+
rotation: [number, number, number];
|
|
62
|
+
scale: [number, number, number];
|
|
63
|
+
children: SnapshotNode[];
|
|
64
|
+
}
|
|
65
|
+
interface SceneSnapshot {
|
|
66
|
+
timestamp: number;
|
|
67
|
+
objectCount: number;
|
|
68
|
+
tree: SnapshotNode;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
interface WaitForSceneReadyOptions {
|
|
72
|
+
/** How many consecutive stable polls are required. Default: 3 */
|
|
73
|
+
stableChecks?: number;
|
|
74
|
+
/** Interval between polls in ms. Default: 100 */
|
|
75
|
+
pollIntervalMs?: number;
|
|
76
|
+
/** Overall timeout in ms. Default: 10_000 */
|
|
77
|
+
timeout?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Wait until `window.__R3F_DOM__` is available and the scene's object count
|
|
81
|
+
* has stabilised (no additions or removals) over several consecutive checks.
|
|
82
|
+
*/
|
|
83
|
+
declare function waitForSceneReady(page: Page, options?: WaitForSceneReadyOptions): Promise<void>;
|
|
84
|
+
interface WaitForIdleOptions {
|
|
85
|
+
/** Number of consecutive idle frames required. Default: 10 */
|
|
86
|
+
idleFrames?: number;
|
|
87
|
+
/** Overall timeout in ms. Default: 10_000 */
|
|
88
|
+
timeout?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Wait until no object properties have changed for a number of consecutive
|
|
92
|
+
* animation frames. Useful after triggering animations or interactions.
|
|
93
|
+
*
|
|
94
|
+
* This works by taking successive snapshots and comparing them. When the
|
|
95
|
+
* JSON representation is unchanged for `idleFrames` consecutive rAF
|
|
96
|
+
* callbacks, the scene is considered idle.
|
|
97
|
+
*/
|
|
98
|
+
declare function waitForIdle(page: Page, options?: WaitForIdleOptions): Promise<void>;
|
|
99
|
+
|
|
100
|
+
declare class R3FFixture {
|
|
101
|
+
private readonly _page;
|
|
102
|
+
constructor(_page: Page);
|
|
103
|
+
/** The underlying Playwright Page. */
|
|
104
|
+
get page(): Page;
|
|
105
|
+
/** Get object metadata by testId or uuid. Returns null if not found. */
|
|
106
|
+
getObject(idOrUuid: string): Promise<ObjectMetadata | null>;
|
|
107
|
+
/** Get heavy inspection data (Tier 2) by testId or uuid. */
|
|
108
|
+
inspect(idOrUuid: string): Promise<ObjectInspection | null>;
|
|
109
|
+
/** Take a full scene snapshot. */
|
|
110
|
+
snapshot(): Promise<SceneSnapshot | null>;
|
|
111
|
+
/** Get the total number of tracked objects. */
|
|
112
|
+
getCount(): Promise<number>;
|
|
113
|
+
/** Click a 3D object by testId or uuid. */
|
|
114
|
+
click(idOrUuid: string): Promise<void>;
|
|
115
|
+
/** Double-click a 3D object by testId or uuid. */
|
|
116
|
+
doubleClick(idOrUuid: string): Promise<void>;
|
|
117
|
+
/** Right-click / context-menu a 3D object by testId or uuid. */
|
|
118
|
+
contextMenu(idOrUuid: string): Promise<void>;
|
|
119
|
+
/** Hover over a 3D object by testId or uuid. */
|
|
120
|
+
hover(idOrUuid: string): Promise<void>;
|
|
121
|
+
/** Drag a 3D object with a world-space delta vector. */
|
|
122
|
+
drag(idOrUuid: string, delta: {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
z: number;
|
|
126
|
+
}): Promise<void>;
|
|
127
|
+
/** Dispatch a wheel/scroll event on a 3D object. */
|
|
128
|
+
wheel(idOrUuid: string, options?: {
|
|
129
|
+
deltaY?: number;
|
|
130
|
+
deltaX?: number;
|
|
131
|
+
}): Promise<void>;
|
|
132
|
+
/** Click empty space to trigger onPointerMissed handlers. */
|
|
133
|
+
pointerMiss(): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Wait until the scene is ready — `window.__R3F_DOM__` is available and
|
|
136
|
+
* the object count has stabilised across several consecutive checks.
|
|
137
|
+
*/
|
|
138
|
+
waitForSceneReady(options?: WaitForSceneReadyOptions): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Wait until no object properties have changed for a number of consecutive
|
|
141
|
+
* animation frames. Useful after triggering interactions or animations.
|
|
142
|
+
*/
|
|
143
|
+
waitForIdle(options?: WaitForIdleOptions): Promise<void>;
|
|
144
|
+
/** Select a 3D object by testId or uuid (highlights in scene). */
|
|
145
|
+
select(idOrUuid: string): Promise<void>;
|
|
146
|
+
/** Clear the current selection. */
|
|
147
|
+
clearSelection(): Promise<void>;
|
|
148
|
+
}
|
|
149
|
+
declare const test: _playwright_test.TestType<_playwright_test.PlaywrightTestArgs & _playwright_test.PlaywrightTestOptions & {
|
|
150
|
+
r3f: R3FFixture;
|
|
151
|
+
}, _playwright_test.PlaywrightWorkerArgs & _playwright_test.PlaywrightWorkerOptions>;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Extend Playwright's `expect` with 3D-native matchers.
|
|
155
|
+
*
|
|
156
|
+
* Usage:
|
|
157
|
+
* ```ts
|
|
158
|
+
* import { test, expect } from '@react-three-dom/playwright';
|
|
159
|
+
*
|
|
160
|
+
* test('chair exists', async ({ page, r3f }) => {
|
|
161
|
+
* await r3f.waitForSceneReady();
|
|
162
|
+
* await expect(r3f).toExist('chair-primary');
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
declare const expect: _playwright_test.Expect<{
|
|
167
|
+
toExist(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string): Promise<{
|
|
168
|
+
pass: boolean;
|
|
169
|
+
message: () => string;
|
|
170
|
+
name: string;
|
|
171
|
+
expected: string;
|
|
172
|
+
actual: ObjectMetadata | null;
|
|
173
|
+
}>;
|
|
174
|
+
toBeVisible(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string): Promise<{
|
|
175
|
+
pass: false;
|
|
176
|
+
message: () => string;
|
|
177
|
+
name: string;
|
|
178
|
+
expected?: undefined;
|
|
179
|
+
actual?: undefined;
|
|
180
|
+
} | {
|
|
181
|
+
pass: boolean;
|
|
182
|
+
message: () => string;
|
|
183
|
+
name: string;
|
|
184
|
+
expected: boolean;
|
|
185
|
+
actual: boolean;
|
|
186
|
+
}>;
|
|
187
|
+
toBeInFrustum(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string): Promise<{
|
|
188
|
+
pass: false;
|
|
189
|
+
message: () => string;
|
|
190
|
+
name: string;
|
|
191
|
+
expected?: undefined;
|
|
192
|
+
actual?: undefined;
|
|
193
|
+
} | {
|
|
194
|
+
pass: boolean;
|
|
195
|
+
message: () => string;
|
|
196
|
+
name: string;
|
|
197
|
+
expected: string;
|
|
198
|
+
actual: {
|
|
199
|
+
min: [number, number, number];
|
|
200
|
+
max: [number, number, number];
|
|
201
|
+
};
|
|
202
|
+
}>;
|
|
203
|
+
toHavePosition(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string, expected: [number, number, number], tolerance?: any): Promise<{
|
|
204
|
+
pass: false;
|
|
205
|
+
message: () => string;
|
|
206
|
+
name: string;
|
|
207
|
+
expected?: undefined;
|
|
208
|
+
actual?: undefined;
|
|
209
|
+
} | {
|
|
210
|
+
pass: boolean;
|
|
211
|
+
message: () => string;
|
|
212
|
+
name: string;
|
|
213
|
+
expected: [number, number, number];
|
|
214
|
+
actual: [number, number, number];
|
|
215
|
+
}>;
|
|
216
|
+
toHaveBounds(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string, expected: {
|
|
217
|
+
min: [number, number, number];
|
|
218
|
+
max: [number, number, number];
|
|
219
|
+
}, tolerance?: any): Promise<{
|
|
220
|
+
pass: false;
|
|
221
|
+
message: () => string;
|
|
222
|
+
name: string;
|
|
223
|
+
expected?: undefined;
|
|
224
|
+
actual?: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
pass: boolean;
|
|
227
|
+
message: () => string;
|
|
228
|
+
name: string;
|
|
229
|
+
expected: {
|
|
230
|
+
min: [number, number, number];
|
|
231
|
+
max: [number, number, number];
|
|
232
|
+
};
|
|
233
|
+
actual: {
|
|
234
|
+
min: [number, number, number];
|
|
235
|
+
max: [number, number, number];
|
|
236
|
+
};
|
|
237
|
+
}>;
|
|
238
|
+
toHaveInstanceCount(this: _playwright_test.ExpectMatcherState, r3f: R3FMatcherReceiver, idOrUuid: string, expectedCount: number): Promise<{
|
|
239
|
+
pass: false;
|
|
240
|
+
message: () => string;
|
|
241
|
+
name: string;
|
|
242
|
+
expected?: undefined;
|
|
243
|
+
actual?: undefined;
|
|
244
|
+
} | {
|
|
245
|
+
pass: boolean;
|
|
246
|
+
message: () => string;
|
|
247
|
+
name: string;
|
|
248
|
+
expected: number;
|
|
249
|
+
actual: number;
|
|
250
|
+
}>;
|
|
251
|
+
}>;
|
|
252
|
+
interface R3FMatcherReceiver {
|
|
253
|
+
getObject(idOrUuid: string): Promise<ObjectMetadata | null>;
|
|
254
|
+
inspect(idOrUuid: string): Promise<ObjectInspection | null>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/** Click a 3D object by its testId or uuid. */
|
|
258
|
+
declare function click(page: Page, idOrUuid: string): Promise<void>;
|
|
259
|
+
/** Double-click a 3D object by its testId or uuid. */
|
|
260
|
+
declare function doubleClick(page: Page, idOrUuid: string): Promise<void>;
|
|
261
|
+
/** Right-click / context-menu a 3D object by its testId or uuid. */
|
|
262
|
+
declare function contextMenu(page: Page, idOrUuid: string): Promise<void>;
|
|
263
|
+
/** Hover over a 3D object by its testId or uuid. */
|
|
264
|
+
declare function hover(page: Page, idOrUuid: string): Promise<void>;
|
|
265
|
+
/** Drag a 3D object by its testId or uuid with a given world-space delta. */
|
|
266
|
+
declare function drag(page: Page, idOrUuid: string, delta: {
|
|
267
|
+
x: number;
|
|
268
|
+
y: number;
|
|
269
|
+
z: number;
|
|
270
|
+
}): Promise<void>;
|
|
271
|
+
/** Dispatch a wheel/scroll event on a 3D object. */
|
|
272
|
+
declare function wheel(page: Page, idOrUuid: string, options?: {
|
|
273
|
+
deltaY?: number;
|
|
274
|
+
deltaX?: number;
|
|
275
|
+
}): Promise<void>;
|
|
276
|
+
/** Click empty space to trigger onPointerMissed handlers. */
|
|
277
|
+
declare function pointerMiss(page: Page): Promise<void>;
|
|
278
|
+
|
|
279
|
+
export { type ObjectInspection, type ObjectMetadata, R3FFixture, type SceneSnapshot, type SnapshotNode, type WaitForIdleOptions, type WaitForSceneReadyOptions, click, contextMenu, doubleClick, drag, expect, hover, pointerMiss, test, waitForIdle, waitForSceneReady, wheel };
|