@cosmicdrift/kumiko-testing 0.417.0 → 0.419.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-testing",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.419.0",
|
|
4
4
|
"description": "Test template for Kumiko apps: per-flow seedTenant, app test stack, canonical test preloads, bunfig generator and integration runner.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
"kumiko-testing": "./bin/kumiko-testing.ts"
|
|
108
108
|
},
|
|
109
109
|
"dependencies": {
|
|
110
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
111
|
-
"@cosmicdrift/kumiko-guards": "0.
|
|
112
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
110
|
+
"@cosmicdrift/kumiko-framework": "0.419.0",
|
|
111
|
+
"@cosmicdrift/kumiko-guards": "0.419.0",
|
|
112
|
+
"@cosmicdrift/kumiko-types": "0.419.0",
|
|
113
113
|
"zod": "^4.6.7"
|
|
114
114
|
},
|
|
115
115
|
"peerDependencies": {
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
}
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
|
-
"@cosmicdrift/kumiko-bundled-features": "0.
|
|
137
|
-
"@cosmicdrift/kumiko-dev-server": "0.
|
|
136
|
+
"@cosmicdrift/kumiko-bundled-features": "0.419.0",
|
|
137
|
+
"@cosmicdrift/kumiko-dev-server": "0.419.0",
|
|
138
138
|
"@happy-dom/global-registrator": "^21.0.4",
|
|
139
139
|
"@playwright/test": "^1.64.1",
|
|
140
140
|
"@testing-library/dom": "^10.4.2",
|
package/src/changes.json
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.418.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Stack cleanup test tolerates the ioredis MONITOR startup race",
|
|
6
|
+
"detail": "ioredis switches a connection to monitoring one microtask after MONITOR's OK, so command lines in the same TCP read raised \"Command queue state error\" and failed the cleanup test under parallel Redis traffic. The test opens its own monitor connection and drops only that startup error."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.417.0",
|
|
4
10
|
"type": "improvement",
|
|
@@ -55,12 +55,6 @@ export class FrameTimeline {
|
|
|
55
55
|
this.frames.push({ path, durationMs });
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
extendLast(ms: number): void {
|
|
59
|
-
const last = this.frames.at(-1);
|
|
60
|
-
if (last === undefined) throw new Error("FrameTimeline.extendLast(): no frame captured yet");
|
|
61
|
-
last.durationMs += ms;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
58
|
async settle(): Promise<void> {
|
|
65
59
|
await waitForSettledPage(this.page, trackInFlightRequests(this.page));
|
|
66
60
|
}
|
|
@@ -134,7 +128,9 @@ export class FrameTimeline {
|
|
|
134
128
|
focus: async (target) => {
|
|
135
129
|
await this.settle();
|
|
136
130
|
await target.scrollIntoViewIfNeeded();
|
|
137
|
-
|
|
131
|
+
const box = await target.boundingBox();
|
|
132
|
+
if (box === null) throw new Error("Video tools: target element has no bounding box");
|
|
133
|
+
await showFocus(this.page, box);
|
|
138
134
|
await this.capture(FRAME_MS);
|
|
139
135
|
},
|
|
140
136
|
};
|
package/src/e2e/video/mux.ts
CHANGED
|
@@ -30,10 +30,16 @@ function concatFileLine(path: string): string {
|
|
|
30
30
|
export function buildFrameConcatList(frames: readonly MuxFrame[]): string {
|
|
31
31
|
const last = frames.at(-1);
|
|
32
32
|
if (last === undefined) throw new Error("buildFrameConcatList(): no frames");
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
// Rounding cumulative boundaries instead of each duration keeps the sum equal to the total.
|
|
34
|
+
let elapsedMs = 0;
|
|
35
|
+
let previousBoundaryUs = 0;
|
|
36
|
+
const lines = frames.flatMap((frame) => {
|
|
37
|
+
elapsedMs += frame.durationMs;
|
|
38
|
+
const boundaryUs = Math.round(elapsedMs * 1000);
|
|
39
|
+
const durationUs = boundaryUs - previousBoundaryUs;
|
|
40
|
+
previousBoundaryUs = boundaryUs;
|
|
41
|
+
return [concatFileLine(frame.path), `duration ${(durationUs / 1_000_000).toFixed(6)}`];
|
|
42
|
+
});
|
|
37
43
|
// The concat demuxer ignores the duration of the final entry unless that file is listed again.
|
|
38
44
|
lines.push(concatFileLine(last.path));
|
|
39
45
|
return `${lines.join("\n")}\n`;
|
|
@@ -10,11 +10,11 @@ import { addVideoOverlay, showFocus } from "./cursor-overlay";
|
|
|
10
10
|
import type { VideoDefinition, VideoSceneContext } from "./define-video";
|
|
11
11
|
import { FrameTimeline } from "./frame-timeline";
|
|
12
12
|
import { buildVtt, type MuxSceneAudio, muxVideo, type VttCue } from "./mux";
|
|
13
|
+
import { assertAiNoticeCoversLocales, SETUP_TOOLS, sceneExtensionMs } from "./scene-plan";
|
|
13
14
|
import { synthesizeSpeech } from "./tts";
|
|
14
15
|
import { loadVideoTexts } from "./video-texts";
|
|
15
16
|
|
|
16
17
|
const INTRO_MS = 500;
|
|
17
|
-
const SCENE_TAIL_MS = 400;
|
|
18
18
|
|
|
19
19
|
export interface RunVideosOptions {
|
|
20
20
|
readonly videos: Readonly<Record<string, VideoDefinition>>;
|
|
@@ -75,13 +75,7 @@ export function runVideos(options: RunVideosOptions): void {
|
|
|
75
75
|
const onlyLocales = csvFilter(process.env["VIDEO_LOCALES"]);
|
|
76
76
|
const ttsCacheDir = join(videosDir, ".cache", "tts");
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
for (const locale of locales) {
|
|
80
|
-
if (aiNotice[locale] === undefined) {
|
|
81
|
-
throw new Error(`runVideos(): aiNotice has no text for locale "${locale}"`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
78
|
+
assertAiNoticeCoversLocales(aiNotice, locales);
|
|
85
79
|
|
|
86
80
|
for (const [id, video] of Object.entries(videos)) {
|
|
87
81
|
if (onlyIds !== undefined && !onlyIds.has(id)) continue;
|
|
@@ -114,7 +108,7 @@ export function runVideos(options: RunVideosOptions): void {
|
|
|
114
108
|
identities.push(...mappings);
|
|
115
109
|
},
|
|
116
110
|
};
|
|
117
|
-
await video.setup?.(page, ctx);
|
|
111
|
+
await video.setup?.(page, { ...ctx, tools: SETUP_TOOLS });
|
|
118
112
|
|
|
119
113
|
await timeline.settle();
|
|
120
114
|
await timeline.capture(INTRO_MS);
|
|
@@ -136,9 +130,12 @@ export function runVideos(options: RunVideosOptions): void {
|
|
|
136
130
|
// Narration starts at the scene start, so the intro frame stays silent.
|
|
137
131
|
const startMs = timeline.totalMs;
|
|
138
132
|
await scene.do(page, { ...ctx, speechMs: speech.durationMs });
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
133
|
+
const extensionMs = sceneExtensionMs(timeline.totalMs - startMs, speech.durationMs);
|
|
134
|
+
if (extensionMs > 0) {
|
|
135
|
+
// A fresh frame, not a stretched old one: the scene may end on an uncaptured action.
|
|
136
|
+
await timeline.settle();
|
|
137
|
+
await timeline.capture(extensionMs);
|
|
138
|
+
}
|
|
142
139
|
await showFocus(page, null);
|
|
143
140
|
|
|
144
141
|
const sceneMs = timeline.totalMs - startMs;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { VideoTools } from "./define-video";
|
|
2
|
+
|
|
3
|
+
export const SCENE_TAIL_MS = 400;
|
|
4
|
+
|
|
5
|
+
export function sceneExtensionMs(elapsedMs: number, speechMs: number): number {
|
|
6
|
+
return Math.max(0, speechMs + SCENE_TAIL_MS - elapsedMs);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function assertAiNoticeCoversLocales(
|
|
10
|
+
aiNotice: Readonly<Record<string, string>> | undefined,
|
|
11
|
+
locales: readonly string[],
|
|
12
|
+
): void {
|
|
13
|
+
if (aiNotice === undefined) return;
|
|
14
|
+
for (const locale of locales) {
|
|
15
|
+
if (aiNotice[locale] === undefined) {
|
|
16
|
+
throw new Error(`runVideos(): aiNotice has no text for locale "${locale}"`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Frames taken during `setup` would land at the start of the MP4 (login typing, passwords).
|
|
22
|
+
function unavailableInSetup(): never {
|
|
23
|
+
throw new Error("Video tools are not available in setup (nothing is recorded yet); use page");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const SETUP_TOOLS: VideoTools = {
|
|
27
|
+
moveTo: unavailableInSetup,
|
|
28
|
+
click: unavailableInSetup,
|
|
29
|
+
type: unavailableInSetup,
|
|
30
|
+
hold: unavailableInSetup,
|
|
31
|
+
focus: unavailableInSetup,
|
|
32
|
+
snapshot: unavailableInSetup,
|
|
33
|
+
stage: unavailableInSetup,
|
|
34
|
+
animate: unavailableInSetup,
|
|
35
|
+
};
|