teaser v6: 55.5 s, v5 kept, its desktop part grown to four scenes

Portfolio (every app, both stores, rollout %, crash sparklines), the Growth and
Health charts with a real hover sweep (one captured frame per hovered day, the
pointer follows the recorded positions), the Prices matrix (both stores per
country, gaps marked), then v5's release timeline and 0 blockers. All frames are
real fixture-mode captures (desktop.ts). Tests: scenes 4-5 s, 50-60 s total,
captions >= 3 s, every desktop frame captured by desktop.ts and present.
This commit is contained in:
CRTkafa 2026-10-11 18:32:53 +00:00
parent fd89724aeb
commit 64b79b26b8
8 changed files with 274 additions and 57 deletions

View file

@ -1,8 +1,9 @@
// The teaser video (media/teaser, v5): every CLI line it shows is real output of the command it names, each scene holds
// 4-5 s, each caption is fully on screen for at least 3 s, the whole cut is 38-46 s, and it is 16:9 only.
// The teaser video (media/teaser, v6): every CLI line it shows is real output of the command it names, every desktop
// frame is a real capture of the app (desktop.ts), each scene holds 4-5 s, each caption is fully on screen for at least
// 3 s, the whole cut is 50-60 s, and it is 16:9 only.
import { afterAll, beforeAll, describe, expect, test } from 'bun:test';
import { generateKeyPairSync } from 'node:crypto';
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { ALPHA3 } from '../cli/lib/money';
@ -26,6 +27,8 @@ interface Teaser {
DECL_LINES: { what: string; value: string; where: string }[]; DECL_ASK: string; DECL_TOTAL: number;
SCAN_CMD: string; RISKS_LINE: string; RESCAN_LINE: string;
FINDINGS: { sev: string; guideline: string; title: string; where: string; why: string }[];
DESK: Record<string, { groups: { frame: string; sweep?: { seq: string; at: number; d: number } }[]; swap?: number[]; callouts: { at: number; until: number; target: string; text: string }[] }>;
DESK_SCENES: string[]; DESK_FRAMES: string[]; DESK_SWEEPS: string[];
}
const T = (await import(join(ROOT, 'media/teaser/script.js'))) as Teaser;
@ -156,7 +159,7 @@ describe('teaser: timing and format', () => {
expect(render).not.toMatch(/1080\s*x\s*1920|w: 1080, h: 1920|vertical/i);
expect(render).toContain('scale=1280:720');
});
test('scenes are contiguous, 4-5 s each, 38-46 s in total', () => {
test('scenes are contiguous, 4-5 s each, 50-60 s in total', () => {
expect(T.SCENES[0]!.start).toBe(0);
for (let i = 1; i < T.SCENES.length; i++) expect(T.SCENES[i]!.start).toBe(T.SCENES[i - 1]!.end);
for (const s of T.SCENES) {
@ -164,8 +167,8 @@ describe('teaser: timing and format', () => {
expect(s.end - s.start, s.id).toBeLessThanOrEqual(5);
}
expect(T.DURATION).toBe(T.SCENES.at(-1)!.end);
expect(T.DURATION).toBeGreaterThanOrEqual(38);
expect(T.DURATION).toBeLessThanOrEqual(46);
expect(T.DURATION).toBeGreaterThanOrEqual(50);
expect(T.DURATION).toBeLessThanOrEqual(60);
});
test('one caption per scene, fully on screen for at least 3 s, inside its scene', () => {
const c = T.captionTimes();
@ -182,3 +185,64 @@ describe('teaser: timing and format', () => {
expect(T.MAIL.guideline).toStartWith('Guideline 2.1');
});
});
// The desktop sequence: four scenes of the real app (fixture mode), captured by media/teaser/desktop.ts. The frames are
// gitignored output; the file checks run wherever they were captured (render.ts captures them before every render).
const DESK_DIR = join(ROOT, 'media/teaser/out/desktop');
const captured = existsSync(join(DESK_DIR, 'boxes.json'));
/** Width and height of a JPEG (its first SOF marker). */
function jpegSize(buf: Buffer): { w: number; h: number } | null {
if (buf[0] !== 0xff || buf[1] !== 0xd8) return null;
for (let i = 2; i + 9 < buf.length;) {
if (buf[i] !== 0xff) { i++; continue; }
const m = buf[i + 1]!;
if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc) return { w: buf.readUInt16BE(i + 7), h: buf.readUInt16BE(i + 5) };
i += 2 + buf.readUInt16BE(i + 2);
}
return null;
}
describe('teaser: the desktop scenes are real captures of the app', () => {
test('four desktop scenes in a row before the submit card, the last one is v5\'s (timeline, then 0 blockers)', () => {
expect(T.DESK_SCENES).toEqual(['portfolio', 'charts', 'catalog', 'desktop']);
const ids = T.SCENES.map(s => s.id);
expect(ids.slice(-5)).toEqual([...T.DESK_SCENES, 'submit']);
expect(T.DESK.desktop!.groups.map(g => g.frame)).toEqual(['releases', 'ready']);
expect(T.CAPTIONS.find(c => c.id === 'desktop')!.lines.join(' ').replace(/\*/g, '')).toBe('Both stores, one view. Ready for review.');
for (const id of T.DESK_SCENES) expect(T.DESK[id]!.callouts.length, id).toBe(1 + (id === 'desktop' ? 1 : 0));
expect(T.DESK_SWEEPS).toEqual(['growth', 'health']);
});
test('every frame a scene names is one desktop.ts captures from the app (no mock frames)', () => {
const src = readFileSync(join(ROOT, 'media/teaser/desktop.ts'), 'utf8');
expect(src).toContain("VITE_FIXTURES: '1'");
for (const f of T.DESK_FRAMES) expect(src, f).toMatch(new RegExp(`shot\\([a-z.]+, '${f}'\\)|sweep\\('${f}'`));
for (const s of T.DESK_SWEEPS) expect(src, s).toContain(`sweep('${s}'`);
// the picture shows only files from out/desktop, never a drawn stand-in
const js = readFileSync(join(ROOT, 'media/teaser/teaser.js'), 'utf8');
expect(js).toContain('out/desktop/${x.g.frame}.jpg');
expect(js).toContain('out/desktop/${f.file}.jpg');
});
test.if(captured)('the captured frames are present: 1280x800 @2x JPEGs, the sweeps one frame per hovered day', () => {
const boxes = JSON.parse(readFileSync(join(DESK_DIR, 'boxes.json'), 'utf8')) as Record<string, unknown> & { source: string; sweeps: Record<string, { file: string; px: number; day: string }[]> };
expect(boxes.source).toContain('VITE_FIXTURES=1');
const files = [...T.DESK_FRAMES];
for (const s of T.DESK_SWEEPS) {
const f = boxes.sweeps[s]!;
expect(f.length, s).toBeGreaterThanOrEqual(8);
expect(new Set(f.map(x => x.day)).size, s).toBe(f.length);
for (let i = 1; i < f.length; i++) expect(f[i]!.px).toBeGreaterThan(f[i - 1]!.px);
files.push(...f.map(x => x.file));
}
const sizes = new Set<number>();
for (const f of files) {
const p = join(DESK_DIR, `${f}.jpg`);
expect(existsSync(p), p).toBe(true);
const buf = readFileSync(p);
expect(jpegSize(buf), f).toEqual({ w: 2560, h: 1600 });
sizes.add(buf.length);
}
// every sweep frame differs from the others (the tooltip moved): no copied frames
expect(sizes.size).toBeGreaterThan(files.length * 0.9);
for (const id of T.DESK_SCENES) for (const c of T.DESK[id]!.callouts) expect(boxes[c.target], c.target).toBeDefined();
});
});