Files
cbddfc7cb3 [c71959c3] Video: release 0.27.0 (#698)
* [c71959c3] feat(motion): add release-0.27.0 panel-demo clip

Extends the panel-demo kit register (kit/) with a v0.27.0 release
composition: identity cold open, four feature cards (WAF real-IP
resolution, Telegram Mini App V6, Codex/Gemini providers, cost-tiered
routing) flipping from in-progress to completed, a camera that pushes
per beat via pk-camera data-shots, a cursor that clicks and travels
via pk-cursor data-waypoints, a receipt stats overlay, a shipped
toast, and the roboco.tech outro. Ships vertical.html, square.html,
props.js, captions.json, and a vitest smoke test mirroring
release-0.26.0's invariants.

* [c71959c3] fix(motion): implement genuinely non-uniform card-beat gaps in release-0.27.0 clip

The four .pk-card animation-delay values were uniform 5.0s/10.0s/15.0s/20.0s
in both vertical.html and square.html -- byte-for-byte identical to
release-0.26.0's metronomic spacing the craft bar bans -- despite the prior
decision_log claiming 5.5s/6.4s/5.3s varied gaps had been added. Card delays
are now 5.0/10.5/16.9/22.2 (real 5.5s/6.4s/5.3s gaps). Camera data-shots,
cursor data-waypoints, and the stats/toast/outro tail in both files are
re-warped with a shared piecewise-linear time function anchored at each
card's new beat, so nothing desyncs and the tail still fits inside the
fixed 40s runtime. Added a regression test asserting the four card gaps
are not all identical.

* [c71959c3] docs(motion): add release-0.27.0 composition section to README

---------

Co-authored-by: UX/UI Developer 1 <ux-dev-1@roboco.tech>
Co-authored-by: UX/UI Documenter <ux-doc@roboco.tech>
2026-07-25 03:39:07 +00:00

126 lines
5.4 KiB
JavaScript

import { readFileSync, existsSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import { describe, expect, it } from "vitest";
// HTML-structure smoke test for the RoboCo v0.27.0 release composition.
// Extends the panel-demo register: panel chrome, typing reveal, four feature cards
// with progress -> completed pill flips, cursor, stats overlay, toast,
// outro, offline constraint, and the captions.json schema/limits.
const here = dirname(fileURLToPath(import.meta.url));
const dir = here;
const read = (name) => readFileSync(join(dir, name), "utf8");
const orientations = [
{ file: "vertical.html", height: "1920" },
{ file: "square.html", height: "1080" },
];
describe("release-0.27.0 composition", () => {
it("ships props.js (default preview values, sidecar overwrites at render)", () => {
expect(existsSync(join(dir, "props.js"))).toBe(true);
const src = read("props.js");
expect(src).toContain("window.__PROPS__");
expect(src).toContain("window.__ORIENTATION__");
expect(src).toContain("introText");
expect(src).toContain("toastTitle");
expect(src).toContain("toastBody");
expect(src).not.toMatch(/—/);
});
it.each(orientations)("$file parses with correct dimensions and wiring", ({ file, height }) => {
const html = read(file);
expect(html).toContain('data-width="1080"');
expect(html).toContain(`data-height="${height}"`);
expect(html).toMatch(/data-duration="40"/);
expect(html).toMatch(/data-fps="30"/);
const propsIdx = html.indexOf('<script src="props.js"></script>');
const kitJsIdx = html.indexOf('<script src="../../kit/kit.js"></script>');
const inlineIdx = html.indexOf("window.__timelines");
expect(propsIdx).toBeGreaterThan(-1);
expect(kitJsIdx).toBeGreaterThan(propsIdx);
expect(inlineIdx).toBeGreaterThan(kitJsIdx);
expect(html).toContain('href="../../kit/kit.css"');
expect(html).toMatch(/class="[^"]*clip[^"]*"/);
expect(html).toContain("pk-frame");
expect(html).toContain("pk-frame__sidebar");
expect(html).toContain("pk-frame__topbar");
expect(html).toContain('id="typeIntro"');
expect(html).toContain("pk-caret");
expect(html).toContain("typeReveal");
const cardCount = (html.match(/class="pk-card"/g) || []).length;
const progressCount = (html.match(/pk-pill--progress/g) || []).length;
const completedCount = (html.match(/pk-pill--completed/g) || []).length;
expect(cardCount).toBe(4);
expect(progressCount).toBe(4);
expect(completedCount).toBe(4);
expect(html).toContain("v0.27.0");
expect(html).toContain("WAF knows the real IP");
expect(html).toContain("Telegram Mini App V6");
expect(html).toContain("Codex and Gemini join");
expect(html).toContain("Cost-tiered routing");
// Choreographed cursor: multi-waypoint path with at least one click
// beat (rings are generated at runtime by kit.js, not static HTML),
// and a camera that moves — a locked-off frame is an automatic bounce.
expect(html).toContain("pk-cursor");
const waypoints = html.match(/data-waypoints="([^"]+)"/);
expect(waypoints).not.toBeNull();
expect(waypoints[1].split(";").length).toBeGreaterThanOrEqual(6);
expect(waypoints[1]).toContain("click");
const shots = html.match(/data-shots="([^"]+)"/);
expect(shots).not.toBeNull();
expect(shots[1].split(";").length).toBeGreaterThanOrEqual(4);
expect(html).toContain("choreographAllCursors");
expect(html).toContain("choreographAllCameras");
expect(html).toContain("pk-toast");
expect(html).toContain('id="toastTitle"');
expect(html).toContain('id="toastBody"');
expect(html).toContain("pk-outro");
expect(html).toContain("roboco.tech");
expect(html).not.toMatch(/<script[^>]+src="https?:\/\//);
expect(html).not.toMatch(/href="https?:\/\//);
// on-screen copy only; the document <title> may carry an em dash as
// metadata (matches release-0.25.0's precedent) — it never renders.
const body = html.slice(html.indexOf("<body"));
expect(body).not.toMatch(/—/);
// Card-beat gaps must be genuinely varied, not the metronomic identical
// 5.0s/5.0s/5.0s spacing the craft bar bans (a real prior revision cycle
// on this composition).
const cardDelays = [...html.matchAll(/class="pk-card" style="animation-delay: ([\d.]+)s;"/g)].map((m) =>
parseFloat(m[1]),
);
expect(cardDelays.length).toBe(4);
const gaps = cardDelays.slice(1).map((t, i) => Math.round((t - cardDelays[i]) * 100) / 100);
expect(new Set(gaps).size).toBeGreaterThan(1);
});
it("ships captions.json within X and TikTok platform limits", () => {
expect(existsSync(join(dir, "captions.json"))).toBe(true);
const captions = JSON.parse(read("captions.json"));
expect(captions.composition_id).toBe("release-0.27.0");
expect(captions.platforms.x.char_count).toBe(captions.platforms.x.caption.length);
expect(captions.platforms.x.char_count).toBeLessThanOrEqual(captions.platforms.x.limit);
expect(captions.platforms.x.within_limit).toBe(true);
expect(captions.platforms.tiktok.char_count).toBe(captions.platforms.tiktok.caption.length);
expect(captions.platforms.tiktok.char_count).toBeLessThanOrEqual(captions.platforms.tiktok.limit);
expect(captions.platforms.tiktok.within_limit).toBe(true);
expect(captions.platforms.x.caption).not.toMatch(/—/);
expect(captions.platforms.tiktok.caption).not.toMatch(/—/);
});
});