@pixui-dev/inflight-test 0.0.7-inflight.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,1666 @@
1
+ import { A as TestArtifact, C as joinPath, D as SuiteCollector, E as SuiteAPI, F as beforeEach, I as onTestFailed, L as onTestFinished, M as afterAll, N as afterEach, O as Test, P as beforeAll, R as ExpectStatic, S as createRunId, T as FileSpecification, _ as ProgressSurface, a as StartOptions, b as QuickjsReportIo, c as start, d as CaptureScreenRequest, f as CaptureScreenResult, g as ConsoleProgressSurface, h as CollectingProgressSurface, i as RunProgressEvent, j as VitestRunner, k as TestAPI, l as ActivityBridge, m as PROTOCOL_CAPTURE_SCREEN_CALLBACK, n as InflightRunResult, o as TestFileSpec, p as PROTOCOL_CAPTURE_SCREEN, r as InflightVitestRunner, s as run, t as InflightRunOptions, u as CaptureRect, v as MemoryReportIo, w as File, x as ReportIo, y as QuickjsOs } from "./run-tests-DXJBHVSi.js";
2
+
3
+ //#region src/vendored/runtime/runner/suite.d.ts
4
+ /**
5
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
6
+ * Suites can contain both tests and other suites, enabling complex test structures.
7
+ *
8
+ * @param {string} name - The name of the suite, used for identification and reporting.
9
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
10
+ * @example
11
+ * ```ts
12
+ * // Define a suite with two tests
13
+ * suite('Math operations', () => {
14
+ * test('should add two numbers', () => {
15
+ * expect(add(1, 2)).toBe(3);
16
+ * });
17
+ *
18
+ * test('should subtract two numbers', () => {
19
+ * expect(subtract(5, 2)).toBe(3);
20
+ * });
21
+ * });
22
+ * ```
23
+ * @example
24
+ * ```ts
25
+ * // Define nested suites
26
+ * suite('String operations', () => {
27
+ * suite('Trimming', () => {
28
+ * test('should trim whitespace from start and end', () => {
29
+ * expect(' hello '.trim()).toBe('hello');
30
+ * });
31
+ * });
32
+ *
33
+ * suite('Concatenation', () => {
34
+ * test('should concatenate two strings', () => {
35
+ * expect('hello' + ' ' + 'world').toBe('hello world');
36
+ * });
37
+ * });
38
+ * });
39
+ * ```
40
+ */
41
+ declare const suite: SuiteAPI;
42
+ /**
43
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
44
+ *
45
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
46
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
47
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
48
+ * @throws {Error} If called inside another test function.
49
+ * @example
50
+ * ```ts
51
+ * // Define a simple test
52
+ * test('should add two numbers', () => {
53
+ * expect(add(1, 2)).toBe(3);
54
+ * });
55
+ * ```
56
+ * @example
57
+ * ```ts
58
+ * // Define a test with options
59
+ * test('should subtract two numbers', { retry: 3 }, () => {
60
+ * expect(subtract(5, 2)).toBe(3);
61
+ * });
62
+ * ```
63
+ */
64
+ declare const test: TestAPI;
65
+ /**
66
+ * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
67
+ * Suites can contain both tests and other suites, enabling complex test structures.
68
+ *
69
+ * @param {string} name - The name of the suite, used for identification and reporting.
70
+ * @param {Function} fn - A function that defines the tests and suites within this suite.
71
+ * @example
72
+ * ```ts
73
+ * // Define a suite with two tests
74
+ * describe('Math operations', () => {
75
+ * test('should add two numbers', () => {
76
+ * expect(add(1, 2)).toBe(3);
77
+ * });
78
+ *
79
+ * test('should subtract two numbers', () => {
80
+ * expect(subtract(5, 2)).toBe(3);
81
+ * });
82
+ * });
83
+ * ```
84
+ * @example
85
+ * ```ts
86
+ * // Define nested suites
87
+ * describe('String operations', () => {
88
+ * describe('Trimming', () => {
89
+ * test('should trim whitespace from start and end', () => {
90
+ * expect(' hello '.trim()).toBe('hello');
91
+ * });
92
+ * });
93
+ *
94
+ * describe('Concatenation', () => {
95
+ * test('should concatenate two strings', () => {
96
+ * expect('hello' + ' ' + 'world').toBe('hello world');
97
+ * });
98
+ * });
99
+ * });
100
+ * ```
101
+ */
102
+ declare const describe: SuiteAPI;
103
+ /**
104
+ * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
105
+ *
106
+ * @param {string | Function} name - The name of the test or a function that will be used as a test name.
107
+ * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
108
+ * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
109
+ * @throws {Error} If called inside another test function.
110
+ * @example
111
+ * ```ts
112
+ * // Define a simple test
113
+ * it('adds two numbers', () => {
114
+ * expect(add(1, 2)).toBe(3);
115
+ * });
116
+ * ```
117
+ * @example
118
+ * ```ts
119
+ * // Define a test with options
120
+ * it('subtracts two numbers', { retry: 3 }, () => {
121
+ * expect(subtract(5, 2)).toBe(3);
122
+ * });
123
+ * ```
124
+ */
125
+ declare const it: TestAPI;
126
+ declare function getRunner(): VitestRunner;
127
+ declare function getCurrentSuite<ExtraContext = object>(): SuiteCollector<ExtraContext>;
128
+ //#endregion
129
+ //#region src/vendored/runtime/runner/artifact.d.ts
130
+ /**
131
+ * @experimental
132
+ * @advanced
133
+ *
134
+ * Records a custom test artifact during test execution.
135
+ *
136
+ * This function allows you to attach structured data, files, or metadata to a test.
137
+ *
138
+ * Vitest automatically injects the source location where the artifact was created and manages any attachments you include.
139
+ *
140
+ * **Note:** artifacts must be recorded before the task is reported. Any artifacts recorded after that will not be included in the task.
141
+ *
142
+ * @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests
143
+ * @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase}
144
+ *
145
+ * @returns A promise that resolves to the recorded artifact with location injected
146
+ *
147
+ * @throws {Error} If the test runner doesn't support artifacts
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * // In a custom assertion
152
+ * async function toHaveValidSchema(this: MatcherState, actual: unknown) {
153
+ * const validation = validateSchema(actual)
154
+ *
155
+ * await recordArtifact(this.task, {
156
+ * type: 'my-plugin:schema-validation',
157
+ * passed: validation.valid,
158
+ * errors: validation.errors,
159
+ * })
160
+ *
161
+ * return { pass: validation.valid, message: () => '...' }
162
+ * }
163
+ * ```
164
+ */
165
+ declare function recordArtifact<Artifact extends TestArtifact>(task: Test, artifact: Artifact): Promise<Artifact>;
166
+ //#endregion
167
+ //#region src/vendored/runtime/runner/run.d.ts
168
+ declare function startTests(specs: string[] | FileSpecification[], runner: VitestRunner): Promise<File[]>;
169
+ //#endregion
170
+ //#region src/vendored/runtime/runner/collect.d.ts
171
+ declare function collectTests(specs: string[] | FileSpecification[], runner: VitestRunner): Promise<File[]>;
172
+ //#endregion
173
+ //#region src/expect.d.ts
174
+ declare const expect: ExpectStatic;
175
+ //#endregion
176
+ //#region src/reporter/blob-report.d.ts
177
+ interface BlobReportInput {
178
+ /** The runner task tree (`File[]` returned by `startTests`). */
179
+ files: unknown[];
180
+ /** Unhandled errors collected during the run. */
181
+ errors?: unknown[];
182
+ /** Total wall-clock execution time, ms. */
183
+ executionTime: number;
184
+ }
185
+ /**
186
+ * Serialize a blob report payload, byte-for-byte compatible with what
187
+ * Vitest's own BlobReporter would write (modulo the empty coverage / module
188
+ * graph fields described above).
189
+ */
190
+ declare function serializeBlobReport(input: BlobReportInput): string;
191
+ interface WriteBlobReportOptions extends BlobReportInput {
192
+ /** Report root, e.g. `<external.writeablePath>/inflight-test-report`. */
193
+ reportRoot: string;
194
+ /** Pre-computed run id; defaults to a fresh local-time id. */
195
+ runId?: string;
196
+ }
197
+ interface WrittenReport {
198
+ /** Absolute path of this run's directory. */
199
+ runDir: string;
200
+ /** Absolute path of the written `report.blob`. */
201
+ blobPath: string;
202
+ runId: string;
203
+ }
204
+ /**
205
+ * Write `<reportRoot>/<run-id>/report.blob` via the injected {@link ReportIo}.
206
+ * Returns the resolved paths (the run dir is surfaced to the user on the
207
+ * end-of-run summary — req 4.3).
208
+ */
209
+ declare function writeBlobReport(io: ReportIo, options: WriteBlobReportOptions): WrittenReport;
210
+ //#endregion
211
+ //#region src/page/screenshot.d.ts
212
+ interface CaptureScreenshotOptions {
213
+ bridge: ActivityBridge;
214
+ io: ReportIo;
215
+ /** Absolute run directory; screenshots land in `<runDir>/screenshots/`. */
216
+ runDir: string;
217
+ /** File name within `screenshots/`, e.g. `<test-id>__<name>.png`. */
218
+ fileName: string;
219
+ /** Region to capture; defaults to the full `window.screen`. */
220
+ clip?: CaptureRect;
221
+ timeoutMs?: number;
222
+ }
223
+ interface CapturedScreenshot {
224
+ /** Path relative to the run directory — stored on the artifact (req 5.5). */
225
+ relativePath: string;
226
+ /** Absolute path written. */
227
+ absolutePath: string;
228
+ /** The PNG bytes. */
229
+ bytes: Uint8Array;
230
+ }
231
+ declare function captureScreenshot(options: CaptureScreenshotOptions): Promise<CapturedScreenshot>;
232
+ //#endregion
233
+ //#region src/page/simulated-bridge.d.ts
234
+ /** A minimal valid 1×1 transparent PNG, used as the default rendered frame. */
235
+ declare const TINY_PNG: Uint8Array;
236
+ interface SimulatedScreenshotHostOptions {
237
+ /** Produce PNG bytes for a capture request. Default: {@link TINY_PNG}. */
238
+ render?: (req: CaptureScreenRequest) => Uint8Array;
239
+ /**
240
+ * The host writes its PNG into this ReportIo and replies with its `savePath`
241
+ * (exercising the os.read copy path). Pass the SAME ReportIo the screenshot
242
+ * reader uses so the round-trip closes. Required for a successful capture.
243
+ */
244
+ io?: ReportIo;
245
+ /** Temp directory the host writes into (with `io`). Default `/pandora-capture-tmp`. */
246
+ tempDir?: string;
247
+ /** Simulate a failed capture — reply with an empty `savePath`. */
248
+ fail?: boolean;
249
+ /** Reply latency in ms (default 0 — replies on a microtask). */
250
+ latencyMs?: number;
251
+ }
252
+ type Handler = (payload: unknown) => void;
253
+ declare class SimulatedActivityBridge implements ActivityBridge {
254
+ private readonly _handlers;
255
+ private readonly _host;
256
+ private _seq;
257
+ /** Records every callGame for assertions. */
258
+ readonly calls: {
259
+ protocol: string;
260
+ payload: unknown;
261
+ }[];
262
+ constructor(host?: SimulatedScreenshotHostOptions);
263
+ callGame(protocol: string, payload: unknown): void;
264
+ onSDKMessage(protocol: string, handler: Handler): () => void;
265
+ /** Emit a host → activity message to all current subscribers. */
266
+ emit(protocol: string, payload: unknown): void;
267
+ private _handleCapture;
268
+ }
269
+ //#endregion
270
+ //#region ../shared-client/dist/create-page-api-BxBu-Q5N.d.ts
271
+ type TypedArrayKind = 'i8' | 'ui8' | 'ui8c' | 'i16' | 'ui16' | 'i32' | 'ui32' | 'f32' | 'f64' | 'bi64' | 'bui64';
272
+ //#endregion
273
+ //#region src/serialized-value.d.ts
274
+ /**
275
+ * Tagged union for serialized values.
276
+ *
277
+ * Primitives (boolean, number, string) pass through as-is since they're
278
+ * already JSON-safe. Special types get a discriminated wrapper object.
279
+ *
280
+ * @see Playwright SerializedValue in utilityScriptSerializers.ts
281
+ */
282
+ type SerializedValue = undefined | boolean | number | string | {
283
+ v: 'null' | 'undefined' | 'NaN' | 'Infinity' | '-Infinity' | '-0';
284
+ } | {
285
+ d: string;
286
+ } | {
287
+ u: string;
288
+ } | {
289
+ bi: string;
290
+ } | {
291
+ e: {
292
+ n: string;
293
+ m: string;
294
+ s: string;
295
+ };
296
+ } | {
297
+ r: {
298
+ p: string;
299
+ f: string;
300
+ };
301
+ } | {
302
+ a: SerializedValue[];
303
+ id: number;
304
+ } | {
305
+ o: {
306
+ k: string;
307
+ v: SerializedValue;
308
+ }[];
309
+ id: number;
310
+ } | {
311
+ ref: number;
312
+ } | {
313
+ h: number;
314
+ } | {
315
+ ta: {
316
+ b: string;
317
+ k: TypedArrayKind;
318
+ };
319
+ } | {
320
+ ab: {
321
+ b: string;
322
+ };
323
+ };
324
+ /**
325
+ * Optional transform applied to Error `.stack` strings during deserialization.
326
+ *
327
+ * On the Node.js side, this is used to normalize PixUI engine stack traces
328
+ * to V8-compatible format with source map resolution — the same transform
329
+ * applied to `ConsoleMessage.origin` and `SerializedError.stack`.
330
+ */
331
+ //#endregion
332
+ //#region src/evaluate-args.d.ts
333
+ /**
334
+ * Evaluate-arg payload travelling across the RPC boundary.
335
+ *
336
+ * Ship both fields as ordinary birpc arguments — the `SerializedValue` tree
337
+ * is already JSON-safe, so birpc's own serialiser passes it through
338
+ * symmetrically on both sides.
339
+ */
340
+ interface EvaluateArg {
341
+ /** Tagged-union tree with `{ h: N }` slots standing in for handles. */
342
+ readonly value: SerializedValue;
343
+ /** Ordered handle IDs: `value`'s `{ h: N }` slots index into this array. */
344
+ readonly handles: readonly string[];
345
+ }
346
+ /** An empty payload, for call-sites that pass no argument at all. */
347
+ /**
348
+ * Minimal element reference returned by selector queries.
349
+ *
350
+ * Playwright has `ElementHandle` — a behavior-carrying class with 30+
351
+ * DOM methods (click, fill, getAttribute, boundingBox, etc.). The
352
+ * Locator resolves a selector → ElementHandle, then delegates to the
353
+ * handle's methods. However, Playwright themselves now **discourage**
354
+ * ElementHandle in favor of the Locator-first API.
355
+ *
356
+ * We skip the ElementHandle layer entirely. Our Locator directly calls
357
+ * bridge RPC methods with element ID strings — there is no intermediate
358
+ * behavior-carrying object. This is a deliberate design choice aligned
359
+ * with Playwright's Locator-first direction, not a technical limitation.
360
+ *
361
+ * `ResolvedElement` is a plain DTO carrying the element's ID (from the
362
+ * client-side element map) plus `isVisible` — the one property needed
363
+ * for the Locator's pre-filtering (visibility) and strict mode checks,
364
+ * avoiding an extra RPC round-trip per element during selector resolution.
365
+ *
366
+ * @see Playwright dom.ts ElementHandle — deprecated in favor of Locator
367
+ * @see Playwright frames.ts _callOnElementOnceMatches
368
+ */
369
+ interface ResolvedElement {
370
+ id: string;
371
+ isVisible: boolean;
372
+ }
373
+ /** Actionability states, matching Playwright's ElementState. */
374
+ type ElementState = 'visible' | 'stable' | 'enabled' | 'editable' | 'receivesEvents';
375
+ /**
376
+ * Encoded string-or-regex expectation, mirroring Playwright's
377
+ * `channels.ExpectedTextValue`. Regex instances are never sent over the
378
+ * wire; they are decomposed into `regexSource` + `regexFlags` and
379
+ * reconstructed on the client side.
380
+ *
381
+ * @see Playwright packages/isomorphic/expectUtils.ts serializeExpectedTextValues
382
+ */
383
+ interface ExpectedTextValue {
384
+ string?: string | undefined;
385
+ regexSource?: string | undefined;
386
+ regexFlags?: string | undefined;
387
+ /** Match a substring of the received value instead of the whole value. */
388
+ matchSubstring?: boolean | undefined;
389
+ /** Collapse runs of whitespace before comparing (used by `toHaveText`). */
390
+ normalizeWhiteSpace?: boolean | undefined;
391
+ ignoreCase?: boolean | undefined;
392
+ }
393
+ /**
394
+ * All supported expect expressions. Exactly mirrors the subset of
395
+ * Playwright's `FrameExpectParams.expression` values that the PixUI
396
+ * DOM subset can implement.
397
+ *
398
+ * @see Playwright packages/injected/src/injectedScript.ts expectSingleElement
399
+ */
400
+ type ExpectExpression = 'to.be.attached' | 'to.be.detached' | 'to.be.visible' | 'to.be.hidden' | 'to.be.enabled' | 'to.be.disabled' | 'to.be.editable' | 'to.be.readonly' | 'to.be.empty' | 'to.be.checked' | 'to.be.focused' | 'to.have.attribute' | 'to.have.attribute.value' | 'to.have.class' | 'to.have.count' | 'to.have.css' | 'to.have.id' | 'to.have.property' | 'to.have.text' | 'to.have.value';
401
+ /**
402
+ * Parameters for a single `pageExpect` RPC call.
403
+ *
404
+ * The client runs one assertion tick per call and returns the result;
405
+ * the host-side polling loop (`src/expect-runner.ts`) decides whether
406
+ * to retry.
407
+ *
408
+ * @see Playwright packages/playwright-core/src/client/types.ts FrameExpectParams
409
+ */
410
+ interface ExpectParams {
411
+ expression: ExpectExpression;
412
+ /** Inverted match — mirrors Playwright's `options.isNot`. */
413
+ isNot: boolean;
414
+ /**
415
+ * Extra identifier for the attribute / CSS property / JS property
416
+ * being checked (e.g. `"href"` for `to.have.attribute.value`).
417
+ */
418
+ expressionArg?: string | undefined;
419
+ /** Encoded string/regex expectation(s) — array for text-like matchers. */
420
+ expectedText?: ExpectedTextValue[] | undefined;
421
+ /** Numeric expectation — used by `to.have.count`. */
422
+ expectedNumber?: number | undefined;
423
+ /** Arbitrary JSON-serializable expectation — used by `to.have.property`. */
424
+ expectedValue?: unknown;
425
+ /**
426
+ * Optional nth-index to slice the resolved element list after selector
427
+ * resolution — mirrors `Locator.first()/.last()/.nth(n)`. `null` means
428
+ * strict mode: exactly one element must match (matchers targeting
429
+ * element arrays like `to.have.count` always ignore this).
430
+ */
431
+ nthIndex?: number | null | undefined;
432
+ }
433
+ /**
434
+ * Result of a single `pageExpect` tick.
435
+ *
436
+ * - `matches`: whether the condition held on this tick.
437
+ * - `received`: the actual value observed (e.g. the element's text, a
438
+ * CSS property value, or a count) — used by the host-side matcher for
439
+ * the failure diff.
440
+ * - `log`: human-readable breadcrumbs from the client tick, echoed into
441
+ * the final matcher error.
442
+ * - `errorMessage`: a message for unrecoverable failures (e.g. strict
443
+ * mode violation). When set, the host matcher stops polling immediately.
444
+ * - `missingReceived`: true when the element was not found — so the
445
+ * matcher can distinguish "element gone" from "element present but
446
+ * value mismatched" in the failure message.
447
+ */
448
+ interface ExpectResult {
449
+ matches: boolean;
450
+ received?: unknown;
451
+ log?: string[] | undefined;
452
+ errorMessage?: string | undefined;
453
+ missingReceived?: boolean | undefined;
454
+ }
455
+ /** Functions exposed by __pxemu on the client side (callable via bridge RPC from the host) */
456
+ interface PageFunctions {
457
+ querySelectorCustom(selector: string, testIdAttribute: string): ResolvedElement[];
458
+ querySelectorAll(selector: string): ResolvedElement[];
459
+ querySelector(selector: string): ResolvedElement | null;
460
+ getBoundingRect(elementId: string): {
461
+ x: number;
462
+ y: number;
463
+ width: number;
464
+ height: number;
465
+ } | null;
466
+ isElementVisible(elementId: string): boolean;
467
+ isElementEnabled(elementId: string): boolean;
468
+ isElementEditable(elementId: string): boolean;
469
+ getElementAttribute(elementId: string, name: string): string | null;
470
+ getElementTextContent(elementId: string): string | null;
471
+ getElementInnerHTML(elementId: string): string;
472
+ getElementTag(elementId: string): string | null;
473
+ isElementChecked(elementId: string): boolean;
474
+ focusElement(elementId: string): 'done' | 'error:notconnected';
475
+ blurElement(elementId: string): 'done' | 'error:notconnected';
476
+ getDomTree(): ResolvedElement[];
477
+ configure(config: {
478
+ testIdAttribute?: string;
479
+ }): boolean;
480
+ /**
481
+ * Evaluate a function (or plain expression) in the page context and
482
+ * return its value by JSON-serialization.
483
+ *
484
+ * If the evaluation returns a Promise, it is awaited.
485
+ *
486
+ * @see shared/evaluate-args.ts
487
+ * @see Playwright Frame.evaluateExpression
488
+ */
489
+ evaluate(expression: string, arg: EvaluateArg): unknown;
490
+ /**
491
+ * Evaluate a function against all matching elements and return the
492
+ * result. The function's first argument is an array of the resolved
493
+ * Elements; the extra `arg` follows the same handle-aware serialization
494
+ * protocol as `evaluate`.
495
+ *
496
+ * @see Playwright Frame.$$eval
497
+ */
498
+ evaluateAll(expression: string, elementIds: string[], arg: EvaluateArg): unknown;
499
+ /**
500
+ * Evaluate a function in the page context and return a handle descriptor
501
+ * for the result, matching Playwright's `evaluateHandle`. The `arg`
502
+ * follows the same handle-aware serialization protocol as `evaluate`.
503
+ *
504
+ * Returns `null` when the value is null/undefined — the host wraps it
505
+ * in a local null-handle rather than wasting an entry in the handle map.
506
+ *
507
+ * @see Playwright Frame.evaluateExpressionHandle
508
+ */
509
+ evaluateHandle(expression: string, arg: EvaluateArg): {
510
+ id: string;
511
+ type: string;
512
+ } | null;
513
+ /**
514
+ * Evaluate a function against a single resolved element, matching
515
+ * Playwright's `Frame.evalOnSelector`. The resolved element is passed
516
+ * as the first positional argument to the function; the `arg` payload
517
+ * follows the same handle-aware protocol as `evaluate`.
518
+ *
519
+ * Returns `'error:notconnected'` when the element has detached so
520
+ * `Locator._retryWithSelectorResolution` can re-resolve.
521
+ *
522
+ * @see Playwright Frame.evalOnSelector
523
+ */
524
+ evalOnSelector(elementId: string, expression: string, arg: EvaluateArg): unknown;
525
+ /**
526
+ * Evaluate a function against a single resolved element and return a
527
+ * handle descriptor, matching Playwright's `Frame.evalOnSelectorHandle`.
528
+ *
529
+ * @see Playwright Frame.evalOnSelectorHandle
530
+ */
531
+ evalOnSelectorHandle(elementId: string, expression: string, arg: EvaluateArg): {
532
+ id: string;
533
+ type: string;
534
+ } | null | 'error:notconnected';
535
+ /**
536
+ * Evaluate a function with a handle's target value as its first argument.
537
+ * Returns the result by value. The `arg` payload follows the same
538
+ * handle-aware protocol as `evaluate`.
539
+ *
540
+ * @see Playwright JSHandleChannel.evaluateExpression
541
+ */
542
+ handleEvaluate(handleId: string, expression: string, arg: EvaluateArg): unknown;
543
+ /**
544
+ * Evaluate a function with a handle's target value as its first argument.
545
+ * Returns a new handle descriptor (or `null` for nullish results).
546
+ *
547
+ * @see Playwright JSHandleChannel.evaluateExpressionHandle
548
+ */
549
+ handleEvaluateHandle(handleId: string, expression: string, arg: EvaluateArg): {
550
+ id: string;
551
+ type: string;
552
+ } | null;
553
+ /**
554
+ * Get the JSON-serializable value of a handle.
555
+ *
556
+ * @see Playwright JSHandleChannel.jsonValue
557
+ * @see vitest-playwright-bridge BridgeHandleServerMethods.jsonValue
558
+ */
559
+ handleJsonValue(handleId: string): unknown;
560
+ /**
561
+ * Get a handle to a named property of a handle's value.
562
+ *
563
+ * @see Playwright JSHandleChannel.getProperty
564
+ * @see vitest-playwright-bridge BridgeHandleServerMethods.getProperty
565
+ */
566
+ handleGetProperty(handleId: string, propertyName: string): {
567
+ id: string;
568
+ type: string;
569
+ } | null;
570
+ /**
571
+ * Get handles to all enumerable own properties of a handle's value.
572
+ * Returns an array of {key, id, type} entries.
573
+ *
574
+ * @see Playwright JSHandleChannel.getPropertyList
575
+ * @see vitest-playwright-bridge BridgeHandleServerMethods.getProperties
576
+ */
577
+ handleGetProperties(handleId: string): Array<{
578
+ key: string;
579
+ id: string;
580
+ type: string;
581
+ }>;
582
+ /**
583
+ * Release a handle, removing it from the client-side handle map.
584
+ * The referenced JS value becomes eligible for garbage collection.
585
+ *
586
+ * @see Playwright JSHandleChannel.dispose
587
+ * @see vitest-playwright-bridge BridgeHandleServerMethods.dispose
588
+ */
589
+ handleDispose(handleId: string): void;
590
+ /**
591
+ * Run one tick of a Playwright-style auto-retrying assertion entirely
592
+ * in the page context. The host calls this method repeatedly on a
593
+ * backoff schedule until either the condition is met or the deadline
594
+ * passes — see `src/expect-runner.ts` for the polling loop.
595
+ *
596
+ * Rationale: executing the DOM assertion in the page avoids a round
597
+ * trip per observed value (faster convergence) and gives each matcher
598
+ * access to the full DOM API (`HTMLInputElement.value`,
599
+ * `document.activeElement`, `getComputedStyle`, …) with native
600
+ * TypeScript DOM types at author time — see `client/page-expect.ts`.
601
+ *
602
+ * @see Playwright packages/playwright-core/src/server/frames.ts Frame.expect
603
+ */
604
+ pageExpect(selector: string | null, testIdAttribute: string, params: ExpectParams): ExpectResult;
605
+ /**
606
+ * Check actionability states on an element entirely in the page context.
607
+ *
608
+ * This mirrors Playwright's injectedScript.checkElementStates().
609
+ * Stable uses real requestAnimationFrame. All checks operate on the
610
+ * same element instance, avoiding the race condition of re-resolving
611
+ * elements between RPC round-trips.
612
+ *
613
+ * @returns `{ passed: true }` if all states pass, or `{ missingState }` for
614
+ * the first state that failed.
615
+ */
616
+ checkElementStates(elementId: string, states: ElementState[]): Promise<{
617
+ passed: true;
618
+ } | {
619
+ missingState: ElementState;
620
+ }>;
621
+ /**
622
+ * Scroll the element into the visible area of the viewport if needed.
623
+ *
624
+ * This mirrors Playwright's scroll-into-view step performed between
625
+ * actionability checks and the actual input action.
626
+ *
627
+ * @see https://playwright.dev/docs/api/class-locator#locator-scroll-into-view-if-needed
628
+ */
629
+ scrollIntoViewIfNeeded(elementId: string): 'done' | 'error:notconnected';
630
+ /**
631
+ * Release element references by ID, allowing GC on the client side.
632
+ *
633
+ * This is for the element map (DOM elements resolved by selectors).
634
+ * For arbitrary JS value handles, use `handleDispose()` instead.
635
+ *
636
+ * @see Playwright Runtime.releaseObject (WebKit) / Runtime.disposeObject (Firefox)
637
+ */
638
+ releaseElements(elementIds: string[]): void;
639
+ /**
640
+ * Prune detached elements from the client-side element map and enforce
641
+ * a max-size cap. Returns the number of entries removed.
642
+ *
643
+ * Mirrors Playwright's dispatcher GC-bucket overflow protection
644
+ * (maybeDisposeStaleDispatchers) which caps ElementHandle dispatchers
645
+ * at 100k and evicts the oldest 10% on overflow.
646
+ *
647
+ * Called automatically before each querySelectorCustom on the client,
648
+ * but can also be called explicitly from the host for manual cleanup.
649
+ */
650
+ pruneDetachedElements(): number;
651
+ /**
652
+ * Prepare the page for a deterministic screenshot.
653
+ *
654
+ * Applies temporary visual changes (e.g. hiding carets) and stores
655
+ * a cleanup function so `restoreScreenshot()` can undo them.
656
+ *
657
+ * Ported from Playwright's `Screenshotter._preparePageForScreenshot()`.
658
+ */
659
+ prepareScreenshot(options: {
660
+ hideCaret: boolean;
661
+ }): void;
662
+ /**
663
+ * Undo visual changes applied by `prepareScreenshot()`.
664
+ *
665
+ * Ported from Playwright's `Screenshotter._restorePageAfterScreenshot()`.
666
+ */
667
+ restoreScreenshot(): void;
668
+ /** Append a log entry for navigation replay. */
669
+ clockLog(type: string, time: number, param?: number): void;
670
+ /** Inject fake clock infrastructure without setting time. */
671
+ clockInject(): void;
672
+ /** Install fake clock and set initial time. */
673
+ clockInstall(timeMs: number): void;
674
+ /** Advance clock, firing all due timers. */
675
+ clockRunFor(ticksMs: number): Promise<void>;
676
+ /** Jump forward in time, firing due timers at most once. */
677
+ clockFastForward(ticksMs: number): Promise<void>;
678
+ /** Jump to a specific time and pause. */
679
+ clockPauseAt(timeMs: number): Promise<number>;
680
+ /** Resume real-time progression. */
681
+ clockResume(): void;
682
+ /** Set a fixed time for Date.now() / new Date(). */
683
+ clockSetFixedTime(timeMs: number): void;
684
+ /** Set system time without triggering timers. */
685
+ clockSetSystemTime(timeMs: number): void;
686
+ /** Uninstall fake clock, restoring native globals. */
687
+ clockUninstall(): void;
688
+ }
689
+ /**
690
+ * Shared interface for bridge RPC callers.
691
+ *
692
+ * Both `DevtoolsBridge` (server-side, direct birpc) and `ControlClient`
693
+ * (worker-side, proxied via control channel) implement this interface.
694
+ * Consumers like `JSHandle` and `Locator` depend on this interface
695
+ * instead of a concrete class, so they work in both server and worker
696
+ * contexts.
697
+ *
698
+ * @see DevtoolsBridge.call — server-side implementation
699
+ * @see ControlClient.call — worker-side proxy implementation
700
+ */
701
+ interface BridgeClient {
702
+ /** Whether both devtools + bridge channels are connected. */
703
+ readonly connected: boolean;
704
+ /** Type-safe RPC call to a page function. */
705
+ call<M extends keyof PageFunctions>(method: M, ...args: Parameters<PageFunctions[M]>): Promise<ReturnType<PageFunctions[M]>>;
706
+ }
707
+ /** Functions exposed by the host to the client (callable via birpc from the page) */
708
+ //#endregion
709
+ //#region ../shared-client/dist/index.d.ts
710
+ //#endregion
711
+ //#region src/options.d.ts
712
+ /** Timeout option accepted by most Locator methods. Matches Playwright's TimeoutOptions. */
713
+ interface TimeoutOptions {
714
+ timeout?: number | undefined;
715
+ }
716
+ interface ClickOptions {
717
+ button?: string | undefined;
718
+ clickCount?: number | undefined;
719
+ delay?: number | undefined;
720
+ /** Skip actionability checks. */
721
+ force?: boolean | undefined;
722
+ /** Maximum time in milliseconds. Pass `0` to disable timeout. */
723
+ timeout?: number | undefined;
724
+ /** Click at a specific position relative to the element's top-left corner. */
725
+ position?: {
726
+ x: number;
727
+ y: number;
728
+ } | undefined;
729
+ /** Perform all actionability checks but skip the actual action. */
730
+ trial?: boolean | undefined;
731
+ }
732
+ interface HoverOptions {
733
+ /** Skip actionability checks. */
734
+ force?: boolean | undefined;
735
+ /** Maximum time in milliseconds. Pass `0` to disable timeout. */
736
+ timeout?: number | undefined;
737
+ /** Hover at a specific position relative to the element's top-left corner. */
738
+ position?: {
739
+ x: number;
740
+ y: number;
741
+ } | undefined;
742
+ /** Perform all actionability checks but skip the actual action. */
743
+ trial?: boolean | undefined;
744
+ }
745
+ interface MouseOptions {
746
+ button?: string | undefined;
747
+ isDown?: boolean | undefined;
748
+ }
749
+ interface DragOptions {
750
+ steps?: number | undefined;
751
+ stepDelay?: number | undefined;
752
+ /** Skip actionability checks. */
753
+ force?: boolean | undefined;
754
+ /** Maximum time in milliseconds. */
755
+ timeout?: number | undefined;
756
+ /** Perform all actionability checks but skip the actual action. */
757
+ trial?: boolean | undefined;
758
+ }
759
+ interface TapOptions {
760
+ delay?: number | undefined;
761
+ /** Skip actionability checks. */
762
+ force?: boolean | undefined;
763
+ /** Maximum time in milliseconds. */
764
+ timeout?: number | undefined;
765
+ /** Click at a specific position relative to the element's top-left corner. */
766
+ position?: {
767
+ x: number;
768
+ y: number;
769
+ } | undefined;
770
+ /** Perform all actionability checks but skip the actual action. */
771
+ trial?: boolean | undefined;
772
+ }
773
+ interface SwipeOptions {
774
+ steps?: number | undefined;
775
+ stepDelay?: number | undefined;
776
+ /** Skip actionability checks. */
777
+ force?: boolean | undefined;
778
+ /** Maximum time in milliseconds. */
779
+ timeout?: number | undefined;
780
+ }
781
+ interface LongPressOptions {
782
+ duration?: number | undefined;
783
+ /** Skip actionability checks. */
784
+ force?: boolean | undefined;
785
+ /** Maximum time in milliseconds. */
786
+ timeout?: number | undefined;
787
+ /** Press at a specific position relative to the element's top-left corner. */
788
+ position?: {
789
+ x: number;
790
+ y: number;
791
+ } | undefined;
792
+ }
793
+ interface PressOptions {
794
+ delay?: number | undefined;
795
+ }
796
+ interface TypeOptions {
797
+ delay?: number | undefined;
798
+ }
799
+ interface ScreenshotOptions {
800
+ path?: string | undefined;
801
+ timeout?: number | undefined;
802
+ /**
803
+ * Clip the screenshot to a specific region of the viewport.
804
+ *
805
+ * Coordinates are in CSS pixels relative to the top-left corner of the
806
+ * viewport. Typically obtained from an element's `boundingRect` (via
807
+ * `locator.boundingBox()`).
808
+ */
809
+ clip?: {
810
+ x: number;
811
+ y: number;
812
+ width: number;
813
+ height: number;
814
+ } | undefined;
815
+ /**
816
+ * Whether to hide the text input caret during the screenshot.
817
+ *
818
+ * - `'hide'` (default): set `caret-color: transparent !important` on all
819
+ * `input` and `textarea` elements before capture,
820
+ * then restore original values.
821
+ * - `'initial'`: leave carets as-is.
822
+ */
823
+ caret?: 'hide' | 'initial' | undefined;
824
+ }
825
+ interface FillOptions {
826
+ /** Skip actionability checks. */
827
+ force?: boolean | undefined;
828
+ /** Maximum time in milliseconds. */
829
+ timeout?: number | undefined;
830
+ } //#endregion
831
+ //#region src/progress.d.ts
832
+ /**
833
+ * Progress — Port of Playwright's Progress/ProgressController.
834
+ *
835
+ * Provides centralized timeout management, cooperative cancellation,
836
+ * and structured call logging for all retry loops (selector resolution,
837
+ * action retries, waitFor).
838
+ *
839
+ * Lives in shared-client because the Locator retry loops depend on it and
840
+ * must run unchanged in both the Node (emulator) and QuickJS (inflight)
841
+ * runtimes. It is pure async-control logic — `AbortController`, `setTimeout`,
842
+ * and Promises — with no Node builtins.
843
+ *
844
+ * @see Playwright packages/playwright-core/src/server/progress.ts
845
+ * @see Playwright packages/playwright-core/src/server/callLog.ts
846
+ */
847
+ /**
848
+ * A progress token passed to retry loops and action callbacks.
849
+ *
850
+ * Each method that takes a Progress must result in one of three outcomes:
851
+ * - It finishes successfully, returning a value, before the Progress is aborted.
852
+ * - It throws some error, before the Progress is aborted.
853
+ * - It throws the Progress's aborted error, because the Progress was aborted
854
+ * before the method could finish.
855
+ *
856
+ * @see Playwright Progress interface in packages/protocol/src/progress.d.ts
857
+ */
858
+ //#endregion
859
+ //#region src/evaluate-types.d.ts
860
+ /**
861
+ * Evaluate-family type system (runtime-agnostic, type-only).
862
+ *
863
+ * These types describe the `evaluate` / `evaluateHandle` argument and return
864
+ * shapes shared by the host driver (`Locator`) and the emulator's `JSHandle`.
865
+ * They carry ZERO runtime code, so the shared barrel that re-exports them has
866
+ * no module-load side effects — which is exactly what lets the in-page IIFE
867
+ * and the inflight bundle import from the package root without dragging in the
868
+ * emulator-only `JSHandle` (whose `FinalizationRegistry` the PixUI QuickJS
869
+ * runtime cannot construct).
870
+ *
871
+ * The concrete `JSHandle` class lives in `@pixui-dev/emulator-core` (it is an
872
+ * emulator-only host feature). `JSHandleLike` is the structural surface the
873
+ * shared `Locator.evaluateHandle` returns and that `Unboxed` uses to see
874
+ * through handles passed as `evaluate` arguments.
875
+ *
876
+ * @see Playwright packages/playwright-core/types/structs.d.ts (Unboxed, PageFunctionOn)
877
+ */
878
+ /**
879
+ * Structural surface of a host-side JS handle.
880
+ *
881
+ * The emulator's `JSHandle` satisfies this shape; the shared `Locator` returns
882
+ * it from `evaluateHandle` (constructed via the injected `PageHost.wrapHandle`
883
+ * seam) without importing the concrete class. Deliberately omits
884
+ * `getProperty`/`getProperties` (which return the concrete handle on the
885
+ * emulator) so the interface stays a clean structural supertype of `JSHandle`
886
+ * — avoiding `Map` invariance pitfalls — while still typing the members
887
+ * callers actually use on a locator-derived handle.
888
+ *
889
+ * @see Playwright JSHandle (client-side)
890
+ */
891
+ interface JSHandleLike<T = unknown> {
892
+ /** Brand used by {@link Unboxed} to recognise handles in argument positions. */
893
+ readonly __brand: '@pixui-dev/emulator JSHandle';
894
+ /** JS `typeof` the referenced value (for debugging/preview). */
895
+ readonly type: string;
896
+ /** Whether this handle has been disposed. */
897
+ readonly disposed: boolean;
898
+ /** Evaluate a function with this handle's value as the first argument. */
899
+ evaluate<R, Arg, O extends T = T>(pageFunction: PageFunctionOn<O, Arg, R>, arg: Arg): Promise<R>;
900
+ evaluate<R, O extends T = T>(pageFunction: PageFunctionOn<O, void, R>, arg?: unknown): Promise<R>;
901
+ /** Evaluate a function with this handle's value, returning a new handle. */
902
+ evaluateHandle<R, Arg, O extends T = T>(pageFunction: PageFunctionOn<O, Arg, R>, arg: Arg): Promise<JSHandleLike<R>>;
903
+ evaluateHandle<R, O extends T = T>(pageFunction: PageFunctionOn<O, void, R>, arg?: unknown): Promise<JSHandleLike<R>>;
904
+ /** Get the JSON-serializable value of this handle. */
905
+ jsonValue(): Promise<T>;
906
+ /** Explicitly release this handle. */
907
+ dispose(): Promise<void>;
908
+ }
909
+ /**
910
+ * Recursively unwrap `JSHandleLike<T>` → `T` in type positions.
911
+ *
912
+ * This is the core of the Box/Unbox type system, letting
913
+ * `handle.evaluate((el, arg) => ...)` infer the in-page types for `el`/`arg`:
914
+ * - `JSHandleLike<Element>` → `Element`
915
+ * - `{ foo: JSHandleLike<string> }` → `{ foo: string }`
916
+ * - `[JSHandleLike<number>, string]` → `[number, string]`
917
+ * - Plain types pass through unchanged
918
+ *
919
+ * Simplified from Playwright's `Unboxed` (no ElementHandle, no 4-tuple cases) —
920
+ * we only have one handle kind.
921
+ *
922
+ * @see Playwright structs.d.ts Unboxed
923
+ */
924
+ type Unboxed<Arg> = Arg extends JSHandleLike<infer T> ? T : Arg extends [infer A0, ...infer Rest] ? [Unboxed<A0>, ...{ [K in keyof Rest]: Unboxed<Rest[K]> }] : Arg extends Array<infer T> ? Array<Unboxed<T>> : Arg extends object ? { [Key in keyof Arg]: Unboxed<Arg[Key]> } : Arg;
925
+ /**
926
+ * Function type for `evaluate` / `evaluateHandle` on a handle or element.
927
+ *
928
+ * `On` is the type of the target value (first argument). `Arg` is the extra
929
+ * argument (second argument), unwrapped via {@link Unboxed}. `R` is the return
930
+ * type. Accepts either a string expression or a function.
931
+ *
932
+ * @see Playwright structs.d.ts PageFunctionOn
933
+ */
934
+ type PageFunctionOn<On, Arg, R> = string | ((on: On, arg: Unboxed<Arg>) => R | Promise<R>);
935
+ /**
936
+ * Function type for page-level `evaluate` (no "on" target).
937
+ *
938
+ * @see Playwright structs.d.ts PageFunction
939
+ */
940
+ //#endregion
941
+ //#region src/input-backend.d.ts
942
+ interface InputBackend {
943
+ click(x: number, y: number, options?: ClickOptions): Promise<void>;
944
+ move(x: number, y: number, options?: MouseOptions): Promise<void>;
945
+ down(x: number, y: number, options?: MouseOptions): Promise<void>;
946
+ up(x: number, y: number, options?: MouseOptions): Promise<void>;
947
+ wheel(x: number, y: number, deltaY: number, deltaX: number): Promise<void>;
948
+ tap(x: number, y: number, options?: TapOptions): Promise<void>;
949
+ swipe(fromX: number, fromY: number, toX: number, toY: number, options?: SwipeOptions): Promise<void>;
950
+ longPress(x: number, y: number, options?: LongPressOptions): Promise<void>;
951
+ press(key: string, options?: PressOptions): Promise<void>;
952
+ keyDown(key: string): Promise<void>;
953
+ keyUp(key: string): Promise<void>;
954
+ typeText(text: string, options?: TypeOptions): Promise<void>;
955
+ } //#endregion
956
+ //#region src/input.d.ts
957
+ /**
958
+ * Context object passed to input classes, providing the atomic input
959
+ * backend plus the two page-level hooks the devices need (closed-state
960
+ * assertion and post-action frame settling).
961
+ */
962
+ interface InputContext {
963
+ backend: InputBackend;
964
+ assertNotClosed(): void;
965
+ waitForFrame(): Promise<unknown>;
966
+ }
967
+ declare class Mouse {
968
+ /** @internal */
969
+ readonly _ctx: InputContext;
970
+ constructor(ctx: InputContext);
971
+ click(x: number, y: number, options?: ClickOptions): Promise<void>;
972
+ dblclick(x: number, y: number, options?: ClickOptions): Promise<void>;
973
+ move(x: number, y: number, options?: MouseOptions): Promise<void>;
974
+ down(x: number, y: number, options?: MouseOptions): Promise<void>;
975
+ up(x: number, y: number, options?: MouseOptions): Promise<void>;
976
+ wheel(x: number, y: number, deltaY: number, deltaX?: number): Promise<void>;
977
+ }
978
+ declare class Touchscreen {
979
+ /** @internal */
980
+ readonly _ctx: InputContext;
981
+ constructor(ctx: InputContext);
982
+ tap(x: number, y: number, options?: TapOptions): Promise<void>;
983
+ /** PixUI extension: swipe gesture. */
984
+ swipe(fromX: number, fromY: number, toX: number, toY: number, options?: SwipeOptions): Promise<void>;
985
+ /** PixUI extension: long press gesture. */
986
+ longPress(x: number, y: number, options?: LongPressOptions): Promise<void>;
987
+ }
988
+ declare class Keyboard {
989
+ /** @internal */
990
+ readonly _ctx: InputContext;
991
+ constructor(ctx: InputContext);
992
+ press(key: string, options?: PressOptions): Promise<void>;
993
+ down(key: string): Promise<void>;
994
+ up(key: string): Promise<void>;
995
+ type(text: string, options?: TypeOptions): Promise<void>;
996
+ insertText(text: string): Promise<void>;
997
+ } //#endregion
998
+ //#region src/page-host.d.ts
999
+ interface PageHost {
1000
+ /** Bridge for DOM introspection RPCs, or `null` when not connected. */
1001
+ readonly devtoolsBridge: BridgeClient | null;
1002
+ /** The configured test ID attribute name (e.g. `data-testid`). */
1003
+ readonly testIdAttribute: string;
1004
+ /** Mouse input device. */
1005
+ readonly mouse: Mouse;
1006
+ /** Touchscreen input device. */
1007
+ readonly touchscreen: Touchscreen;
1008
+ /** Keyboard input device. */
1009
+ readonly keyboard: Keyboard;
1010
+ /** Whether the page has been closed via `window.close()`. */
1011
+ isClosed(): boolean;
1012
+ /** Whether the page has been disposed. */
1013
+ isDisposed(): boolean;
1014
+ /** Sleep helper used by the action retry loops. */
1015
+ waitForTimeout(ms: number): Promise<void>;
1016
+ /**
1017
+ * Capture a screenshot of the current frame. Returns the encoded PNG
1018
+ * bytes. (The emulator returns a Node `Buffer`, which is a `Uint8Array`;
1019
+ * the inflight backend returns the bytes it read back from the host.)
1020
+ */
1021
+ screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
1022
+ /**
1023
+ * Subscribe to the page `close` event (window.close()). Returns an
1024
+ * unsubscribe function. Used by Locator to fail fast on close instead of
1025
+ * waiting out the full timeout — without coupling Locator to a concrete
1026
+ * EventEmitter.
1027
+ */
1028
+ onClose(handler: () => void): () => void;
1029
+ /**
1030
+ * Subscribe to the page `disposed` event. Returns an unsubscribe function.
1031
+ */
1032
+ onDisposed(handler: () => void): () => void;
1033
+ /**
1034
+ * Wrap an `evalOnSelectorHandle` RPC result into a host-side JS handle.
1035
+ *
1036
+ * Optional seam: JS handles are an emulator-only feature (the concrete
1037
+ * `JSHandle` class with its `FinalizationRegistry` lives in
1038
+ * `@pixui-dev/emulator-core`, not in this runtime-agnostic layer). The
1039
+ * emulator's `SimulatorPage` implements this; backends without handle
1040
+ * support — notably inflight-test, which runs inside QuickJS and has no
1041
+ * `eval` — omit it, so `Locator.evaluateHandle` throws a clear error there.
1042
+ *
1043
+ * @param result The handle descriptor from the page, or `null` for a
1044
+ * null/undefined result (wrapped as a host-side null-handle).
1045
+ */
1046
+ wrapHandle?(result: {
1047
+ id: string;
1048
+ type: string;
1049
+ } | null): JSHandleLike<unknown>;
1050
+ } //#endregion
1051
+ //#region src/locator.d.ts
1052
+ /** Options for text-based locator queries. */
1053
+ /** Filter options for narrowing locator matches */
1054
+ interface LocatorFilterOptions {
1055
+ /** Filter by text content */
1056
+ hasText?: string | RegExp | undefined;
1057
+ /** Filter by NOT having text content */
1058
+ hasNotText?: string | RegExp | undefined;
1059
+ }
1060
+ interface SwipeTarget {
1061
+ x: number;
1062
+ y: number;
1063
+ }
1064
+ interface WaitForOptions {
1065
+ /** Timeout in milliseconds (default: 30000) */
1066
+ timeout?: number | undefined;
1067
+ /** Wait for element to reach this state (default: 'visible') */
1068
+ state?: 'attached' | 'detached' | 'visible' | 'hidden' | undefined;
1069
+ }
1070
+ /**
1071
+ * Defines how a locator resolves its target elements.
1072
+ * The selector is a custom selector string resolved by the bridge client.
1073
+ */
1074
+ type LocatorSource = {
1075
+ kind: 'selector';
1076
+ selector: string;
1077
+ };
1078
+ /**
1079
+ * A Locator represents a way to find one or more elements on the PixUI page.
1080
+ *
1081
+ * Locators are the core primitive for interacting with the page. They are:
1082
+ * - **Lazy**: Elements are resolved at interaction time.
1083
+ * - **Auto-waiting**: Actions automatically wait for elements to appear.
1084
+ * - **Auto-retrying**: Assertions retry until timeout.
1085
+ * - **Strict**: Actions throw if the locator matches more than one element
1086
+ * (configurable via .first(), .last(), .nth()).
1087
+ */
1088
+ declare class Locator {
1089
+ private _page;
1090
+ private _source;
1091
+ private _nthIndex;
1092
+ private _offsetX;
1093
+ private _offsetY;
1094
+ /** Timeout for auto-waiting (ms) */
1095
+ private _timeout;
1096
+ constructor(page: PageHost, source: LocatorSource);
1097
+ /**
1098
+ * The raw selector string.
1099
+ */
1100
+ get selector(): string | null;
1101
+ /**
1102
+ * Create a locator from a CSS selector string.
1103
+ */
1104
+ static fromSelector(page: PageHost, selector: string): Locator;
1105
+ /**
1106
+ * Create a locator by text content.
1107
+ */
1108
+ static fromText(page: PageHost, text: string | RegExp, options?: {
1109
+ exact?: boolean;
1110
+ }): Locator;
1111
+ /**
1112
+ * Create a locator by alt text.
1113
+ */
1114
+ static fromAltText(page: PageHost, text: string | RegExp, options?: {
1115
+ exact?: boolean;
1116
+ }): Locator;
1117
+ /**
1118
+ * Create a locator by label text.
1119
+ */
1120
+ static fromLabelText(page: PageHost, text: string | RegExp, options?: {
1121
+ exact?: boolean;
1122
+ }): Locator;
1123
+ /**
1124
+ * Create a locator by placeholder.
1125
+ */
1126
+ static fromPlaceholder(page: PageHost, text: string | RegExp, options?: {
1127
+ exact?: boolean;
1128
+ }): Locator;
1129
+ /**
1130
+ * Create a locator by title attribute.
1131
+ */
1132
+ static fromTitle(page: PageHost, text: string | RegExp, options?: {
1133
+ exact?: boolean;
1134
+ }): Locator;
1135
+ /**
1136
+ * Create a locator by data-testid attribute.
1137
+ */
1138
+ static fromTestId(page: PageHost, testId: string | RegExp): Locator;
1139
+ /**
1140
+ * Human-readable description of this locator (for error messages).
1141
+ */
1142
+ private get _description();
1143
+ /**
1144
+ * Raw selector query — no retry, no waiting.
1145
+ *
1146
+ * Returns all matching elements, or null if the bridge is not available.
1147
+ * This is the low-level building block used by _retryWithSelectorResolution.
1148
+ *
1149
+ * @see Playwright frames.ts: resolved.injected.evaluateHandle(injected.querySelectorAll)
1150
+ */
1151
+ private _resolveSelector;
1152
+ /**
1153
+ * Run a Playwright-style auto-retrying assertion against this locator.
1154
+ *
1155
+ * The host side is a thin polling loop: it fires `pageExpect` RPCs on
1156
+ * exponential intervals (`[100, 250, 500, 1000]`) until either the
1157
+ * condition holds (`matches !== isNot`) or the deadline passes.
1158
+ * Each tick performs the full selector resolution + DOM check inside
1159
+ * the page, so re-renders between ticks are observed naturally.
1160
+ *
1161
+ * This method is internal — matchers in the vitest plugin call it via
1162
+ * the public barrel export. Not for end-user consumption.
1163
+ *
1164
+ * @see Playwright server/frames.ts Frame.expect — the same two-phase
1165
+ * (one-shot + retry-with-backoff) loop.
1166
+ * @internal
1167
+ */
1168
+ _expect(params: Omit<ExpectParams, 'nthIndex'>, timeout: number): Promise<ExpectResult>;
1169
+ /**
1170
+ * Pick a single element from the resolved list, applying nth/strict mode.
1171
+ *
1172
+ * Returns the element, or null if no match (caller should retry),
1173
+ * or throws on strict mode violation (non-recoverable).
1174
+ *
1175
+ * @see Playwright frames.ts _retryWithProgressIfNotConnected: strict mode check
1176
+ */
1177
+ private _pickElement;
1178
+ /**
1179
+ * Run a ProgressController task with page close/dispose detection.
1180
+ *
1181
+ * Listens for the page's 'close' and 'disposed' events and aborts the
1182
+ * controller immediately, so pending locator operations fail fast with
1183
+ * a descriptive error instead of waiting for the full timeout.
1184
+ */
1185
+ private _runWithCloseDetection;
1186
+ /**
1187
+ * Outermost retry loop — resolves the selector and passes the element
1188
+ * to an action callback. Re-resolves on 'error:notconnected'.
1189
+ *
1190
+ * This is our equivalent of Playwright's Frame._retryWithProgressIfNotConnected.
1191
+ *
1192
+ * The retry loop uses progressive backoff: [0, 20, 100, 100, 500]ms,
1193
+ * matching Playwright's retryWithProgressAndTimeouts.
1194
+ *
1195
+ * @param action - Callback receiving the resolved element. Must return
1196
+ * 'error:notconnected' to trigger re-resolution, or any
1197
+ * other value as the final result.
1198
+ * @param options - timeout, force (skip visibility pre-filter)
1199
+ * @returns The action's return value (excluding 'error:notconnected')
1200
+ *
1201
+ * @see Playwright frames.ts _retryWithProgressIfNotConnected
1202
+ * @see Playwright frames.ts retryWithProgressAndTimeouts
1203
+ */
1204
+ private _retryWithSelectorResolution;
1205
+ /**
1206
+ * Generic retry wrapper for actions, matching Playwright's `_retryAction`.
1207
+ *
1208
+ * Retries the action callback when it returns a recoverable error code.
1209
+ * Uses progressive backoff: [0, 20, 100, 100, 500]ms between retries.
1210
+ *
1211
+ * Returns 'error:notconnected' to the caller so the outer loop
1212
+ * (_retryWithSelectorResolution) can re-resolve the selector.
1213
+ *
1214
+ * @see Playwright dom.ts ElementHandle._retryAction
1215
+ */
1216
+ private _retryAction;
1217
+ /**
1218
+ * Retry wrapper for pointer actions, matching Playwright's `_retryPointerAction`.
1219
+ *
1220
+ * Wraps `_retryAction` and adds pointer-specific retry logic:
1221
+ * - Cycles through different scroll alignments on each retry to handle
1222
+ * position:sticky elements that overlay the target.
1223
+ *
1224
+ * Returns 'error:notconnected' to bubble up to _retryWithSelectorResolution.
1225
+ *
1226
+ * @see Playwright dom.ts ElementHandle._retryPointerAction
1227
+ */
1228
+ private _retryPointerAction;
1229
+ /**
1230
+ * Perform a single pointer action attempt. Returns error codes instead
1231
+ * of throwing, letting the retry layers decide.
1232
+ *
1233
+ * Follows Playwright's exact sequence:
1234
+ * 1. Check element states (visible, stable, enabled) — unless force
1235
+ * 2. Scroll into view if needed
1236
+ * 3. Compute action point via _clickablePoint() or _offsetPoint()
1237
+ * 4. Hit target check — PixUI placeholder (always passes)
1238
+ * 5. Perform action — unless trial
1239
+ *
1240
+ * Note: Element resolution is NOT done here — it's done by
1241
+ * _retryWithSelectorResolution, which passes the element ID.
1242
+ *
1243
+ * @see Playwright dom.ts ElementHandle._performPointerAction
1244
+ */
1245
+ private _performPointerAction;
1246
+ /**
1247
+ * Compute the clickable point (center) of an element.
1248
+ * @see Playwright dom.ts ElementHandle._clickablePoint
1249
+ */
1250
+ private _clickablePoint;
1251
+ /**
1252
+ * Compute a point at a specific offset from the element's top-left corner.
1253
+ *
1254
+ * Note: Playwright computes offset relative to the padding box (adds
1255
+ * border width). PixUI uses border-box for all elements, so we compute
1256
+ * relative to the bounding box directly.
1257
+ *
1258
+ * @see Playwright dom.ts ElementHandle._offsetPoint
1259
+ */
1260
+ private _offsetPoint;
1261
+ /**
1262
+ * Fetch a fresh bounding rect for an element from the client side.
1263
+ * @see Playwright dom.ts ElementHandle.boundingBox / getContentQuads
1264
+ */
1265
+ private _getBoundingRect;
1266
+ /**
1267
+ * Scroll the element (or a sub-rect of it) into the visible viewport area.
1268
+ * @see Playwright dom.ts ElementHandle._scrollRectIntoViewIfNeeded
1269
+ */
1270
+ private _scrollRectIntoViewIfNeeded;
1271
+ /**
1272
+ * Resolve the click-target position for this locator.
1273
+ * Public API for getting the element's action point.
1274
+ *
1275
+ * @see Playwright dom.ts _clickablePoint / _offsetPoint
1276
+ */
1277
+ position(relativePosition?: {
1278
+ x: number;
1279
+ y: number;
1280
+ }, options?: TimeoutOptions): Promise<{
1281
+ x: number;
1282
+ y: number;
1283
+ }>;
1284
+ first(): Locator;
1285
+ last(): Locator;
1286
+ nth(index: number): Locator;
1287
+ and(locator: Locator): Locator;
1288
+ or(locator: Locator): Locator;
1289
+ filter(options: LocatorFilterOptions): Locator;
1290
+ locator(selector: string): Locator;
1291
+ getByText(text: string | RegExp, options?: {
1292
+ exact?: boolean;
1293
+ }): Locator;
1294
+ getByAltText(text: string | RegExp, options?: {
1295
+ exact?: boolean;
1296
+ }): Locator;
1297
+ getByLabel(text: string | RegExp, options?: {
1298
+ exact?: boolean;
1299
+ }): Locator;
1300
+ getByPlaceholder(text: string | RegExp, options?: {
1301
+ exact?: boolean;
1302
+ }): Locator;
1303
+ getByTitle(text: string | RegExp, options?: {
1304
+ exact?: boolean;
1305
+ }): Locator;
1306
+ getByTestId(testId: string | RegExp): Locator;
1307
+ offset(dx: number, dy: number): Locator;
1308
+ /**
1309
+ * Click on this locator's element.
1310
+ *
1311
+ * Call chain (matching Playwright):
1312
+ * Frame._retryWithProgressIfNotConnected(selector, handle => handle._click())
1313
+ * → ElementHandle._click → _retryPointerAction → _retryAction → _performPointerAction
1314
+ *
1315
+ * Our equivalent:
1316
+ * _retryWithSelectorResolution(element =>
1317
+ * _retryPointerAction(element.id, ...) → _retryAction → _performPointerAction)
1318
+ *
1319
+ * @see Playwright frames.ts Frame.click
1320
+ * @see Playwright dom.ts ElementHandle._click
1321
+ */
1322
+ click(options?: ClickOptions): Promise<void>;
1323
+ /**
1324
+ * Double-click on this locator's element.
1325
+ * @see Playwright frames.ts Frame.dblclick
1326
+ * @see Playwright dom.ts ElementHandle._dblclick
1327
+ */
1328
+ dblclick(options?: ClickOptions): Promise<void>;
1329
+ /**
1330
+ * Hover over this locator's element (move mouse to element center).
1331
+ *
1332
+ * @see Playwright dom.ts ElementHandle._hover
1333
+ */
1334
+ hover(options?: HoverOptions): Promise<void>;
1335
+ /**
1336
+ * Scroll the mouse wheel at this locator's element position.
1337
+ */
1338
+ wheel(deltaY: number, deltaX?: number): Promise<void>;
1339
+ /**
1340
+ * Drag from this locator to a target position or locator.
1341
+ * @see Playwright frames.ts Frame.dragAndDrop
1342
+ */
1343
+ dragTo(target: SwipeTarget | Locator, options?: DragOptions): Promise<void>;
1344
+ /**
1345
+ * Tap on this locator's element.
1346
+ * @see Playwright frames.ts Frame.tap
1347
+ * @see Playwright dom.ts ElementHandle._tap
1348
+ */
1349
+ tap(options?: TapOptions): Promise<void>;
1350
+ /**
1351
+ * Swipe from this locator to a target position or locator.
1352
+ * (PixUI extension — not in Playwright; follows dragTo's pattern.)
1353
+ */
1354
+ swipeTo(target: SwipeTarget | Locator, options?: SwipeOptions): Promise<void>;
1355
+ /**
1356
+ * Long press on this locator's element.
1357
+ * (PixUI extension — not in Playwright; follows click's pattern.)
1358
+ */
1359
+ longPress(options?: LongPressOptions): Promise<void>;
1360
+ /**
1361
+ * Click this locator's element, then type text.
1362
+ */
1363
+ type(text: string, options?: TypeOptions): Promise<void>;
1364
+ /**
1365
+ * Click, select all, then insert text (or delete if empty).
1366
+ *
1367
+ * Playwright's fill uses DOM selection APIs (input.select(), Range) to
1368
+ * select existing content, then keyboard.insertText() to replace it.
1369
+ * PixUI lacks DOM selection APIs, so we use Control+A as a fallback.
1370
+ *
1371
+ * @see Playwright dom.ts ElementHandle._fill
1372
+ */
1373
+ fill(text: string, options?: FillOptions): Promise<void>;
1374
+ /**
1375
+ * Click this locator's element, then press a key or key combo.
1376
+ */
1377
+ press(key: string, options?: PressOptions & TimeoutOptions): Promise<void>;
1378
+ /**
1379
+ * Type characters one by one into the element.
1380
+ * Alias for `type()`, matching Playwright's naming.
1381
+ *
1382
+ * @see Playwright Locator.pressSequentially
1383
+ */
1384
+ pressSequentially(text: string, options?: TypeOptions): Promise<void>;
1385
+ /**
1386
+ * Clear the input field.
1387
+ *
1388
+ * @see Playwright Locator.clear
1389
+ */
1390
+ clear(options?: FillOptions): Promise<void>;
1391
+ /**
1392
+ * Focus the element.
1393
+ *
1394
+ * @see Playwright Locator.focus → Frame.focus → ElementHandle._focus
1395
+ */
1396
+ focus(options?: TimeoutOptions): Promise<void>;
1397
+ /**
1398
+ * Remove focus from the element.
1399
+ *
1400
+ * @see Playwright Locator.blur → Frame.blur → ElementHandle._blur
1401
+ */
1402
+ blur(options?: TimeoutOptions): Promise<void>;
1403
+ /**
1404
+ * Returns the number of elements matching this locator.
1405
+ */
1406
+ count(): Promise<number>;
1407
+ /**
1408
+ * Returns all matching elements' serialized data.
1409
+ */
1410
+ all(): Promise<ResolvedElement[]>;
1411
+ /**
1412
+ * Returns an array of all matching elements' `innerText` values.
1413
+ *
1414
+ * @see Playwright Locator.allInnerTexts → $$eval(ee => ee.map(e => e.innerText))
1415
+ */
1416
+ allInnerTexts(): Promise<string[]>;
1417
+ /**
1418
+ * Returns an array of all matching elements' `textContent` values.
1419
+ *
1420
+ * @see Playwright Locator.allTextContents → $$eval(ee => ee.map(e => e.textContent || ''))
1421
+ */
1422
+ allTextContents(): Promise<string[]>;
1423
+ /**
1424
+ * Check if this locator matches any visible element.
1425
+ */
1426
+ isVisible(options?: TimeoutOptions): Promise<boolean>;
1427
+ /**
1428
+ * Check if this locator's element is hidden.
1429
+ */
1430
+ isHidden(options?: TimeoutOptions): Promise<boolean>;
1431
+ /**
1432
+ * Check if this locator's element is enabled.
1433
+ *
1434
+ * @see Playwright frames.ts Frame.isEnabled → _callOnElementOnceMatches
1435
+ */
1436
+ isEnabled(options?: TimeoutOptions): Promise<boolean>;
1437
+ /**
1438
+ * Check if this locator's element is disabled.
1439
+ */
1440
+ isDisabled(options?: TimeoutOptions): Promise<boolean>;
1441
+ /**
1442
+ * Check if this locator's element is editable.
1443
+ */
1444
+ isEditable(options?: TimeoutOptions): Promise<boolean>;
1445
+ /**
1446
+ * Check if this locator's element is checked (for checkboxes/radios).
1447
+ */
1448
+ isChecked(options?: TimeoutOptions): Promise<boolean>;
1449
+ /**
1450
+ * Get the text content of this locator's element.
1451
+ *
1452
+ * @see Playwright frames.ts Frame.textContent → _callOnElementOnceMatches
1453
+ */
1454
+ textContent(options?: TimeoutOptions): Promise<string | null>;
1455
+ /**
1456
+ * Get the inner text of this locator's element.
1457
+ */
1458
+ innerText(options?: TimeoutOptions): Promise<string>;
1459
+ /**
1460
+ * Get the inner HTML of this locator's element.
1461
+ *
1462
+ * @see Playwright frames.ts Frame.innerHTML → _callOnElementOnceMatches
1463
+ */
1464
+ innerHTML(options?: TimeoutOptions): Promise<string>;
1465
+ /**
1466
+ * Get an attribute value from this locator's element.
1467
+ *
1468
+ * @see Playwright frames.ts Frame.getAttribute → _callOnElementOnceMatches
1469
+ */
1470
+ getAttribute(name: string, options?: TimeoutOptions): Promise<string | null>;
1471
+ /**
1472
+ * Returns the bounding box of the element, or `null` if the element is not visible.
1473
+ */
1474
+ boundingBox(options?: TimeoutOptions): Promise<{
1475
+ x: number;
1476
+ y: number;
1477
+ width: number;
1478
+ height: number;
1479
+ } | null>;
1480
+ /**
1481
+ * Wait for this locator's element to reach a certain state.
1482
+ *
1483
+ * Matches Playwright's Frame.waitForSelector which uses
1484
+ * retryWithProgressAndTimeouts with the same backoff pattern.
1485
+ *
1486
+ * @see Playwright frames.ts Frame.waitForSelector
1487
+ */
1488
+ waitFor(options?: WaitForOptions): Promise<void>;
1489
+ /**
1490
+ * Scroll the element into the visible viewport area if needed.
1491
+ *
1492
+ * Uses _retryWithSelectorResolution → _retryAction, matching Playwright's
1493
+ * ElementHandle._waitAndScrollIntoViewIfNeeded → _retryAction.
1494
+ *
1495
+ * @see Playwright dom.ts ElementHandle.scrollIntoViewIfNeeded → _waitAndScrollIntoViewIfNeeded
1496
+ */
1497
+ scrollIntoViewIfNeeded(options?: TimeoutOptions): Promise<void>;
1498
+ /**
1499
+ * Take a screenshot clipped to this element's bounding box.
1500
+ *
1501
+ * Uses _retryWithSelectorResolution → _retryAction, matching Playwright's
1502
+ * Frame.rafrafTimeoutScreenshotElementWithProgress → _retryWithProgressIfNotConnected.
1503
+ *
1504
+ * @see Playwright frames.ts Frame.rafrafTimeoutScreenshotElementWithProgress
1505
+ * @see Playwright dom.ts ElementHandle.screenshot
1506
+ */
1507
+ screenshot(options?: Omit<ScreenshotOptions, 'clip'>): Promise<Uint8Array>;
1508
+ /**
1509
+ * Evaluate a function in the page context with this element as the
1510
+ * first argument.
1511
+ *
1512
+ * The expression is sent to the client-side bridge as a string and
1513
+ * parsed there (matching Playwright's `normalizeEvaluationExpression`
1514
+ * + vitest-playwright-bridge's `parseExpression` pattern). The resolved
1515
+ * element is passed as the function's argument.
1516
+ *
1517
+ * Usage:
1518
+ * // Arrow function — element is the first arg
1519
+ * const text = await locator.evaluate<string>('(el) => el.textContent');
1520
+ *
1521
+ * // With extra arg — [element, arg] is passed
1522
+ * const attr = await locator.evaluate<string>(
1523
+ * '([el, name]) => el.getAttribute(name)',
1524
+ * 'data-value',
1525
+ * );
1526
+ *
1527
+ * @see Playwright Locator.evaluate → Frame.evalOnSelector
1528
+ * @see vitest-playwright-bridge HostHandle.evaluate
1529
+ */
1530
+ evaluate<R, Arg, E extends HTMLElement = HTMLElement>(expression: PageFunctionOn<E, Arg, R>, arg: Arg): Promise<R>;
1531
+ evaluate<R, E extends HTMLElement = HTMLElement>(expression: PageFunctionOn<E, void, R>, arg?: unknown): Promise<R>;
1532
+ /**
1533
+ * Evaluate a function against all matching elements.
1534
+ *
1535
+ * The function receives an array of all matching HTMLElements as its
1536
+ * first argument, and the optional `arg` as its second argument.
1537
+ *
1538
+ * @see Playwright Locator.evaluateAll → Frame.$$eval
1539
+ */
1540
+ evaluateAll<R, Arg, E extends HTMLElement = HTMLElement>(expression: PageFunctionOn<E[], Arg, R>, arg: Arg): Promise<R>;
1541
+ evaluateAll<R, E extends HTMLElement = HTMLElement>(expression: PageFunctionOn<E[], void, R>, arg?: unknown): Promise<R>;
1542
+ /**
1543
+ * Evaluate a function in the page context and return a handle to the result
1544
+ * instead of the serialized value.
1545
+ *
1546
+ * The handle can be used in subsequent `handle.evaluate()` calls or released
1547
+ * via `handle.dispose()`. This is useful for non-serializable values (DOM
1548
+ * elements, functions, etc.).
1549
+ *
1550
+ * JS handles are an emulator-only host feature: the concrete `JSHandle`
1551
+ * class (with `FinalizationRegistry` auto-dispose) lives in
1552
+ * `@pixui-dev/emulator-core`, not in this runtime-agnostic layer. The page
1553
+ * backend supplies it through {@link PageHost.wrapHandle}; backends that do
1554
+ * not support handles (e.g. inflight-test, which runs inside QuickJS and has
1555
+ * no `eval`) simply omit `wrapHandle`, and this method throws.
1556
+ *
1557
+ * @see Playwright Locator.evaluateHandle → Frame.evalOnSelectorHandle
1558
+ */
1559
+ evaluateHandle<R, Arg, E extends HTMLElement = HTMLElement>(expression: PageFunctionOn<E, Arg, R>, arg: Arg): Promise<JSHandleLike<R>>;
1560
+ evaluateHandle<R, E extends HTMLElement = HTMLElement>(expression: PageFunctionOn<E, void, R>, arg?: unknown): Promise<JSHandleLike<R>>;
1561
+ private _clone;
1562
+ setTimeout(timeout: number): Locator;
1563
+ toString(): string;
1564
+ } //#endregion
1565
+ //#region src/local-bridge.d.ts
1566
+ //#endregion
1567
+ //#region src/page/inflight-page.d.ts
1568
+ interface InflightPageOptions {
1569
+ /** Test-id attribute for `getByTestId`. Default `data-testid`. */
1570
+ testIdAttribute?: string;
1571
+ /** Activity ⇄ host bridge — required for `page.screenshot`. */
1572
+ activityBridge?: ActivityBridge;
1573
+ /** Filesystem writer — required for `page.screenshot`. */
1574
+ io?: ReportIo;
1575
+ /** Run directory screenshots are written under (`<run-dir>/screenshots/`). */
1576
+ reportRunDir?: string;
1577
+ /** Override the page API (default: `createPageApi()` over the live DOM). */
1578
+ api?: PageFunctions;
1579
+ /** Override the input backend (default: {@link DomInputBackend}). */
1580
+ input?: InputBackend;
1581
+ }
1582
+ declare class InflightPage implements PageHost {
1583
+ readonly devtoolsBridge: BridgeClient;
1584
+ readonly mouse: Mouse;
1585
+ readonly keyboard: Keyboard;
1586
+ readonly touchscreen: Touchscreen;
1587
+ readonly testIdAttribute: string;
1588
+ private _closed;
1589
+ private _disposed;
1590
+ private readonly _closeHandlers;
1591
+ private readonly _disposedHandlers;
1592
+ private readonly _activityBridge;
1593
+ private readonly _io;
1594
+ private readonly _reportRunDir;
1595
+ constructor(options?: InflightPageOptions);
1596
+ isClosed(): boolean;
1597
+ isDisposed(): boolean;
1598
+ waitForTimeout(ms: number): Promise<void>;
1599
+ onClose(handler: () => void): () => void;
1600
+ onDisposed(handler: () => void): () => void;
1601
+ screenshot(options?: ScreenshotOptions): Promise<Uint8Array>;
1602
+ locator(selector: string, options?: LocatorFilterOptions): Locator;
1603
+ getByText(text: string | RegExp, options?: {
1604
+ exact?: boolean;
1605
+ }): Locator;
1606
+ getByAltText(text: string | RegExp, options?: {
1607
+ exact?: boolean;
1608
+ }): Locator;
1609
+ getByLabel(text: string | RegExp, options?: {
1610
+ exact?: boolean;
1611
+ }): Locator;
1612
+ getByPlaceholder(text: string | RegExp, options?: {
1613
+ exact?: boolean;
1614
+ }): Locator;
1615
+ getByTitle(text: string | RegExp, options?: {
1616
+ exact?: boolean;
1617
+ }): Locator;
1618
+ getByTestId(testId: string | RegExp): Locator;
1619
+ /** Mark the page closed (window.close()-style) and notify listeners. */
1620
+ close(): void;
1621
+ /** Dispose the page and notify listeners. */
1622
+ dispose(): void;
1623
+ private _assertNotClosed;
1624
+ private _screenshotFileName;
1625
+ }
1626
+ //#endregion
1627
+ //#region src/page/page-singleton.d.ts
1628
+ /**
1629
+ * Configure the lazily-created {@link page} singleton. Called by `run()` before
1630
+ * tests execute so `page.screenshot()` etc. have their host wiring. Resets any
1631
+ * existing instance so the next access rebuilds with the new config; safe
1632
+ * because configuration always happens before tests create locators.
1633
+ */
1634
+ declare function configureInflightPage(options: InflightPageOptions): void;
1635
+ /** The live {@link InflightPage} instance, created on first access. */
1636
+ declare function getInflightPage(): InflightPage;
1637
+ /** Drop the current instance + config (test isolation). */
1638
+ declare function resetInflightPage(): void;
1639
+ /**
1640
+ * The shared page. Every access forwards to the lazily-created
1641
+ * {@link InflightPage}; methods are bound so destructuring
1642
+ * (`const { getByTestId } = page`) keeps working.
1643
+ */
1644
+ declare const page: InflightPage;
1645
+ //#endregion
1646
+ //#region src/page/dom-input-backend.d.ts
1647
+ declare class DomInputBackend implements InputBackend {
1648
+ click(x: number, y: number, options?: ClickOptions): Promise<void>;
1649
+ move(x: number, y: number): Promise<void>;
1650
+ down(x: number, y: number, options?: MouseOptions): Promise<void>;
1651
+ up(x: number, y: number, options?: MouseOptions): Promise<void>;
1652
+ wheel(x: number, y: number, deltaY: number, deltaX?: number): Promise<void>;
1653
+ tap(x: number, y: number, options?: TapOptions): Promise<void>;
1654
+ swipe(fromX: number, fromY: number, toX: number, toY: number, options?: SwipeOptions): Promise<void>;
1655
+ longPress(x: number, y: number, options?: LongPressOptions): Promise<void>;
1656
+ press(key: string, options?: PressOptions): Promise<void>;
1657
+ keyDown(key: string): Promise<void>;
1658
+ keyUp(key: string): Promise<void>;
1659
+ typeText(text: string, options?: TypeOptions): Promise<void>;
1660
+ }
1661
+ //#endregion
1662
+ //#region src/vendored/version.d.ts
1663
+ declare const VENDORED_VITEST_VERSION = "5.0.0-beta.5";
1664
+ //#endregion
1665
+ export { type ActivityBridge, type BlobReportInput, type CaptureRect, type CaptureScreenRequest, type CaptureScreenResult, type CaptureScreenshotOptions, type CapturedScreenshot, CollectingProgressSurface, ConsoleProgressSurface, DomInputBackend, InflightPage, type InflightPageOptions, type InflightRunOptions, type InflightRunResult, InflightVitestRunner, MemoryReportIo, PROTOCOL_CAPTURE_SCREEN, PROTOCOL_CAPTURE_SCREEN_CALLBACK, type ProgressSurface, type QuickjsOs, QuickjsReportIo, type ReportIo, type RunProgressEvent, SimulatedActivityBridge, type SimulatedScreenshotHostOptions, type StartOptions, TINY_PNG, type TestFileSpec, VENDORED_VITEST_VERSION, type VitestRunner, type WriteBlobReportOptions, type WrittenReport, afterAll, afterEach, beforeAll, beforeEach, captureScreenshot, collectTests, configureInflightPage, createRunId, describe, expect, getCurrentSuite, getInflightPage, getRunner, it, joinPath, onTestFailed, onTestFinished, page, recordArtifact, resetInflightPage, run, serializeBlobReport, start, startTests, suite, test, writeBlobReport };
1666
+ //# sourceMappingURL=index.d.ts.map