middlewright 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -9
- package/dist/index.d.ts +1 -1
- package/dist/plugin-system.d.ts +40 -7
- package/dist/plugin-system.js +84 -6
- package/dist/plugins/hydration-waiter.js +3 -0
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/llm-recover.js +3 -0
- package/dist/plugins/spinner-waiter.js +57 -20
- package/dist/plugins/ui-error-reporter.js +3 -0
- package/dist/plugins/video-mode.d.ts +93 -11
- package/dist/plugins/video-mode.js +1437 -93
- package/package.json +7 -3
- package/src/index.ts +3 -0
- package/src/plugin-system.ts +152 -14
- package/src/plugins/hydration-waiter.ts +4 -0
- package/src/plugins/index.ts +15 -1
- package/src/plugins/llm-recover.ts +4 -0
- package/src/plugins/spinner-waiter.ts +66 -21
- package/src/plugins/ui-error-reporter.ts +4 -0
- package/src/plugins/video-mode.ts +2021 -48
|
@@ -1,11 +1,91 @@
|
|
|
1
1
|
import type { Plugin, OverrideableMethod } from "../plugin-system.ts";
|
|
2
|
+
export type VideoModeSpan = {
|
|
3
|
+
start: number;
|
|
4
|
+
end: number;
|
|
5
|
+
};
|
|
6
|
+
export type VideoModeOutputs = {
|
|
7
|
+
player?: string;
|
|
8
|
+
raw?: string;
|
|
9
|
+
rendered?: string;
|
|
10
|
+
};
|
|
11
|
+
export type VideoModeOutputPaths = {
|
|
12
|
+
metadata: string;
|
|
13
|
+
player: string;
|
|
14
|
+
raw: string;
|
|
15
|
+
rendered: string;
|
|
16
|
+
reportPlayer: string;
|
|
17
|
+
};
|
|
18
|
+
export type VideoModeSourceRange = {
|
|
19
|
+
start?: number;
|
|
20
|
+
end?: number;
|
|
21
|
+
};
|
|
22
|
+
export type VideoModeRect = {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
};
|
|
28
|
+
export type VideoModeViewport = {
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
};
|
|
32
|
+
export type VideoModeHighlight = VideoModeSpan & {
|
|
33
|
+
actionEnd?: number;
|
|
34
|
+
color: string;
|
|
35
|
+
image?: string;
|
|
36
|
+
method?: OverrideableMethod;
|
|
37
|
+
rect: VideoModeRect;
|
|
38
|
+
thickness: number;
|
|
39
|
+
viewport: VideoModeViewport;
|
|
40
|
+
};
|
|
41
|
+
export type VideoModeMetadata = {
|
|
42
|
+
schemaVersion: 1;
|
|
43
|
+
timebase: "ms";
|
|
44
|
+
deadAir: VideoModeSpan[];
|
|
45
|
+
highlights: VideoModeHighlight[];
|
|
46
|
+
outputs: VideoModeOutputs;
|
|
47
|
+
sourceRange: VideoModeSourceRange;
|
|
48
|
+
};
|
|
49
|
+
export type VideoModeControls = {
|
|
50
|
+
/**
|
|
51
|
+
* Run invisible video bookkeeping and write the elapsed span as dead air.
|
|
52
|
+
*/
|
|
53
|
+
deadAir<T>(action: () => Promise<T>): Promise<T>;
|
|
54
|
+
/** Milliseconds since video-mode started recording metadata for this test. */
|
|
55
|
+
getVideoTimestamp(): number;
|
|
56
|
+
/** Parsed video-mode metadata JSON after the test, or the current in-memory snapshot during the test. */
|
|
57
|
+
metadata(): Promise<VideoModeMetadata>;
|
|
58
|
+
/** Absolute artifact paths for the current test's video-mode outputs. */
|
|
59
|
+
outputPaths(): VideoModeOutputPaths;
|
|
60
|
+
/** Render the video from this source timestamp, in ms. Defaults to the current video timestamp. */
|
|
61
|
+
setStartTime(ms?: number): void;
|
|
62
|
+
/** Render the video until this source timestamp, in ms. Defaults to the current video timestamp. */
|
|
63
|
+
setEndTime(ms?: number): void;
|
|
64
|
+
};
|
|
65
|
+
export type VideoModePageExtension = {
|
|
66
|
+
videoMode: VideoModeControls;
|
|
67
|
+
};
|
|
68
|
+
export type VideoModePlugin = Plugin<VideoModePageExtension> & VideoModeControls;
|
|
69
|
+
export type VideoModeOutlineHighlightStyle = `${number}px solid ${string}`;
|
|
70
|
+
export type VideoModeHighlightOptions = boolean | {
|
|
71
|
+
/** Highlight duration in the rendered video (ms). Default: 1000 */
|
|
72
|
+
duration?: number;
|
|
73
|
+
mode: "pointer";
|
|
74
|
+
} | {
|
|
75
|
+
/** Highlight duration in the rendered video (ms). Default: 1000 */
|
|
76
|
+
duration?: number;
|
|
77
|
+
mode: "outline";
|
|
78
|
+
/** Outline style for the rendered video. Default: '3px solid gold' */
|
|
79
|
+
style?: VideoModeOutlineHighlightStyle;
|
|
80
|
+
};
|
|
2
81
|
export type VideoModeOptions = {
|
|
3
|
-
/**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
82
|
+
/**
|
|
83
|
+
* Render action annotations. `true` uses pointer mode with default options.
|
|
84
|
+
* Default: true
|
|
85
|
+
*/
|
|
86
|
+
highlight?: VideoModeHighlightOptions;
|
|
87
|
+
/** Final hold duration in the rendered video (ms). Default: 3000 */
|
|
88
|
+
finalHold?: number;
|
|
9
89
|
/** Methods to skip highlighting. Default: ['waitFor'] */
|
|
10
90
|
skipMethods?: OverrideableMethod[];
|
|
11
91
|
/**
|
|
@@ -14,9 +94,11 @@ export type VideoModeOptions = {
|
|
|
14
94
|
* flows that shouldn't be slowed down. Default: []
|
|
15
95
|
*/
|
|
16
96
|
skipStackFrames?: string[];
|
|
97
|
+
/**
|
|
98
|
+
* Maximum rendered duration for each dead-air span. Longer spans are sped up
|
|
99
|
+
* so they fit within this duration.
|
|
100
|
+
*/
|
|
101
|
+
deadAirThreshold?: number;
|
|
17
102
|
};
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
* Also pauses after tests complete for better video endings.
|
|
21
|
-
*/
|
|
22
|
-
export declare const videoMode: (options?: VideoModeOptions) => Plugin;
|
|
103
|
+
/** Records video-mode facts and renders annotations into the recorded video. */
|
|
104
|
+
export declare const videoMode: (options?: VideoModeOptions) => VideoModePlugin;
|