@platejs/test 0.0.0-stage → 54.0.0-beta.2

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,1586 @@
1
+ import { t as PlaceholderShape } from "../zero-width-BGyZc7Mb.js";
2
+ import { a as defineBrowserFeatureContract, i as createBrowserFeatureContractRegistry, n as BrowserFeatureContractRegistry, r as BrowserFeatureContractRow, t as BrowserFeatureContractDefinition } from "../feature-contracts-Dwvvzqfa.js";
3
+ import { Range, Selection } from "platejs";
4
+ import { BROWSER_HANDLE_KEY } from "platejs/testing";
5
+ import { Frame, Locator, Page, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestInfo, TestType, expect } from "@playwright/test";
6
+ //#region src/playwright/render-profiler.d.ts
7
+ /** Render-profiler event categories emitted by editor React. */
8
+ type ReactRenderKind = 'core-time' | 'dom-text-sync' | 'editable' | 'element' | 'leaf' | 'root-plan' | 'runtime-time' | 'selector' | 'spacer' | 'text' | 'void';
9
+ /** One editor React render-profiler event. */
10
+ type ReactRenderProfilerEvent = {
11
+ kind: ReactRenderKind;
12
+ id?: string | null;
13
+ nodeKey?: string | null;
14
+ };
15
+ /** Collected editor React render profiler events and counters. */
16
+ /** Snapshot returned by the editor React render profiler. */
17
+ type ReactRenderProfilerSnapshot = {
18
+ byKey: Record<string, number>;
19
+ byKind: Partial<Record<ReactRenderKind, number>>;
20
+ events: ReactRenderProfilerEvent[];
21
+ total: number;
22
+ };
23
+ /** Install the editor React render profiler bridge in a Playwright page. */
24
+ declare const installReactRenderProfiler: (page: Page) => Promise<void>;
25
+ /** Reset collected editor React render profiler events in the page. */
26
+ declare const resetReactRenderProfiler: (page: Page) => Promise<void>;
27
+ /** Read the current editor React render profiler snapshot from the page. */
28
+ declare const getReactRenderProfilerSnapshot: (page: Page) => Promise<ReactRenderProfilerSnapshot>;
29
+ //#endregion
30
+ //#region src/playwright/types.d.ts
31
+ type AtLeastOne<T extends object> = { [K in keyof T]-?: Required<Pick<T, K>> & Partial<Omit<T, K>>; }[keyof T];
32
+ /** Exact or bounded numeric assertion used by browser proof steps. */
33
+ type BrowserNumberBudget = number | {
34
+ exact: number;
35
+ max?: never;
36
+ min?: never;
37
+ } | (AtLeastOne<{
38
+ max: number;
39
+ min: number;
40
+ }> & {
41
+ exact?: never;
42
+ });
43
+ /** Model selection snapshot captured from the editor runtime. */
44
+ type SelectionSnapshot = {
45
+ anchor: {
46
+ path: number[];
47
+ offset: number;
48
+ };
49
+ focus: {
50
+ path: number[];
51
+ offset: number;
52
+ };
53
+ };
54
+ /** Owner metadata for a raw view-selection snapshot. */
55
+ type BrowserRawViewSelectionOwner = {
56
+ childRoot: string;
57
+ ownerPath: number[];
58
+ ownerRoot: string;
59
+ };
60
+ /** Point in a raw view-selection snapshot. */
61
+ type BrowserRawViewSelectionPoint = {
62
+ owner?: BrowserRawViewSelectionOwner;
63
+ point: {
64
+ path: number[];
65
+ offset: number;
66
+ root?: string;
67
+ };
68
+ };
69
+ /** Raw view-selection snapshot captured from editor view state. */
70
+ type BrowserRawViewSelectionSnapshot = {
71
+ anchor: BrowserRawViewSelectionPoint;
72
+ focus: BrowserRawViewSelectionPoint;
73
+ segments: {
74
+ backward: boolean;
75
+ [key: string]: unknown;
76
+ };
77
+ };
78
+ /** Browser-native DOM selection snapshot. */
79
+ type DOMSelectionSnapshot = {
80
+ anchorNodeText: string | null;
81
+ anchorOffset: number;
82
+ focusNodeText: string | null;
83
+ focusOffset: number;
84
+ };
85
+ /** DOM selection endpoints with resolved node-location metadata. */
86
+ type DOMSelectionLocationSnapshot = {
87
+ anchorOffset: number | null;
88
+ anchorPath: number[] | null;
89
+ anchorText: string | null;
90
+ isCollapsed: boolean | null;
91
+ };
92
+ type DOMSelectionLocationExpectation = AtLeastOne<DOMSelectionLocationSnapshot>;
93
+ /** Combined model and native-selection summary for one root. */
94
+ /** Combined model and native selection summary for proof assertions. */
95
+ type BrowserNativeSelectionSummary = {
96
+ collapsed: boolean | null;
97
+ rangeCount: number;
98
+ selection: SelectionSnapshot | null;
99
+ textLength: number;
100
+ };
101
+ /** Editor view-selection snapshot used by browser proof helpers. */
102
+ type BrowserViewSelectionSnapshot = {
103
+ active: boolean;
104
+ anchor: SelectionPoint | null;
105
+ focus: SelectionPoint | null;
106
+ markerCount: number;
107
+ markerPaths: Array<string | null>;
108
+ markerRects: SelectionRectSnapshot[];
109
+ selection: SelectionSnapshot | null;
110
+ textLength: number;
111
+ };
112
+ /** Visible selection overlay snapshot for one root. */
113
+ /** Displayed selection snapshot for one root in the rendered document. */
114
+ type BrowserDisplayedSelectionSnapshot = {
115
+ displayed: SelectionSnapshot | null;
116
+ doubleHighlighted: boolean;
117
+ hasVisibleEditorSelection: boolean;
118
+ hasVisibleSelection: boolean;
119
+ model: SelectionSnapshot | null;
120
+ native: BrowserNativeSelectionSummary;
121
+ source: 'native' | 'none' | 'view';
122
+ view: BrowserViewSelectionSnapshot;
123
+ };
124
+ /** Clipboard payload captured during a browser proof step. */
125
+ /** Clipboard payload snapshot captured during paste/copy proof. */
126
+ type ClipboardPayloadSnapshot = {
127
+ html: string | null;
128
+ markdown?: string | null;
129
+ fragment?: string | null;
130
+ text: string;
131
+ types: string[];
132
+ };
133
+ /** Geometry snapshot for a rendered selection or caret rect. */
134
+ /** Client-rect bounds for a visible selection segment. */
135
+ type SelectionRectSnapshot = {
136
+ x: number;
137
+ y: number;
138
+ width: number;
139
+ height: number;
140
+ };
141
+ /**
142
+ * How a Playwright project delivers `editor.clipboard.pasteText` and `pasteHtml`: `'native'` writes the system
143
+ * clipboard and presses the paste shortcut, `'event'` dispatches a synthetic paste event, and `'handle'` inserts through
144
+ * the page handle as a stand-in.
145
+ */
146
+ type BrowserClipboardTransport = 'event' | 'handle' | 'native';
147
+ /** Project `use` options the editor browser harness reads. */
148
+ type BrowserTestOptions = {
149
+ clipboardTransport?: BrowserClipboardTransport;
150
+ };
151
+ /** Native event categories recorded by the browser trace helper. */
152
+ type BrowserNativeEventTraceType = 'beforeinput' | 'compositionend' | 'compositionstart' | 'compositionupdate' | 'input' | 'keydown' | 'pointerdown' | 'selectionchange';
153
+ /** DOM node summary captured in a native event trace. */
154
+ type BrowserNativeEventTraceNodeSnapshot = {
155
+ nodeName: string | null;
156
+ parentNodeName: string | null;
157
+ parentPath: string | null;
158
+ parentSignature: string | null;
159
+ path: string | null;
160
+ text: string | null;
161
+ };
162
+ /** Selection summary captured during a native event trace. */
163
+ type BrowserNativeEventTraceSelectionSnapshot = {
164
+ anchor: BrowserNativeEventTraceNodeSnapshot | null;
165
+ anchorOffset: number | null;
166
+ collapsed: boolean | null;
167
+ focus: BrowserNativeEventTraceNodeSnapshot | null;
168
+ focusOffset: number | null;
169
+ rangeCount: number;
170
+ selectedText: string;
171
+ };
172
+ /** Rectangle captured from native event target ranges. */
173
+ type BrowserNativeEventTraceRect = {
174
+ height: number;
175
+ width: number;
176
+ x: number;
177
+ y: number;
178
+ };
179
+ /** Target-range snapshot captured from a native input event. */
180
+ type BrowserNativeEventTraceTargetRangeSnapshot = {
181
+ collapsed: boolean;
182
+ end: BrowserNativeEventTraceNodeSnapshot;
183
+ endOffset: number;
184
+ rects: BrowserNativeEventTraceRect[];
185
+ start: BrowserNativeEventTraceNodeSnapshot;
186
+ startOffset: number;
187
+ };
188
+ /** Text-node snapshot captured before or after a native event. */
189
+ type BrowserNativeEventTraceTextNodeSnapshot = {
190
+ id: string;
191
+ parentPath: string | null;
192
+ parentSignature: string;
193
+ text: string;
194
+ };
195
+ /** Text-node before/after delta captured by native event tracing. */
196
+ type BrowserNativeEventTraceTextNodeDelta = {
197
+ after: BrowserNativeEventTraceTextNodeSnapshot | null;
198
+ before: BrowserNativeEventTraceTextNodeSnapshot | null;
199
+ type: 'added' | 'deleted' | 'modified' | 'moved';
200
+ };
201
+ /** DOM delta captured around one native event. */
202
+ type BrowserNativeEventTraceDOMDelta = {
203
+ textNodes: BrowserNativeEventTraceTextNodeDelta[];
204
+ };
205
+ /** Suspicious native-event trace finding. */
206
+ type BrowserNativeEventTraceAnomaly = {
207
+ detail: string;
208
+ type: 'composition-mismatch' | 'data-content-mismatch' | 'inputtype-mismatch' | 'missing-beforeinput' | 'node-type-change' | 'parent-mismatch' | 'selection-jump' | 'sibling-created';
209
+ };
210
+ /** One recorded native browser event with selection and DOM evidence. */
211
+ type BrowserNativeEventTraceEntry = {
212
+ cancelable: boolean;
213
+ /** Viewport x in CSS pixels for pointerdown entries. */
214
+ clientX: number | null;
215
+ /** Viewport y in CSS pixels for pointerdown entries. */
216
+ clientY: number | null;
217
+ data: string | null;
218
+ domDelta: BrowserNativeEventTraceDOMDelta | null;
219
+ inputType: string | null;
220
+ isComposing: boolean | null;
221
+ /** False for events a script dispatched; true for browser-delivered input. */
222
+ isTrusted: boolean;
223
+ /** `KeyboardEvent.key` for keydown entries. */
224
+ key: string | null;
225
+ /** `KeyboardEvent.keyCode` for keydown entries; 229 while an IME owns the key. */
226
+ keyCode: number | null;
227
+ selection: BrowserNativeEventTraceSelectionSnapshot;
228
+ /** Increases by one per recorded entry from the trace start, so entries stay ordered after the cap trims older ones. */
229
+ seq: number;
230
+ targetRanges: BrowserNativeEventTraceTargetRangeSnapshot[];
231
+ timestamp: number;
232
+ type: BrowserNativeEventTraceType;
233
+ };
234
+ /** Complete native event trace collected from a editor browser root. */
235
+ /** Complete native event trace snapshot. */
236
+ type BrowserNativeEventTraceSnapshot = {
237
+ anomalies: BrowserNativeEventTraceAnomaly[];
238
+ entries: BrowserNativeEventTraceEntry[];
239
+ };
240
+ /** Options controlling which native events are traced. */
241
+ /** Options for installing a native event trace recorder in the page. */
242
+ type BrowserNativeEventTraceOptions = {
243
+ events?: readonly BrowserNativeEventTraceType[];
244
+ maxEntries?: number;
245
+ };
246
+ /** Snapshot of the element that owns browser focus. */
247
+ /** Focus ownership snapshot for editor and native controls. */
248
+ type FocusOwnerSnapshot = {
249
+ isContentEditable: boolean;
250
+ kind: 'contenteditable' | 'editor' | 'internal-control' | 'none' | 'outside';
251
+ role: string | null;
252
+ tagName: string | null;
253
+ testId: string | null;
254
+ };
255
+ /** Rendered zero-width node shape captured from the DOM. */
256
+ type BrowserZeroWidthNodeShape = {
257
+ hasBr: boolean;
258
+ hasFEFF: boolean;
259
+ html: string;
260
+ index: number;
261
+ kind: string | null;
262
+ length: string | null;
263
+ textContent: string;
264
+ };
265
+ /** Rendered block DOM shape used by structure assertions. */
266
+ type RenderedBlockDOMShapeSnapshot = {
267
+ index: number;
268
+ innerText: string;
269
+ lineBoxCount: number;
270
+ textContent: string;
271
+ unexpectedZeroWidthBreaks: BrowserZeroWidthNodeShape[];
272
+ zeroWidthNodes: BrowserZeroWidthNodeShape[];
273
+ };
274
+ /** Expected rendered DOM shape for browser proof assertions. */
275
+ /** Expected rendered DOM shape for proof assertions. */
276
+ type RenderedDOMShapeExpectation = {
277
+ blockIndex?: number;
278
+ } & AtLeastOne<{
279
+ domSelectionTarget?: DOMSelectionLocationExpectation;
280
+ innerText?: string;
281
+ lineBoxCount?: number | AtLeastOne<{
282
+ max: number;
283
+ min: number;
284
+ }>;
285
+ noUnexpectedZeroWidthBreaks?: true;
286
+ textContent?: string;
287
+ zeroWidthBreakCount?: number;
288
+ zeroWidthCount?: number;
289
+ }>;
290
+ /** High-level kernel trace event family. */
291
+ type BrowserKernelEventFamily = 'beforeinput' | 'blur' | 'click' | 'compositionend' | 'compositionstart' | 'compositionupdate' | 'copy' | 'cut' | 'dragend' | 'dragover' | 'dragstart' | 'drop' | 'focus' | 'input' | 'keydown' | 'mousedown' | 'paste' | 'repair' | 'selectionchange';
292
+ /** Kernel state label captured in trace entries. */
293
+ type BrowserKernelState = 'app-owned' | 'clipboard' | 'composition' | 'dom-selection' | 'dragging' | 'idle' | 'internal-control' | 'model-owned' | 'viewport-backed' | 'repairing';
294
+ /** Owner classification for the current browser editing target. */
295
+ type BrowserKernelTargetOwner = 'app-owned' | 'editor' | 'internal-control' | 'outside-editor' | 'viewport' | 'unknown';
296
+ /** Model/native ownership classification for a kernel event. */
297
+ type BrowserKernelOwnership = 'app-owned' | 'deferred' | 'model-owned' | 'native-allowed' | 'native-denied' | 'no-op';
298
+ /** Source that produced the selection observed by the kernel trace. */
299
+ type BrowserKernelSelectionSource = 'app-owned' | 'composition-owned' | 'dom-current' | 'internal-control' | 'model-owned' | 'viewport-backed' | 'unknown';
300
+ /** Input intent classified by the editable browser kernel. */
301
+ type BrowserKernelInputIntent = 'clipboard' | 'composition' | 'delete' | 'history' | 'insert-break' | 'internal-control' | 'model-selection-move' | 'native-selection-move' | 'viewport-selection' | 'text-insert';
302
+ /** Origin of a selection change captured by the kernel trace. */
303
+ type BrowserKernelSelectionChangeOrigin = 'browser-handle' | 'native-user' | 'programmatic-export' | 'repair-induced' | 'unknown';
304
+ /** Editing command observed by the browser kernel trace. */
305
+ type BrowserKernelCommand = {
306
+ direction: 'backward' | 'forward';
307
+ kind: 'delete';
308
+ unit?: 'block' | 'line' | 'word';
309
+ } | {
310
+ kind: 'delete-both';
311
+ unit: 'line';
312
+ } | {
313
+ direction?: 'backward' | 'forward';
314
+ kind: 'delete-fragment';
315
+ selection?: Range | Selection;
316
+ } | {
317
+ direction: 'redo' | 'undo';
318
+ kind: 'history';
319
+ } | {
320
+ kind: 'insert-break';
321
+ variant: 'open-line' | 'paragraph' | 'soft';
322
+ } | {
323
+ data?: unknown;
324
+ kind: 'insert-data';
325
+ } | {
326
+ inputType?: string;
327
+ kind: 'insert-text';
328
+ text: string;
329
+ } | {
330
+ kind: 'transpose-character';
331
+ } | {
332
+ axis: 'document' | 'horizontal' | 'line' | 'word';
333
+ extend?: boolean;
334
+ kind: 'move-selection';
335
+ reverse?: boolean;
336
+ } | {
337
+ kind: 'select';
338
+ selection: Range;
339
+ } | {
340
+ kind: 'select-all';
341
+ };
342
+ /** Static command metadata captured beside a kernel trace command. */
343
+ type BrowserKernelCommandDefinition = Readonly<{
344
+ inputFamilies: readonly BrowserKernelEventFamily[];
345
+ kind: BrowserKernelCommand['kind'];
346
+ modelOwned: boolean;
347
+ }>;
348
+ /** Ownership trace for keyboard or pointer movement through the editor. */
349
+ type BrowserKernelMovementOwnershipTrace = {
350
+ axis: 'document' | 'horizontal' | 'line' | 'unknown' | 'vertical' | 'word';
351
+ extend: boolean;
352
+ key: string;
353
+ ownership: Extract<BrowserKernelOwnership, 'model-owned' | 'native-allowed'>;
354
+ reason: 'model-document-boundary' | 'model-horizontal-inline-void' | 'model-line-browser' | 'model-word-boundary' | 'native-selection-key' | 'native-vertical-layout';
355
+ reverse: boolean | null;
356
+ };
357
+ /** Selection policy attached to a kernel transition. */
358
+ type BrowserKernelSelectionPolicy = {
359
+ kind: 'clear' | 'export-model' | 'import-dom' | 'none' | 'viewport' | 'preserve-model';
360
+ reason: 'internal-control' | 'model-owned' | 'native-selection' | 'not-requested' | 'viewport-backed' | 'selection-clear' | 'unknown-selection';
361
+ };
362
+ /** Repair policy attached to a kernel transition. */
363
+ type BrowserKernelRepairPolicy = {
364
+ kind: 'force-render' | 'none' | 'repair-caret' | 'repair-text' | 'sync-selection';
365
+ reason: 'force-render' | 'not-requested' | 'repair-caret' | 'repair-caret-after-text-insert' | 'repair-text' | 'sync-selection';
366
+ };
367
+ /** State transition recorded by the browser kernel trace. */
368
+ type BrowserKernelTransition = {
369
+ allowed: boolean;
370
+ reason: string | null;
371
+ };
372
+ /** Repair request emitted while handling a kernel event frame. */
373
+ type BrowserKernelRepairRequest = {
374
+ focus?: boolean;
375
+ forceRender?: boolean;
376
+ kind: 'force-render';
377
+ selectionSourceTransition?: BrowserKernelSelectionSourceTransition;
378
+ } | {
379
+ focus?: boolean;
380
+ forceRender?: boolean;
381
+ kind: 'sync-selection';
382
+ selectionSourceTransition?: BrowserKernelSelectionSourceTransition;
383
+ syncDOMSelection?: boolean;
384
+ } | {
385
+ focus?: boolean;
386
+ forceRender?: boolean;
387
+ kind: 'repair-caret' | 'repair-caret-after-text-insert';
388
+ selectionSourceTransition?: BrowserKernelSelectionSourceTransition;
389
+ } | {
390
+ kind: 'none' | 'skip-dom-sync';
391
+ };
392
+ /** Selection-source transition attached to a kernel repair request. */
393
+ type BrowserKernelSelectionSourceTransition = {
394
+ preferModelSelection: boolean;
395
+ reason: 'internal-control' | 'model-command' | 'native-selection-move' | 'projection-refresh' | 'repair-induced' | 'unknown-selection';
396
+ selectionSource: BrowserKernelSelectionSource;
397
+ };
398
+ /** Native event frame and derived editor evidence. */
399
+ type BrowserKernelEventFrame = {
400
+ active: boolean;
401
+ commitEpoch: number | null;
402
+ eventFamily: BrowserKernelEventFamily;
403
+ focusOwner: BrowserKernelTargetOwner;
404
+ id: number;
405
+ inputIntent: BrowserKernelInputIntent | null;
406
+ lifecyclePhase: 'commit' | 'event' | 'external' | 'layout-effect';
407
+ modelSelectionBefore: Selection;
408
+ root: string;
409
+ selectionSource: BrowserKernelSelectionSource;
410
+ startedAt: number;
411
+ targetOwner: BrowserKernelTargetOwner;
412
+ viewEpoch: number | null;
413
+ };
414
+ /** Kernel trace entry used by browser behavior assertions. */
415
+ type BrowserKernelTraceEntry = {
416
+ command: BrowserKernelCommand | null;
417
+ commandDefinition: BrowserKernelCommandDefinition | null;
418
+ epochId: number | null;
419
+ eventFamily: BrowserKernelEventFamily;
420
+ frame: BrowserKernelEventFrame | null;
421
+ frameId: number | null;
422
+ intent: BrowserKernelInputIntent | null;
423
+ movement: BrowserKernelMovementOwnershipTrace | null;
424
+ nativeAllowed: boolean;
425
+ ownership: BrowserKernelOwnership;
426
+ repair: BrowserKernelRepairRequest | null;
427
+ repairPolicy: BrowserKernelRepairPolicy;
428
+ selectionChangeOrigin: BrowserKernelSelectionChangeOrigin;
429
+ selectionAfter: Selection;
430
+ selectionBefore: Selection;
431
+ selectionPolicy: BrowserKernelSelectionPolicy;
432
+ selectionSource: BrowserKernelSelectionSource;
433
+ stateAfter: BrowserKernelState;
434
+ stateBefore: BrowserKernelState;
435
+ targetOwner: BrowserKernelTargetOwner;
436
+ transition: BrowserKernelTransition;
437
+ };
438
+ /** Expected kernel trace properties for one assertion. */
439
+ type BrowserKernelTraceExpectation = AtLeastOne<{
440
+ commandKind?: BrowserKernelCommand['kind'] | null;
441
+ eventFamily?: BrowserKernelEventFamily;
442
+ movement?: Partial<BrowserKernelMovementOwnershipTrace> | null;
443
+ ownership?: BrowserKernelOwnership;
444
+ repairPolicy?: AtLeastOne<BrowserKernelRepairPolicy>;
445
+ selectionChangeOrigin?: BrowserKernelSelectionChangeOrigin;
446
+ selectionPolicy?: AtLeastOne<BrowserKernelSelectionPolicy>;
447
+ selectionSource?: BrowserKernelSelectionSource;
448
+ stateAfter?: BrowserKernelState;
449
+ stateBefore?: BrowserKernelState;
450
+ targetOwner?: BrowserKernelTargetOwner;
451
+ transition?: AtLeastOne<BrowserKernelTransition>;
452
+ }>;
453
+ /** Point shape reused from a model selection snapshot. */
454
+ type SelectionPoint = SelectionSnapshot['anchor'];
455
+ /** Association used when capturing or restoring selection anchors. */
456
+ type RangeAnchorAssociation = 'forward' | 'backward' | 'outward' | 'inward';
457
+ /** Serializable selection anchor used by replay helpers. */
458
+ type SelectionAnchorHandle = {
459
+ id: string;
460
+ };
461
+ /** Options for capturing editor and DOM selection snapshots. */
462
+ /** Options for capturing model and DOM selection snapshots. */
463
+ type SelectionCaptureOptions = {
464
+ association?: RangeAnchorAssociation;
465
+ };
466
+ /** Options for resolving DOM paths in browser helpers. */
467
+ /** Options for resolving a DOM node from a editor path. */
468
+ type BrowserDOMPathOptions = {
469
+ align?: 'center' | 'end' | 'nearest' | 'start';
470
+ timeoutMs?: number;
471
+ };
472
+ /** Options for clicking a text range by editor path. */
473
+ /** Options for clicking a text range resolved by editor path. */
474
+ type BrowserTextPathRangeClickOptions = BrowserDOMPathOptions & {
475
+ endOffset: number;
476
+ xAffinity?: 'center' | 'end' | 'start';
477
+ path: number[];
478
+ startOffset: number;
479
+ };
480
+ /** Options for clicking text by visible offset. */
481
+ /** Options for clicking a text node at a character offset. */
482
+ type BrowserTextOffsetClickOptions = {
483
+ clickCount?: number;
484
+ offset: number;
485
+ path: number[];
486
+ waitForSelectionSync?: boolean;
487
+ };
488
+ /** Options for dragging across a resolved text range. */
489
+ type BrowserDragTextRangeOptions = {
490
+ direction?: 'backward' | 'forward';
491
+ endAffinity?: 'after' | 'inside';
492
+ endOffset: number;
493
+ endText?: string;
494
+ endTextNodeIndex?: number;
495
+ settleMs?: number;
496
+ startOffset: number;
497
+ steps?: number;
498
+ text: string;
499
+ textNodeIndex?: number;
500
+ };
501
+ /** Options for double-click drag selection across text. */
502
+ type BrowserDoubleClickDragTextRangeOptions = {
503
+ doubleClickOffset: number;
504
+ endOffset: number;
505
+ gestureDelayMs?: number;
506
+ steps?: number;
507
+ text: string;
508
+ textNodeIndex?: number;
509
+ };
510
+ /** Exact or inclusive offset expectation for selection assertions. */
511
+ type OffsetExpectation = number | readonly [number, number];
512
+ /** Expected model selection snapshot shape. */
513
+ type SelectionSnapshotExpectation = {
514
+ anchor: {
515
+ path: number[];
516
+ offset: OffsetExpectation;
517
+ };
518
+ focus: {
519
+ path: number[];
520
+ offset: OffsetExpectation;
521
+ };
522
+ };
523
+ /** Expected browser-native DOM selection snapshot shape. */
524
+ type DOMSelectionSnapshotExpectation = {
525
+ anchorNodeText: string | null;
526
+ anchorOffset: OffsetExpectation;
527
+ focusNodeText: string | null;
528
+ focusOffset: OffsetExpectation;
529
+ };
530
+ /** Expected collapsed model and DOM selection agreement. */
531
+ type CollapsedModelDOMSelectionExpectation = {
532
+ offset: OffsetExpectation;
533
+ path: number[];
534
+ text: string;
535
+ };
536
+ /** Options for normalizing HTML before paste or clipboard assertions. */
537
+ type HtmlNormalizationOptions = {
538
+ ignoreClasses?: boolean;
539
+ ignoreInlineStyles?: boolean;
540
+ ignoreDir?: boolean;
541
+ };
542
+ /** Options for waiting until an example route is ready. */
543
+ /** Options for waiting until a editor example route is ready. */
544
+ type ReadyOptions = {
545
+ editor?: 'visible';
546
+ placeholder?: 'visible' | 'hidden';
547
+ selector?: string;
548
+ text?: RegExp | string;
549
+ selection?: 'settled' | SelectionSnapshot;
550
+ timeoutMs?: number;
551
+ };
552
+ /** Options for selecting an editor surface on a page. */
553
+ /** Options for locating an editor surface on an example route. */
554
+ type EditorSurfaceOptions = {
555
+ frame?: string;
556
+ scope?: string;
557
+ };
558
+ /** Options for opening an example route in the browser harness. */
559
+ /** Options for opening and preparing a editor example route. */
560
+ type OpenExampleOptions = {
561
+ query?: Record<string, boolean | null | number | string | undefined> | URLSearchParams | string;
562
+ ready?: ReadyOptions;
563
+ surface?: EditorSurfaceOptions;
564
+ };
565
+ /** Document, selection, and shell state captured from an editor. */
566
+ /** Serialized editor state captured from an example route. */
567
+ type EditorSnapshot = {
568
+ text: string;
569
+ blockTexts: string[];
570
+ renderedBlocks: RenderedBlockDOMShapeSnapshot[];
571
+ selectedText: string;
572
+ selection: SelectionSnapshot | null;
573
+ domSelection: DOMSelectionSnapshot | null;
574
+ focusOwner: FocusOwnerSnapshot;
575
+ kernelTrace: BrowserKernelTraceEntry[];
576
+ lastCommit: unknown;
577
+ placeholderShape: PlaceholderShape | null;
578
+ };
579
+ /** Summary of a rendered editor shell node. */
580
+ type BrowserShellSummary = {
581
+ isInline: boolean;
582
+ isVoid: boolean;
583
+ kind: string | null;
584
+ path: string | null;
585
+ nodeKey: string | null;
586
+ tagName: string | null;
587
+ };
588
+ /** Snapshot of selected rendered shell nodes. */
589
+ type BrowserSelectedShellSnapshot = {
590
+ element: BrowserShellSummary | null;
591
+ node: BrowserShellSummary | null;
592
+ offset: number;
593
+ path: number[];
594
+ point: 'anchor' | 'focus';
595
+ };
596
+ /** Snapshot of rendered shell nodes related to selection. */
597
+ type BrowserSelectionShellsSnapshot = {
598
+ anchor: BrowserSelectedShellSnapshot;
599
+ focus: BrowserSelectedShellSnapshot;
600
+ nodeKeys: string[];
601
+ };
602
+ /** Full render state snapshot including selected and selection shells. */
603
+ /** Editor snapshot with rendered shell and DOM shape evidence. */
604
+ type BrowserRenderStateSnapshot = EditorSnapshot & {
605
+ renderCounts: ReactRenderProfilerSnapshot;
606
+ selectionShells: BrowserSelectionShellsSnapshot | null;
607
+ };
608
+ /** Browser-side trace entry emitted by scenario runners. */
609
+ type BrowserTraceEntry = {
610
+ label: string;
611
+ snapshot: EditorSnapshot;
612
+ stepIndex: number | null;
613
+ };
614
+ /** Caller-provided metadata for browser scenario execution. */
615
+ /** Scenario metadata supplied by a browser scenario step. */
616
+ type BrowserScenarioMetadata = {
617
+ capabilities?: readonly string[];
618
+ platform?: string;
619
+ transport?: string;
620
+ };
621
+ /** Transport capability claim attached to a scenario step. */
622
+ type BrowserTransportClaim = 'desktop-native-clipboard' | 'desktop-native-ime-composition' | 'desktop-native-keyboard' | 'desktop-semantic-handle' | 'mixed-native-and-semantic' | 'mobile-semantic-handle' | 'mobile-synthetic-composition' | 'playwright-mobile-keyboard' | 'playwright-mobile-viewport' | 'synthetic-composition' | 'synthetic-datatransfer' | 'unspecified';
623
+ /** Normalized scenario metadata after transport classification. */
624
+ type BrowserNormalizedScenarioMetadata = {
625
+ capabilities: string[];
626
+ claim: BrowserTransportClaim;
627
+ platform: string | null;
628
+ transport: string | null;
629
+ };
630
+ /** Metadata attached to one executable scenario step. */
631
+ type BrowserScenarioStepMetadata = {
632
+ iteration?: number;
633
+ warmLoop?: string;
634
+ };
635
+ type BrowserWindowSelectionTextExpectation = {
636
+ contains: string;
637
+ notEmpty?: boolean;
638
+ text?: string;
639
+ } | {
640
+ contains?: string;
641
+ notEmpty: true;
642
+ text?: string;
643
+ } | {
644
+ contains?: string;
645
+ notEmpty?: boolean;
646
+ text: string;
647
+ };
648
+ type BrowserLocatorCountExpectation = {
649
+ count: number;
650
+ max?: never;
651
+ min?: never;
652
+ } | ({
653
+ count?: never;
654
+ } & AtLeastOne<{
655
+ max: number;
656
+ min: number;
657
+ }>);
658
+ /** Executable browser scenario step. */
659
+ type BrowserScenarioStep = ({
660
+ change: Record<string, unknown>;
661
+ kind: 'applyChange';
662
+ label?: string;
663
+ tag?: string | string[];
664
+ } | {
665
+ kind: 'applyValueChange';
666
+ label?: string;
667
+ tag?: string | string[];
668
+ value: Record<string, unknown>;
669
+ } | ({
670
+ kind: 'assertLocatorCount';
671
+ label?: string;
672
+ selector: string;
673
+ } & BrowserLocatorCountExpectation) | ({
674
+ index?: number;
675
+ kind: 'assertLocatorCss';
676
+ label?: string;
677
+ property: string;
678
+ selector: string;
679
+ } & AtLeastOne<{
680
+ notValue: string;
681
+ value: string;
682
+ }>) | ({
683
+ afterSelector: string;
684
+ beforeSelector: string;
685
+ kind: 'assertLocatorVerticalGap';
686
+ label?: string;
687
+ } & AtLeastOne<{
688
+ max: number;
689
+ min: number;
690
+ }>) | ({
691
+ innerSelector: string;
692
+ kind: 'assertLocatorVerticalOffset';
693
+ label?: string;
694
+ selector: string;
695
+ } & AtLeastOne<{
696
+ max: number;
697
+ min: number;
698
+ }>) | {
699
+ kind: 'assertModelSelectionExpanded';
700
+ label?: string;
701
+ } | {
702
+ kind: 'assertCapturedNodeKeyPath';
703
+ label?: string;
704
+ name: string;
705
+ path: number[] | null;
706
+ } | {
707
+ budget: AtLeastOne<{
708
+ byKind: AtLeastOne<Record<ReactRenderKind, BrowserNumberBudget>>;
709
+ total: BrowserNumberBudget;
710
+ }>;
711
+ kind: 'assertRenderBudget';
712
+ label?: string;
713
+ } | ({
714
+ kind: 'assertWindowSelectionText';
715
+ label?: string;
716
+ } & BrowserWindowSelectionTextExpectation) | {
717
+ kind: 'assertDOMSelection';
718
+ label?: string;
719
+ selection: DOMSelectionSnapshotExpectation;
720
+ } | {
721
+ focusOwner: FocusOwnerSnapshot['kind'];
722
+ kind: 'assertFocusOwner';
723
+ label?: string;
724
+ } | {
725
+ kind: 'assertKernelTrace';
726
+ label?: string;
727
+ trace: BrowserKernelTraceExpectation;
728
+ } | {
729
+ kind: 'assertSelection';
730
+ label?: string;
731
+ selection: SelectionSnapshotExpectation;
732
+ } | {
733
+ expectation: BrowserSelectionContractExpectation;
734
+ kind: 'assertSelectionContract';
735
+ label?: string;
736
+ } | {
737
+ kind: 'assertSelectionLocation';
738
+ label?: string;
739
+ location: DOMSelectionLocationExpectation;
740
+ } | {
741
+ kind: 'assertModelText';
742
+ label?: string;
743
+ text: string;
744
+ } | ({
745
+ kind: 'assertLocatorText';
746
+ label?: string;
747
+ selector: string;
748
+ } & AtLeastOne<{
749
+ contains: string;
750
+ text: string;
751
+ }>) | {
752
+ kind: 'assertSelectedText';
753
+ label?: string;
754
+ text: string;
755
+ } | {
756
+ kind: 'assertText';
757
+ label?: string;
758
+ text: string;
759
+ } | {
760
+ buttonName: string;
761
+ expectedSelection: SelectionSnapshotExpectation;
762
+ kind: 'activateShell';
763
+ label?: string;
764
+ } | {
765
+ kind: 'assertLastCommit';
766
+ label?: string;
767
+ } | {
768
+ kind: 'assertLastCommitIncludesTags';
769
+ label?: string;
770
+ tags: readonly [string, ...string[]];
771
+ } | {
772
+ kind: 'assertLastCommitTags';
773
+ label?: string;
774
+ tags: readonly string[];
775
+ } | {
776
+ kind: 'clickTestId';
777
+ label?: string;
778
+ testId: string;
779
+ } | {
780
+ kind: 'clickSelector';
781
+ label?: string;
782
+ selector: string;
783
+ } | {
784
+ kind: 'captureNodeKey';
785
+ label?: string;
786
+ name: string;
787
+ path: number[];
788
+ } | {
789
+ committedText?: string;
790
+ kind: 'composeText';
791
+ label?: string;
792
+ steps?: readonly string[];
793
+ text: string;
794
+ transport?: 'native' | 'synthetic';
795
+ } | {
796
+ kind: 'assertDOMCaret';
797
+ label?: string;
798
+ offset: number;
799
+ text: string;
800
+ } | {
801
+ kind: 'assertBlockTexts';
802
+ label?: string;
803
+ startIndex?: number;
804
+ texts: readonly string[];
805
+ } | {
806
+ kind: 'assertRenderedDOMShape';
807
+ label?: string;
808
+ shape: RenderedDOMShapeExpectation;
809
+ } | {
810
+ kind: 'clickTextOffset';
811
+ label?: string;
812
+ offset: number;
813
+ path: number[];
814
+ } | {
815
+ kind: 'doubleClickTextOffset';
816
+ label?: string;
817
+ offset: number;
818
+ path: number[];
819
+ selectedText?: string;
820
+ } | {
821
+ kind: 'deleteBackward';
822
+ label?: string;
823
+ } | {
824
+ kind: 'deleteForward';
825
+ label?: string;
826
+ } | {
827
+ endXOffset?: number;
828
+ index?: number;
829
+ kind: 'dragTextSelection';
830
+ label?: string;
831
+ selector: string;
832
+ startXOffset?: number;
833
+ steps?: number;
834
+ yOffset?: number;
835
+ } | {
836
+ html: string;
837
+ kind: 'dropHtml';
838
+ label?: string;
839
+ text?: string;
840
+ } | {
841
+ kind: 'fillControl';
842
+ label?: string;
843
+ selector: string;
844
+ value: string;
845
+ } | {
846
+ kind: 'focus';
847
+ label?: string;
848
+ } | {
849
+ kind: 'insertText';
850
+ label?: string;
851
+ text: string;
852
+ } | {
853
+ data?: string;
854
+ inputType?: string;
855
+ kind: 'mutateTextDOM';
856
+ label?: string;
857
+ path: number[];
858
+ selectionOffset?: number;
859
+ text: string;
860
+ } | {
861
+ html: string;
862
+ kind: 'pasteHtml';
863
+ label?: string;
864
+ text?: string;
865
+ } | {
866
+ kind: 'pasteText';
867
+ label?: string;
868
+ text: string;
869
+ } | {
870
+ key: string;
871
+ kind: 'press';
872
+ label?: string;
873
+ } | {
874
+ kind: 'rootClick';
875
+ label?: string;
876
+ } | {
877
+ kind: 'rootMouseDown';
878
+ label?: string;
879
+ } | {
880
+ kind: 'resetRenderProfiler';
881
+ label?: string;
882
+ } | {
883
+ kind: 'select';
884
+ label?: string;
885
+ selection: SelectionSnapshot;
886
+ } | {
887
+ kind: 'selectDOM';
888
+ label?: string;
889
+ selection: SelectionSnapshot;
890
+ } | {
891
+ kind: 'selectAll';
892
+ label?: string;
893
+ } | {
894
+ kind: 'settle';
895
+ label?: string;
896
+ timeoutMs?: number;
897
+ } | {
898
+ kind: 'snapshot';
899
+ label: string;
900
+ } | {
901
+ caretAfterType: {
902
+ offset: number;
903
+ text: string;
904
+ };
905
+ caretAfterUndo: {
906
+ offset: number;
907
+ text: string;
908
+ };
909
+ expectedModelTextAfterType: string;
910
+ expectedModelTextAfterUndo: string;
911
+ kind: 'typeThenUndo';
912
+ label?: string;
913
+ text: string;
914
+ } | {
915
+ kind: 'type';
916
+ label?: string;
917
+ text: string;
918
+ } | {
919
+ expectedModelTextBefore?: string;
920
+ kind: 'undo';
921
+ label?: string;
922
+ }) & BrowserScenarioStepMetadata;
923
+ /** Result returned by a browser scenario run. */
924
+ type BrowserScenarioResult = {
925
+ metadata: BrowserNormalizedScenarioMetadata;
926
+ name: string;
927
+ replay: BrowserScenarioReplay;
928
+ reductionCandidates: BrowserScenarioReductionCandidateSummary[];
929
+ trace: BrowserTraceEntry[];
930
+ };
931
+ /** Options for running a browser scenario step list. */
932
+ type BrowserScenarioRunOptions = {
933
+ metadata?: BrowserScenarioMetadata;
934
+ runtimeErrors?: false | {
935
+ patterns?: readonly string[];
936
+ };
937
+ tracePath?: string;
938
+ };
939
+ /** Candidate produced while reducing a failing scenario. */
940
+ type BrowserScenarioReductionCandidate = {
941
+ kind: 'iteration' | 'prefix' | 'single-step' | 'suffix';
942
+ label: string;
943
+ removedRange: {
944
+ end: number;
945
+ start: number;
946
+ };
947
+ removedSteps: readonly BrowserScenarioStep[];
948
+ steps: readonly BrowserScenarioStep[];
949
+ };
950
+ /** Human-readable summary of a scenario reduction candidate. */
951
+ type BrowserScenarioReductionCandidateSummary = Omit<BrowserScenarioReductionCandidate, 'removedSteps' | 'steps'> & {
952
+ removedStepLabels: string[];
953
+ removedStepSummaries: string[];
954
+ replay: BrowserScenarioReplay;
955
+ stepLabels: string[];
956
+ stepSummaries: string[];
957
+ };
958
+ /** Serialized scenario step used for replay artifacts. */
959
+ type BrowserScenarioReplayStep = {
960
+ iteration?: number;
961
+ kind: BrowserScenarioStep['kind'];
962
+ label: string;
963
+ replayable: true;
964
+ summary: string;
965
+ value: BrowserScenarioStep;
966
+ warmLoop?: string;
967
+ };
968
+ /** Replay artifact for reproducing a browser scenario. */
969
+ type BrowserScenarioReplay = {
970
+ replayable: true;
971
+ steps: BrowserScenarioReplayStep[];
972
+ };
973
+ /** Options for one serializable internal-control fill step. */
974
+ type BrowserFillStepOptions = {
975
+ label?: string;
976
+ target: string;
977
+ value: string;
978
+ };
979
+ /** Explicitly non-replayable result from an imperative browser experiment. */
980
+ type BrowserImperativeScenarioResult = Readonly<{
981
+ kind: 'imperative-scenario';
982
+ name: string;
983
+ reducible: false;
984
+ releaseGateCapable: false;
985
+ replayable: false;
986
+ steps: readonly BrowserTraceEntry[];
987
+ }>;
988
+ /** Controlled executor exposed inside an imperative browser experiment. */
989
+ type BrowserImperativeScenarioContext = Readonly<{
990
+ step: (label: string, action: () => Promise<void> | void) => Promise<void>;
991
+ }>;
992
+ /** Options for navigation-plus-typing gauntlet generation. */
993
+ type BrowserNavigationTypingGauntletOptions = {
994
+ insertedText: string;
995
+ movedSelection: SelectionSnapshot;
996
+ startSelection: SelectionSnapshot;
997
+ textAfterInsert: string;
998
+ };
999
+ /** Options for clipboard paste gauntlet generation. */
1000
+ type BrowserClipboardPasteGauntletOptions = {
1001
+ html: string;
1002
+ plainText?: string;
1003
+ textAfterPaste: string;
1004
+ };
1005
+ /** Options for drag/drop data gauntlet generation. */
1006
+ type BrowserDropDataGauntletOptions = {
1007
+ html: string;
1008
+ plainText?: string;
1009
+ textAfterDrop: string;
1010
+ };
1011
+ /** Options for inline cut-and-type gauntlet generation. */
1012
+ type BrowserInlineCutTypingGauntletOptions = {
1013
+ domShape?: {
1014
+ afterCut?: RenderedDOMShapeExpectation;
1015
+ afterTyping?: RenderedDOMShapeExpectation;
1016
+ };
1017
+ replacementText: string;
1018
+ selection: SelectionSnapshot;
1019
+ textAfterTyping: string;
1020
+ };
1021
+ /** Options for internal native-control gauntlet generation. */
1022
+ type BrowserInternalControlGauntletOptions = {
1023
+ controlSelector: string;
1024
+ controlValue: string;
1025
+ followUpText: string;
1026
+ outerSelection: SelectionSnapshot;
1027
+ textAfterFollowUp: string;
1028
+ };
1029
+ /** Options for composition/IME gauntlet generation. */
1030
+ type BrowserCompositionGauntletOptions = {
1031
+ committedText?: string;
1032
+ selection?: SelectionSnapshot;
1033
+ steps?: readonly string[];
1034
+ text: string;
1035
+ textAfterComposition: string;
1036
+ transport?: 'native' | 'synthetic';
1037
+ };
1038
+ /** Options for text insertion gauntlet generation. */
1039
+ type BrowserTextInsertionGauntletOptions = {
1040
+ insertedText: string;
1041
+ textAfterInsert: string;
1042
+ };
1043
+ /** Options for shell activation gauntlet generation. */
1044
+ type BrowserShellActivationGauntletOptions = {
1045
+ buttonName: string;
1046
+ expectedSelection: SelectionSnapshotExpectation;
1047
+ };
1048
+ /** Options for mark typing gauntlet generation. */
1049
+ type BrowserMarkTypingGauntletOptions = {
1050
+ hotkey: string;
1051
+ insertedText: string;
1052
+ selection: SelectionSnapshot;
1053
+ textAfterInsert: string;
1054
+ };
1055
+ /** Options for mark-click typing gauntlet generation. */
1056
+ type BrowserMarkClickTypingGauntletOptions = {
1057
+ clickPoint: SelectionPoint;
1058
+ domCaretAfterInsert?: {
1059
+ offset: number;
1060
+ text: string;
1061
+ };
1062
+ hotkey: string;
1063
+ insertedText: string;
1064
+ markSelection: SelectionSnapshot;
1065
+ selectionAfterInsert?: SelectionSnapshotExpectation;
1066
+ selectionTransport?: 'dom' | 'model';
1067
+ textAfterInsert: string;
1068
+ };
1069
+ /** Options for toolbar mark-click typing gauntlet generation. */
1070
+ type BrowserToolbarMarkClickTypingGauntletOptions = Omit<BrowserMarkClickTypingGauntletOptions, 'hotkey'> & {
1071
+ markButtonTestId: string;
1072
+ selectionTransport?: 'dom' | 'model';
1073
+ };
1074
+ /** Options for repeating warm-up scenario steps. */
1075
+ /** Options for warm-loop browser behavior packets. */
1076
+ type BrowserWarmLoopOptions = {
1077
+ createIteration: (iteration: number) => BrowserScenarioStep[];
1078
+ iterations?: number;
1079
+ label?: string;
1080
+ };
1081
+ type BrowserWarmToolbarArrowIterationOverride = Partial<Pick<BrowserWarmToolbarArrowGauntletOptions, 'markDOMSelection' | 'markSelection' | 'selectionAfterArrowLeft' | 'selectionAfterCollapse'>>;
1082
+ /** Options for warm toolbar-arrow gauntlet generation. */
1083
+ type BrowserWarmToolbarArrowGauntletOptions = {
1084
+ domCaretAfterInsert?: {
1085
+ offset: number;
1086
+ text: string;
1087
+ };
1088
+ insertedText: string;
1089
+ markDOMSelection: DOMSelectionSnapshotExpectation;
1090
+ markButtonTestId: string;
1091
+ markSelection: SelectionSnapshot;
1092
+ selectedText: string;
1093
+ selectionAfterArrowLeft: SelectionSnapshotExpectation;
1094
+ selectionAfterCollapse: SelectionSnapshotExpectation;
1095
+ selectionAfterInsert: SelectionSnapshotExpectation;
1096
+ textAfterInsert: string;
1097
+ warmIterationOverrides?: readonly BrowserWarmToolbarArrowIterationOverride[];
1098
+ warmIterations?: number;
1099
+ };
1100
+ /** Options for mixed editing conformance gauntlet generation. */
1101
+ type BrowserMixedEditingConformanceGauntletOptions = {
1102
+ deleteKey: 'Backspace' | 'Delete';
1103
+ domCaretAfterDelete?: {
1104
+ offset: number;
1105
+ text: string;
1106
+ };
1107
+ domCaretAfterFollowUp?: {
1108
+ offset: number;
1109
+ text: string;
1110
+ };
1111
+ domShape?: {
1112
+ afterDelete?: RenderedDOMShapeExpectation;
1113
+ afterFollowUp?: RenderedDOMShapeExpectation;
1114
+ afterInsert?: RenderedDOMShapeExpectation;
1115
+ };
1116
+ insertedText: string;
1117
+ navigationKeys: readonly string[];
1118
+ selectionAfterDelete: SelectionSnapshotExpectation;
1119
+ selectionAfterFollowUp: SelectionSnapshotExpectation;
1120
+ selectionAfterInsert: SelectionSnapshotExpectation;
1121
+ selectionAfterNavigation: SelectionSnapshotExpectation;
1122
+ startSelection: SelectionSnapshot;
1123
+ textAfterDelete: string;
1124
+ textAfterFollowUp: string;
1125
+ textAfterInsert: string;
1126
+ toolbarButtonTestId: string;
1127
+ toolbarSelection: SelectionSnapshot;
1128
+ toolbarSelectionAfterCommand: SelectionSnapshotExpectation;
1129
+ };
1130
+ /** Options for destructive editing gauntlet generation. */
1131
+ type BrowserDestructiveEditingGauntletOptions = {
1132
+ deleteAfterPasteKey?: 'Backspace' | 'Delete';
1133
+ domShape?: {
1134
+ afterDeleteAfterPaste?: RenderedDOMShapeExpectation;
1135
+ afterFollowUp?: RenderedDOMShapeExpectation;
1136
+ afterPaste?: RenderedDOMShapeExpectation;
1137
+ afterWordDeleteFollowUp?: RenderedDOMShapeExpectation;
1138
+ afterWordDeleteIterations?: readonly RenderedDOMShapeExpectation[];
1139
+ };
1140
+ followUpText: string;
1141
+ pasteSelection: SelectionSnapshot;
1142
+ pastedText: string;
1143
+ selectionAfterDeleteAfterPaste?: SelectionSnapshotExpectation;
1144
+ selectionAfterFollowUp?: SelectionSnapshotExpectation;
1145
+ selectionAfterPaste?: SelectionSnapshotExpectation;
1146
+ tailBlockTextsAfterWordDelete: readonly string[];
1147
+ textAfterDeleteAfterPaste: string;
1148
+ textAfterFollowUp: string;
1149
+ textAfterPaste: string;
1150
+ wordDeleteIterations?: number;
1151
+ wordDeleteKey?: string;
1152
+ wordDeleteSelection: SelectionSnapshot;
1153
+ };
1154
+ /** Options for semantic editing conformance gauntlet generation. */
1155
+ type BrowserSemanticEditingConformanceGauntletOptions = {
1156
+ insertedText: string;
1157
+ selectionAfterDelete: SelectionSnapshotExpectation;
1158
+ selectionAfterFollowUp: SelectionSnapshotExpectation;
1159
+ selectionAfterInsert: SelectionSnapshotExpectation;
1160
+ startSelection: SelectionSnapshot;
1161
+ textAfterDelete: string;
1162
+ textAfterFollowUp: string;
1163
+ textAfterInsert: string;
1164
+ toolbarButtonTestId: string;
1165
+ toolbarSelection: SelectionSnapshot;
1166
+ toolbarSelectionAfterCommand: SelectionSnapshotExpectation;
1167
+ };
1168
+ /** Illegal kernel transition reported by kernel trace validation. */
1169
+ type BrowserIllegalKernelTransition = {
1170
+ label: string;
1171
+ reason: string | null;
1172
+ stepIndex: number | null;
1173
+ };
1174
+ /** Playwright helper bundle for opening routes and inspecting editors. */
1175
+ /** Browser editor harness returned by `createBrowserEditorHarness`. */
1176
+ type BrowserEditorHarness = {
1177
+ name: string;
1178
+ page: Page;
1179
+ root: Locator;
1180
+ rootAt: (selector: string) => BrowserEditorHarness;
1181
+ get: {
1182
+ modelText: () => Promise<string>;
1183
+ modelBlockText: (index: number) => Promise<string | null>;
1184
+ modelBlockTexts: () => Promise<string[]>;
1185
+ modelValue: () => Promise<unknown>;
1186
+ text: () => Promise<string>;
1187
+ blockTexts: () => Promise<string[]>;
1188
+ renderedDOMShape: () => Promise<RenderedBlockDOMShapeSnapshot[]>;
1189
+ selectedText: () => Promise<string>;
1190
+ displayedSelection: () => Promise<BrowserDisplayedSelectionSnapshot>;
1191
+ html: () => Promise<string>;
1192
+ selection: () => Promise<SelectionSnapshot | null>;
1193
+ domSelection: () => Promise<DOMSelectionSnapshot | null>;
1194
+ focusOwner: () => Promise<FocusOwnerSnapshot>;
1195
+ kernelTrace: () => Promise<BrowserKernelTraceEntry[]>;
1196
+ history: () => Promise<unknown>;
1197
+ lastCommit: () => Promise<unknown>;
1198
+ placeholderShape: (selector?: string) => Promise<PlaceholderShape | null>;
1199
+ };
1200
+ selection: {
1201
+ select: (selection: SelectionSnapshot) => Promise<void>;
1202
+ selectDOM: (selection: SelectionSnapshot) => Promise<void>;
1203
+ dragTextRange: (options: BrowserDragTextRangeOptions) => Promise<void>;
1204
+ doubleClickDragTextRange: (options: BrowserDoubleClickDragTextRangeOptions) => Promise<void>;
1205
+ collapse: (point: SelectionPoint) => Promise<void>;
1206
+ anchor: (options?: SelectionCaptureOptions) => Promise<SelectionAnchorHandle>;
1207
+ resolve: (handle: SelectionAnchorHandle) => Promise<SelectionSnapshot | null>;
1208
+ restore: (handle: SelectionAnchorHandle) => Promise<void>;
1209
+ release: (handle: SelectionAnchorHandle) => Promise<SelectionSnapshot | null>;
1210
+ selectAll: () => Promise<void>;
1211
+ get: () => Promise<SelectionSnapshot | null>;
1212
+ displayed: () => Promise<BrowserDisplayedSelectionSnapshot>;
1213
+ dom: () => Promise<DOMSelectionSnapshot | null>;
1214
+ location: () => Promise<DOMSelectionLocationSnapshot | null>;
1215
+ importDOM: () => Promise<SelectionSnapshot | null>;
1216
+ rect: () => Promise<SelectionRectSnapshot | null>;
1217
+ };
1218
+ dom: {
1219
+ clickTextOffset: (options: BrowserTextOffsetClickOptions) => Promise<void>;
1220
+ clickTextRange: (options: BrowserTextPathRangeClickOptions) => Promise<void>;
1221
+ collapseAtTextPath: (point: SelectionPoint, options?: BrowserDOMPathOptions) => Promise<void>;
1222
+ waitForPendingNativeTextInputRepair: (options?: {
1223
+ timeoutMs?: number;
1224
+ }) => Promise<void>;
1225
+ waitForTextPath: (path: number[], options?: BrowserDOMPathOptions) => Promise<void>;
1226
+ };
1227
+ locator: {
1228
+ block: (path: number[]) => Locator;
1229
+ text: (path: number[]) => Locator;
1230
+ };
1231
+ ready: (options: ReadyOptions) => Promise<void>;
1232
+ snapshot: () => Promise<EditorSnapshot>;
1233
+ focus: () => Promise<void>;
1234
+ click: () => Promise<void>;
1235
+ type: (text: string) => Promise<void>;
1236
+ press: (key: string) => Promise<void>;
1237
+ insertText: (text: string) => Promise<void>;
1238
+ insertBreak: () => Promise<void>;
1239
+ deleteFragment: () => Promise<void>;
1240
+ deleteBackward: () => Promise<void>;
1241
+ deleteForward: () => Promise<void>;
1242
+ undo: () => Promise<void>;
1243
+ redo: () => Promise<void>;
1244
+ selectAll: () => Promise<void>;
1245
+ assert: {
1246
+ text: (text: RegExp | string) => Promise<void>;
1247
+ modelBlockText: (index: number, text: string | null) => Promise<void>;
1248
+ modelBlockTexts: (texts: string[]) => Promise<void>;
1249
+ blockTexts: (texts: string[]) => Promise<void>;
1250
+ html: (expectedHtml: string, options?: HtmlNormalizationOptions) => Promise<void>;
1251
+ htmlContains: (expectedFragment: string) => Promise<void>;
1252
+ htmlEquals: (expectedHtml: string, options?: HtmlNormalizationOptions) => Promise<void>;
1253
+ focusOwner: (expected: FocusOwnerSnapshot['kind']) => Promise<void>;
1254
+ kernelTrace: (expected: BrowserKernelTraceExpectation) => Promise<void>;
1255
+ selection: (expected: SelectionSnapshotExpectation) => Promise<void>;
1256
+ collapsedModelDOMSelection: (expected: CollapsedModelDOMSelectionExpectation) => Promise<void>;
1257
+ noDoubleSelectionHighlight: () => Promise<void>;
1258
+ caretVisibleInScrollableParent: () => Promise<void>;
1259
+ noVisibleCaretInRoot: () => Promise<void>;
1260
+ domSelection: (expected: DOMSelectionSnapshotExpectation) => Promise<void>;
1261
+ domCaret: (expected: {
1262
+ offset: number;
1263
+ text: string;
1264
+ }) => Promise<void>;
1265
+ domSelectionTarget: (expected: Partial<DOMSelectionLocationSnapshot>) => Promise<void>;
1266
+ noUnexpectedZeroWidthBreaks: (blockIndex?: number) => Promise<void>;
1267
+ placeholderShape: (expected: PlaceholderShape, selector?: string) => Promise<void>;
1268
+ placeholderVisible: (visible?: boolean) => Promise<void>;
1269
+ renderedBlockText: (blockIndex: number, text: string) => Promise<void>;
1270
+ renderedDOMShape: (expected: RenderedDOMShapeExpectation) => Promise<void>;
1271
+ };
1272
+ clipboard: {
1273
+ copy: () => Promise<void>;
1274
+ copyEventPayload: () => Promise<ClipboardPayloadSnapshot>;
1275
+ copyNativeEventPayload: () => Promise<ClipboardPayloadSnapshot>;
1276
+ cutEventPayload: () => Promise<ClipboardPayloadSnapshot>;
1277
+ cutNativeEventPayload: () => Promise<ClipboardPayloadSnapshot>;
1278
+ copyPayload: () => Promise<ClipboardPayloadSnapshot>;
1279
+ readText: () => Promise<string>;
1280
+ readHtml: () => Promise<string | null>;
1281
+ pasteEventPayload: (payload: {
1282
+ html?: string | null;
1283
+ fragment?: string | null;
1284
+ text: string;
1285
+ }) => Promise<void>;
1286
+ pasteNativeText: (text: string) => Promise<void>;
1287
+ /**
1288
+ * Paste through the project's `clipboardTransport`, failing when no paste
1289
+ * commit that changes the document follows or the page throws during it,
1290
+ * so a paste the editor refuses fails; send that one through
1291
+ * `pasteEventPayload`. Clears the kernel trace first, so the trace
1292
+ * afterwards holds only this paste.
1293
+ */
1294
+ pasteText: (text: string) => Promise<void>;
1295
+ /** Paste HTML like `pasteText`, with `plainText` as the text flavor. */
1296
+ pasteHtml: (html: string, plainText?: string) => Promise<void>;
1297
+ assert: {
1298
+ textContains: (expected: string) => Promise<void>;
1299
+ htmlContains: (expected: string) => Promise<void>;
1300
+ htmlEquals: (expected: string) => Promise<void>;
1301
+ types: (expected: string[]) => Promise<void>;
1302
+ };
1303
+ };
1304
+ ime: {
1305
+ enableKeyEvents: () => Promise<void>;
1306
+ startSynthetic: (options?: {
1307
+ text?: string;
1308
+ }) => Promise<void>;
1309
+ updateSynthetic: (options: {
1310
+ text: string;
1311
+ }) => Promise<void>;
1312
+ commitSynthetic: (options: {
1313
+ text: string;
1314
+ }) => Promise<void>;
1315
+ compose: (options: {
1316
+ text: string;
1317
+ steps?: readonly string[];
1318
+ committedText?: string;
1319
+ transport?: 'native' | 'preedit' | 'synthetic';
1320
+ }) => Promise<void>;
1321
+ composeDirect: (options: {
1322
+ text: string;
1323
+ }) => Promise<void>;
1324
+ };
1325
+ scenario: {
1326
+ /** Run arbitrary browser work with editor-scoped trace snapshots. */
1327
+ runImperative: (name: string, run: (context: BrowserImperativeScenarioContext) => Promise<void> | void) => Promise<BrowserImperativeScenarioResult>;
1328
+ run: (name: string, steps: readonly BrowserScenarioStep[], options?: BrowserScenarioRunOptions) => Promise<BrowserScenarioResult>;
1329
+ };
1330
+ trace: {
1331
+ snapshot: (label: string, stepIndex?: number | null) => Promise<BrowserTraceEntry>;
1332
+ };
1333
+ };
1334
+ /** Contract expectation for model, DOM, native, and visual selection proof. */
1335
+ /** Expected selection state for `assertBrowserSelectionContract`. */
1336
+ type BrowserSelectionContractExpectation = AtLeastOne<{
1337
+ domSelection?: DOMSelectionSnapshotExpectation;
1338
+ domSelectionTarget?: DOMSelectionLocationExpectation;
1339
+ hasVisibleEditorSelection?: boolean;
1340
+ hasVisibleSelection?: boolean;
1341
+ noDoubleSelectionHighlight?: true;
1342
+ selectedText?: string;
1343
+ selection?: SelectionSnapshotExpectation;
1344
+ }>;
1345
+ //#endregion
1346
+ //#region src/playwright/surface.d.ts
1347
+ type SurfaceTarget = Page | Frame;
1348
+ //#endregion
1349
+ //#region src/playwright/artifacts.d.ts
1350
+ /** Screenshot options accepted by editor browser screenshot helpers. */
1351
+ type BrowserPageScreenshotOptions = Omit<NonNullable<Parameters<Page['screenshot']>[0]>, 'path'>;
1352
+ /**
1353
+ * Capture a Playwright page screenshot into the current test output directory
1354
+ * and attach it to the test report.
1355
+ */
1356
+ declare const attachPageScreenshot: (page: Page, testInfo: TestInfo, name: string, options?: BrowserPageScreenshotOptions) => Promise<string>;
1357
+ /**
1358
+ * Attach a focused editor selection screenshot to the current test report.
1359
+ */
1360
+ declare const attachBrowserSelectionScreenshot: (editor: BrowserEditorHarness, testInfo: TestInfo, name: string, options?: BrowserPageScreenshotOptions) => Promise<string>;
1361
+ /**
1362
+ * Write a JSON proof artifact into the current test output directory and attach
1363
+ * that file to the test report.
1364
+ */
1365
+ declare const attachBrowserJsonArtifact: (testInfo: TestInfo, name: string, value: unknown) => Promise<string>;
1366
+ //#endregion
1367
+ //#region src/playwright/caret-visibility.d.ts
1368
+ /** Snapshot used to prove caret visibility inside a scroll container. */
1369
+ /** Caret visibility evidence captured inside a scrollable parent. */
1370
+ type CaretVisibilitySnapshot = {
1371
+ activeElementTestId: string | null;
1372
+ activeElementTagName: string | null;
1373
+ anchorInRoot: boolean;
1374
+ anchorNodeText: string | null;
1375
+ focusInRoot: boolean;
1376
+ hasSelection: boolean;
1377
+ parentRect: {
1378
+ bottom: number;
1379
+ top: number;
1380
+ } | null;
1381
+ rangeCount: number;
1382
+ rootContainsActiveElement: boolean;
1383
+ scrollParentTagName: string | null;
1384
+ textHostText: string | null;
1385
+ visible: boolean;
1386
+ visibleRect: {
1387
+ bottom: number;
1388
+ height: number;
1389
+ top: number;
1390
+ width: number;
1391
+ } | null;
1392
+ };
1393
+ /** Assert the caret is visible inside its scrollable ancestor. */
1394
+ declare const assertBrowserCaretVisibleInScrollableParent: (editor: BrowserEditorHarness) => Promise<void>;
1395
+ //#endregion
1396
+ //#region src/playwright/clipboard.d.ts
1397
+ /** Run a callback while holding the shared clipboard access lock. */
1398
+ declare const withExclusiveClipboardAccess: <T>(work: () => Promise<T> | T) => Promise<T>;
1399
+ //#endregion
1400
+ //#region src/playwright/displayed-selection.d.ts
1401
+ /** Capture displayed selection overlays for one editor root. */
1402
+ declare const takeDisplayedSelectionSnapshotForRoot: (root: Locator) => Promise<BrowserDisplayedSelectionSnapshot>;
1403
+ //#endregion
1404
+ //#region src/playwright/dom-locators.d.ts
1405
+ /** Locate the first editor root for a Playwright page or frame surface. */
1406
+ declare const getBrowserEditable: (surface: SurfaceTarget, options?: EditorSurfaceOptions) => Locator;
1407
+ /** Locate a rendered block element by editor model path. */
1408
+ declare const locateBrowserBlock: (root: Locator, path: number[]) => Locator;
1409
+ /** Locate a rendered text element by editor model path. */
1410
+ declare const locateBrowserText: (root: Locator, path: number[]) => Locator;
1411
+ //#endregion
1412
+ //#region src/playwright/native-event-trace.d.ts
1413
+ /** Start native event tracing for a editor browser root. */
1414
+ declare const startBrowserNativeEventTrace: (root: Locator, options?: BrowserNativeEventTraceOptions) => Promise<void>;
1415
+ /** Clear the current native event trace for a editor browser root. */
1416
+ declare const resetBrowserNativeEventTrace: (root: Locator) => Promise<void>;
1417
+ /** Stop native event tracing for a editor browser root. */
1418
+ declare const stopBrowserNativeEventTrace: (root: Locator) => Promise<void>;
1419
+ /** Read the native event trace captured for a editor browser root. */
1420
+ declare const takeBrowserNativeEventTrace: (root: Locator) => Promise<BrowserNativeEventTraceSnapshot>;
1421
+ //#endregion
1422
+ //#region src/playwright/interaction-performance.d.ts
1423
+ /** One trusted printable-key timing row captured from the editable root. */
1424
+ type TrustedTypingRow = {
1425
+ beforeInput?: number;
1426
+ beforeInputDataMatched?: boolean;
1427
+ domReady?: number;
1428
+ domSelectionInsertionMatched?: boolean;
1429
+ domTextInsertionMatched?: boolean;
1430
+ input?: number;
1431
+ inputDataMatched?: boolean;
1432
+ inputOwnership?: string;
1433
+ key: string;
1434
+ keydown: number;
1435
+ modelSelectionMatched?: boolean;
1436
+ modelTextInsertionMatched?: boolean;
1437
+ nativeTargetRangeMatched?: boolean;
1438
+ offset?: number;
1439
+ paint?: number;
1440
+ path?: number[];
1441
+ root?: string;
1442
+ runtimeTargetMatched?: boolean;
1443
+ trustedBeforeInput?: boolean;
1444
+ trustedInput?: boolean;
1445
+ trustedKey: boolean;
1446
+ };
1447
+ /** Trusted typing rows and long tasks captured during one measured burst. */
1448
+ type TrustedTypingResult = {
1449
+ longTasks: number[];
1450
+ longTasksSupported: boolean;
1451
+ rows: TrustedTypingRow[];
1452
+ };
1453
+ /** Measure trusted keydown, exact DOM readiness, paint, and long tasks. */
1454
+ declare const measureTrustedTyping: ({ delay, page, root, text }: {
1455
+ delay?: number;
1456
+ page: Page;
1457
+ root: Locator;
1458
+ text: string;
1459
+ }) => Promise<TrustedTypingResult>;
1460
+ //#endregion
1461
+ //#region src/playwright/render-state.d.ts
1462
+ /** Capture editor render state, selected shells, and selection shells. */
1463
+ declare const takeBrowserRenderStateSnapshot: (editor: BrowserEditorHarness) => Promise<BrowserRenderStateSnapshot>;
1464
+ //#endregion
1465
+ //#region src/playwright/test.d.ts
1466
+ /**
1467
+ * Playwright's `test` for editor specs. When a test fails or times out and
1468
+ * `test.fail()` did not expect that outcome, its output folder also holds
1469
+ * `editor-state.json`: every editor on every page and frame of every context
1470
+ * of the test's browser, read after the test's afterEach hooks and before
1471
+ * Playwright closes its context.
1472
+ */
1473
+ declare const test: TestType<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
1474
+ //#endregion
1475
+ //#region src/playwright/runtime-errors.d.ts
1476
+ /** The console error texts `recordBrowserRuntimeErrors` records by default. */
1477
+ declare const DEFAULT_RUNTIME_ERROR_PATTERNS: readonly string[];
1478
+ /** Recorder returned by runtime-error capture helpers. */
1479
+ type BrowserRuntimeErrorRecorder = {
1480
+ assertNone: () => void;
1481
+ errors: string[];
1482
+ reset: () => void;
1483
+ stop: () => void;
1484
+ };
1485
+ /** Start recording browser runtime errors for a Playwright page. */
1486
+ declare const recordBrowserRuntimeErrors: (page: Page, options?: {
1487
+ patterns?: readonly string[];
1488
+ /** Capture every console/page error, including otherwise ignored errors. */
1489
+ strict?: boolean;
1490
+ }) => BrowserRuntimeErrorRecorder;
1491
+ //#endregion
1492
+ //#region src/playwright/scenario.d.ts
1493
+ /** Frozen constructors for canonical serializable browser steps. */
1494
+ declare const browserStep: Readonly<{
1495
+ fill: ({ label, target, value }: BrowserFillStepOptions) => Extract<BrowserScenarioStep, {
1496
+ kind: 'fillControl';
1497
+ }>;
1498
+ }>;
1499
+ /** Create a scenario that mixes navigation and typing through editor content. */
1500
+ declare const createBrowserNavigationTypingGauntlet: ({ insertedText, movedSelection, startSelection, textAfterInsert }: BrowserNavigationTypingGauntletOptions) => BrowserScenarioStep[];
1501
+ /** Create a scenario that validates clipboard paste behavior. */
1502
+ declare const createBrowserClipboardPasteGauntlet: ({ html, plainText, textAfterPaste }: BrowserClipboardPasteGauntletOptions) => BrowserScenarioStep[];
1503
+ /** Create a scenario that validates drag/drop data insertion behavior. */
1504
+ declare const createBrowserDropDataGauntlet: ({ html, plainText, textAfterDrop }: BrowserDropDataGauntletOptions) => BrowserScenarioStep[];
1505
+ /** Create a scenario that validates inline cut followed by typing. */
1506
+ declare const createBrowserInlineCutTypingGauntlet: ({ domShape, replacementText, selection, textAfterTyping }: BrowserInlineCutTypingGauntletOptions) => BrowserScenarioStep[];
1507
+ /** Create a scenario for editor behavior around internal native controls. */
1508
+ declare const createBrowserInternalControlGauntlet: ({ controlSelector, controlValue, followUpText, outerSelection, textAfterFollowUp }: BrowserInternalControlGauntletOptions) => BrowserScenarioStep[];
1509
+ /** Create a scenario that validates composition/IME input behavior. */
1510
+ declare const createBrowserCompositionGauntlet: ({ committedText, selection, steps, text, textAfterComposition, transport }: BrowserCompositionGauntletOptions) => BrowserScenarioStep[];
1511
+ /** Create a scenario for plain text insertion behavior. */
1512
+ declare const createBrowserTextInsertionGauntlet: ({ insertedText, textAfterInsert }: BrowserTextInsertionGauntletOptions) => BrowserScenarioStep[];
1513
+ /** Create a scenario for shell activation and editor focus ownership. */
1514
+ declare const createBrowserShellActivationGauntlet: ({ buttonName, expectedSelection }: BrowserShellActivationGauntletOptions) => BrowserScenarioStep[];
1515
+ /** Create a scenario that validates mark toggling followed by typing. */
1516
+ declare const createBrowserMarkTypingGauntlet: ({ hotkey, insertedText, selection, textAfterInsert }: BrowserMarkTypingGauntletOptions) => BrowserScenarioStep[];
1517
+ /** Create a scenario that validates mark toolbar clicks followed by typing. */
1518
+ declare const createBrowserMarkClickTypingGauntlet: ({ clickPoint, domCaretAfterInsert, hotkey, insertedText, markSelection, selectionAfterInsert, selectionTransport, textAfterInsert }: BrowserMarkClickTypingGauntletOptions) => BrowserScenarioStep[];
1519
+ /** Create a scenario that validates toolbar mark clicks and editor typing. */
1520
+ declare const createBrowserToolbarMarkClickTypingGauntlet: ({ clickPoint, domCaretAfterInsert, insertedText, markButtonTestId, markSelection, selectionTransport, selectionAfterInsert, textAfterInsert }: BrowserToolbarMarkClickTypingGauntletOptions) => BrowserScenarioStep[];
1521
+ //#endregion
1522
+ //#region src/playwright/scenario-conformance.d.ts
1523
+ /** Create a mixed editing conformance scenario across text and structure. */
1524
+ declare const createBrowserMixedEditingConformanceGauntlet: ({ deleteKey, domCaretAfterDelete, domCaretAfterFollowUp, domShape, insertedText, navigationKeys, selectionAfterDelete, selectionAfterFollowUp, selectionAfterInsert, selectionAfterNavigation, startSelection, textAfterDelete, textAfterFollowUp, textAfterInsert, toolbarButtonTestId, toolbarSelection, toolbarSelectionAfterCommand }: BrowserMixedEditingConformanceGauntletOptions) => BrowserScenarioStep[];
1525
+ /** Create a semantic editing conformance scenario. */
1526
+ declare const createBrowserSemanticEditingConformanceGauntlet: ({ insertedText, selectionAfterDelete, selectionAfterFollowUp, selectionAfterInsert, startSelection, textAfterDelete, textAfterFollowUp, textAfterInsert, toolbarButtonTestId, toolbarSelection, toolbarSelectionAfterCommand }: BrowserSemanticEditingConformanceGauntletOptions) => BrowserScenarioStep[];
1527
+ //#endregion
1528
+ //#region src/playwright/scenario-destructive.d.ts
1529
+ /** Create a destructive editing conformance scenario. */
1530
+ declare const createBrowserDestructiveEditingGauntlet: ({ deleteAfterPasteKey, domShape, followUpText, pasteSelection, pastedText, selectionAfterDeleteAfterPaste, selectionAfterFollowUp, selectionAfterPaste, tailBlockTextsAfterWordDelete, textAfterDeleteAfterPaste, textAfterFollowUp, textAfterPaste, wordDeleteIterations, wordDeleteKey, wordDeleteSelection }: BrowserDestructiveEditingGauntletOptions) => BrowserScenarioStep[];
1531
+ //#endregion
1532
+ //#region src/playwright/scenario-kernel-trace.d.ts
1533
+ /** Return kernel trace transitions that violate the expected policy. */
1534
+ declare const getIllegalKernelTransitions: (result: BrowserScenarioResult) => BrowserIllegalKernelTransition[];
1535
+ /** Assert that a kernel trace contains no illegal transitions. */
1536
+ declare const assertNoIllegalKernelTransitions: (result: BrowserScenarioResult) => void;
1537
+ /** Return true when a kernel trace entry satisfies an expectation. */
1538
+ declare const matchesBrowserKernelTrace: (entry: BrowserKernelTraceEntry, expected: BrowserKernelTraceExpectation) => boolean;
1539
+ /** Find the first kernel trace entry matching an expectation. */
1540
+ declare const findBrowserKernelTraceEntry: (trace: readonly BrowserKernelTraceEntry[], expected: BrowserKernelTraceExpectation) => BrowserKernelTraceEntry | undefined;
1541
+ /** Assert that a kernel trace contains an expected entry. */
1542
+ declare const assertBrowserKernelTraceEntry: (trace: readonly BrowserKernelTraceEntry[], expected: BrowserKernelTraceExpectation) => BrowserKernelTraceEntry;
1543
+ //#endregion
1544
+ //#region src/playwright/scenario-replay.d.ts
1545
+ /** Create candidate reduced scenarios from a failing scenario result. */
1546
+ declare const createScenarioReductionCandidates: (steps: readonly BrowserScenarioStep[]) => BrowserScenarioReductionCandidate[];
1547
+ /** Summarize a scenario step for logs and reduction output. */
1548
+ declare const summarizeScenarioStep: (step: BrowserScenarioStep, index: number) => string;
1549
+ /** Serialize a scenario step into a replayable description. */
1550
+ declare const serializeScenarioStepForReplay: (step: BrowserScenarioStep, index: number) => BrowserScenarioReplayStep;
1551
+ /** Decode and validate a canonical JSON scenario replay artifact. */
1552
+ declare const decodeScenarioReplay: (value: unknown) => BrowserScenarioReplay;
1553
+ /** Create a replay artifact from scenario metadata and steps. */
1554
+ declare const createScenarioReplay: (steps: readonly BrowserScenarioStep[]) => BrowserScenarioReplay;
1555
+ /** Summarize a scenario reduction candidate for handoff output. */
1556
+ declare const summarizeScenarioReductionCandidate: ({ kind, label, removedSteps, removedRange, steps }: BrowserScenarioReductionCandidate) => BrowserScenarioReductionCandidateSummary;
1557
+ /** Normalize scenario metadata with defaults for transport and labels. */
1558
+ declare const normalizeScenarioMetadata: (metadata?: BrowserScenarioMetadata) => BrowserNormalizedScenarioMetadata;
1559
+ /** Classify the proof strength of a scenario transport claim. */
1560
+ declare const classifyScenarioTransportClaim: ({ platform, transport }: BrowserScenarioMetadata) => BrowserTransportClaim;
1561
+ //#endregion
1562
+ //#region src/playwright/scenario-warm.d.ts
1563
+ /** Create repeated warm-up steps for a scenario packet. */
1564
+ declare const createBrowserWarmLoopSteps: ({ createIteration, iterations, label }: BrowserWarmLoopOptions) => BrowserScenarioStep[];
1565
+ /** Create a warm toolbar and arrow-navigation scenario. */
1566
+ declare const createBrowserWarmToolbarArrowGauntlet: ({ domCaretAfterInsert, insertedText, markDOMSelection, markButtonTestId, markSelection, selectedText, selectionAfterArrowLeft, selectionAfterCollapse, selectionAfterInsert, textAfterInsert, warmIterationOverrides, warmIterations }: BrowserWarmToolbarArrowGauntletOptions) => BrowserScenarioStep[];
1567
+ //#endregion
1568
+ //#region src/playwright/selectionContract.d.ts
1569
+ /** Assert model, DOM, native, and visual selection expectations. */
1570
+ declare const assertBrowserSelectionContract: (harness: BrowserEditorHarness, expected: BrowserSelectionContractExpectation) => Promise<void>;
1571
+ //#endregion
1572
+ //#region src/playwright/selection-snapshots.d.ts
1573
+ /** Capture the current DOM selection from a Playwright page. */
1574
+ declare const takeDOMSelectionSnapshot: (page: Page) => Promise<DOMSelectionSnapshot | null>;
1575
+ /** Capture the current editor model selection from a Playwright page. */
1576
+ declare const takeSelectionSnapshot: (page: Page) => Promise<SelectionSnapshot | null>;
1577
+ //#endregion
1578
+ //#region src/playwright/index.d.ts
1579
+ /** Create a Playwright harness for opening examples and inspecting editors. */
1580
+ declare const createBrowserEditorHarness: (page: Page, name: string, root: Locator, surface?: SurfaceTarget) => BrowserEditorHarness;
1581
+ /** Open a editor example route with default harness options. */
1582
+ declare const openExample: (page: Page, name: string, options?: OpenExampleOptions) => Promise<BrowserEditorHarness>;
1583
+ /** Open a editor example route with explicit harness options. */
1584
+ declare const openExampleWithOptions: (page: Page, name: string, { query, ready, surface }: OpenExampleOptions) => Promise<BrowserEditorHarness>;
1585
+ //#endregion
1586
+ export { BROWSER_HANDLE_KEY, type BrowserClipboardPasteGauntletOptions, type BrowserClipboardTransport, type BrowserCompositionGauntletOptions, type BrowserDOMPathOptions, type BrowserDestructiveEditingGauntletOptions, type BrowserDisplayedSelectionSnapshot, type BrowserDoubleClickDragTextRangeOptions, type BrowserDragTextRangeOptions, type BrowserDropDataGauntletOptions, type BrowserEditorHarness, type BrowserFeatureContractDefinition, type BrowserFeatureContractRegistry, type BrowserFeatureContractRow, type BrowserFillStepOptions, type BrowserIllegalKernelTransition, type BrowserImperativeScenarioContext, type BrowserImperativeScenarioResult, type BrowserInlineCutTypingGauntletOptions, type BrowserInternalControlGauntletOptions, type BrowserKernelCommand, type BrowserKernelCommandDefinition, type BrowserKernelEventFamily, type BrowserKernelEventFrame, type BrowserKernelInputIntent, type BrowserKernelMovementOwnershipTrace, type BrowserKernelOwnership, type BrowserKernelRepairPolicy, type BrowserKernelRepairRequest, type BrowserKernelSelectionChangeOrigin, type BrowserKernelSelectionPolicy, type BrowserKernelSelectionSource, type BrowserKernelSelectionSourceTransition, type BrowserKernelState, type BrowserKernelTargetOwner, type BrowserKernelTraceEntry, type BrowserKernelTraceExpectation, type BrowserKernelTransition, type BrowserMarkClickTypingGauntletOptions, type BrowserMarkTypingGauntletOptions, type BrowserMixedEditingConformanceGauntletOptions, type BrowserNativeEventTraceAnomaly, type BrowserNativeEventTraceDOMDelta, type BrowserNativeEventTraceEntry, type BrowserNativeEventTraceNodeSnapshot, type BrowserNativeEventTraceOptions, type BrowserNativeEventTraceRect, type BrowserNativeEventTraceSelectionSnapshot, type BrowserNativeEventTraceSnapshot, type BrowserNativeEventTraceTargetRangeSnapshot, type BrowserNativeEventTraceTextNodeDelta, type BrowserNativeEventTraceTextNodeSnapshot, type BrowserNativeEventTraceType, type BrowserNativeSelectionSummary, type BrowserNavigationTypingGauntletOptions, type BrowserNormalizedScenarioMetadata, type BrowserNumberBudget, type BrowserPageScreenshotOptions, type BrowserRawViewSelectionOwner, type BrowserRawViewSelectionPoint, type BrowserRawViewSelectionSnapshot, type BrowserRenderStateSnapshot, type BrowserRuntimeErrorRecorder, type BrowserScenarioMetadata, type BrowserScenarioReductionCandidate, type BrowserScenarioReductionCandidateSummary, type BrowserScenarioReplay, type BrowserScenarioReplayStep, type BrowserScenarioResult, type BrowserScenarioRunOptions, type BrowserScenarioStep, type BrowserScenarioStepMetadata, type BrowserSelectedShellSnapshot, type BrowserSelectionContractExpectation, type BrowserSelectionShellsSnapshot, type BrowserSemanticEditingConformanceGauntletOptions, type BrowserShellActivationGauntletOptions, type BrowserShellSummary, type BrowserTestOptions, type BrowserTextInsertionGauntletOptions, type BrowserTextOffsetClickOptions, type BrowserTextPathRangeClickOptions, type BrowserToolbarMarkClickTypingGauntletOptions, type BrowserTraceEntry, type BrowserTransportClaim, type BrowserViewSelectionSnapshot, type BrowserWarmLoopOptions, type BrowserWarmToolbarArrowGauntletOptions, type BrowserZeroWidthNodeShape, type CaretVisibilitySnapshot, type ClipboardPayloadSnapshot, type CollapsedModelDOMSelectionExpectation, DEFAULT_RUNTIME_ERROR_PATTERNS, type DOMSelectionLocationSnapshot, type DOMSelectionSnapshot, type DOMSelectionSnapshotExpectation, type EditorSnapshot, type EditorSurfaceOptions, type FocusOwnerSnapshot, type HtmlNormalizationOptions, type OffsetExpectation, type OpenExampleOptions, type RangeAnchorAssociation, type ReactRenderKind, type ReactRenderProfilerEvent, type ReactRenderProfilerSnapshot, type ReadyOptions, type RenderedBlockDOMShapeSnapshot, type RenderedDOMShapeExpectation, type SelectionAnchorHandle, type SelectionCaptureOptions, type SelectionPoint, type SelectionRectSnapshot, type SelectionSnapshot, type SelectionSnapshotExpectation, type TrustedTypingResult, type TrustedTypingRow, assertBrowserCaretVisibleInScrollableParent, assertBrowserKernelTraceEntry, assertBrowserSelectionContract, assertNoIllegalKernelTransitions, attachBrowserJsonArtifact, attachBrowserSelectionScreenshot, attachPageScreenshot, browserStep, classifyScenarioTransportClaim, createBrowserClipboardPasteGauntlet, createBrowserCompositionGauntlet, createBrowserDestructiveEditingGauntlet, createBrowserDropDataGauntlet, createBrowserEditorHarness, createBrowserFeatureContractRegistry, createBrowserInlineCutTypingGauntlet, createBrowserInternalControlGauntlet, createBrowserMarkClickTypingGauntlet, createBrowserMarkTypingGauntlet, createBrowserMixedEditingConformanceGauntlet, createBrowserNavigationTypingGauntlet, createBrowserSemanticEditingConformanceGauntlet, createBrowserShellActivationGauntlet, createBrowserTextInsertionGauntlet, createBrowserToolbarMarkClickTypingGauntlet, createBrowserWarmLoopSteps, createBrowserWarmToolbarArrowGauntlet, createScenarioReductionCandidates, createScenarioReplay, decodeScenarioReplay, defineBrowserFeatureContract, expect, findBrowserKernelTraceEntry, getBrowserEditable, getIllegalKernelTransitions, getReactRenderProfilerSnapshot, installReactRenderProfiler, locateBrowserBlock, locateBrowserText, matchesBrowserKernelTrace, measureTrustedTyping, normalizeScenarioMetadata, openExample, openExampleWithOptions, recordBrowserRuntimeErrors, resetBrowserNativeEventTrace, resetReactRenderProfiler, serializeScenarioStepForReplay, startBrowserNativeEventTrace, stopBrowserNativeEventTrace, summarizeScenarioReductionCandidate, summarizeScenarioStep, takeBrowserNativeEventTrace, takeBrowserRenderStateSnapshot, takeDOMSelectionSnapshot, takeDisplayedSelectionSnapshotForRoot, takeSelectionSnapshot, test, withExclusiveClipboardAccess };