teaser: CLI montage before the Submit card (api coverage, play build --dry, console fill --dry), real output checked in tests

This commit is contained in:
CRTkafa 2026-10-12 00:52:13 +08:00
parent 657bfdc35e
commit 8fcc78bb52
6 changed files with 170 additions and 15 deletions

View file

@ -1,4 +1,4 @@
# storebound teaser (about 34 s social video) # storebound teaser (about 37 s social video)
A scripted motion piece, not a screen recording. Every frame is a pure function of time, rendered from an A scripted motion piece, not a screen recording. Every frame is a pure function of time, rendered from an
HTML/CSS/JS timeline in headless Chrome and encoded with ffmpeg. The music and the sound design are original and HTML/CSS/JS timeline in headless Chrome and encoded with ffmpeg. The music and the sound design are original and
@ -13,8 +13,9 @@ nothing to license.
| 14.06-16.88 | the store screenshot wall (the demo game's real renders), 200 store screenshots | | 14.06-16.88 | the store screenshot wall (the demo game's real renders), 200 store screenshots |
| 16.88-19.69 | the declarations proposal from the scan, Data safety answers ticking, 764 answers | | 16.88-19.69 | the declarations proposal from the scan, Data safety answers ticking, 764 answers |
| 19.69-28.13 | the desktop app (real frames, fixture data): Portfolio across studios · release timeline, rollout filling to 20% · Checks, rejection risks turning green | | 19.69-28.13 | the desktop app (real frames, fixture data): Portfolio across studios · release timeline, rollout filling to 20% · Checks, rejection risks turning green |
| 28.13-30.94 | "It never presses Submit. You do." over a Submit button | | 28.13-30.94 | CLI montage, three panels cut on the beat: `storebound api coverage` (1303 App Store Connect + 170 Google Play endpoints) · `play build --dry` plan · `console fill apple-app-privacy --dry` answers |
| 30.94-33.75 | logo, storebound.dev, Open source · macOS · Windows · Linux | | 30.94-33.75 | "It never presses Submit. You do." over a Submit button |
| 33.75-36.56 | logo, storebound.dev, Open source · macOS · Windows · Linux |
| file | what | | file | what |
|---|---| |---|---|
@ -30,7 +31,10 @@ The scan text is the real `storebound scan` output of `tests/fixtures/scan/tease
rejections) and, after the fixes, of `tests/fixtures/scan/teaser-fixed`; `tests/teaser.test.ts` runs both scans and rejections) and, after the fixes, of `tests/fixtures/scan/teaser-fixed`; `tests/teaser.test.ts` runs both scans and
checks every line the video shows, the beat grid, the caption lengths (at most 7 words) and holds (at least 1.2 s), and checks every line the video shows, the beat grid, the caption lengths (at most 7 words) and holds (at least 1.2 s), and
that every scene holds at least 2.5 s. Each fix line shows a verbatim piece of the real fix. The mail list is fictional: that every scene holds at least 2.5 s. Each fix line shows a verbatim piece of the real fix. The mail list is fictional:
no real names or addresses, no mail-app branding. The desktop scenes are real frames of the app on its fixture data; no real names or addresses, no mail-app branding. The montage lines are real output too, trimmed (revision dates,
clock prefixes and the source column left out): `api coverage` in the repo, `play build --dry --version-code 12` in a
throwaway example.com Capacitor project, `console fill apple-app-privacy --dry` in `examples/demo-app`; the test runs
each command and checks every line and the endpoint counts. The desktop scenes are real frames of the app on its fixture data;
the "after" Checks frame is the same tab with the fixture's scan answering no findings. the "after" Checks frame is the same tab with the fixture's scan answering no findings.
## Render ## Render

View file

@ -211,6 +211,19 @@ body.v #s-shots .scrim { height: 640px; } body.h #s-shots .scrim { height: 380px
#s-brand .url { margin-top: 30px; font: 800 64px/1 var(--display); color: var(--accent); letter-spacing: -0.02em; } #s-brand .url { margin-top: 30px; font: 800 64px/1 var(--display); color: var(--accent); letter-spacing: -0.02em; }
#s-brand .plat { margin-top: 34px; font: 600 36px/1.3 var(--text); color: var(--ink-2); } #s-brand .plat { margin-top: 34px; font: 600 36px/1.3 var(--text); color: var(--ink-2); }
#s-brand > .wrap > * { opacity: 0; } #s-brand > .wrap > * { opacity: 0; }
/* ---------- more: real CLI output, three panels ---------- */
#s-more .panel { position: absolute; inset: 0; visibility: hidden; }
#s-more .card .ch { font: 700 28px/1.2 var(--mono); }
#s-more .card .ch .ps { color: var(--green); }
#s-more .card .ch .sub { font: 600 22px/1 var(--text); }
#s-more .body { padding: 14px 0; }
#s-more .ln { display: block; font: 600 25px/1.6 var(--mono); padding: 2px 30px; color: var(--ink-2); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
#s-more .ln .n { color: #fff; font-weight: 800; } #s-more .ln .ok { color: var(--green); font-weight: 800; } #s-more .ln .ask { color: var(--yellow); font-weight: 800; }
#s-more .ln .dimt { color: var(--dim); }
body.v #s-more .ln { font-size: 21px; padding: 2px 24px; } body.v #s-more .card .ch { font-size: 23px; padding: 20px 24px; }
#s-more .stat { font-family: var(--display); font-weight: 900; color: #fff; padding: 18px 36px; letter-spacing: -0.02em; white-space: nowrap; }
#s-more .stat b { color: var(--accent); }
</style> </style>
</head> </head>
<body> <body>
@ -252,6 +265,8 @@ body.v #s-shots .scrim { height: 640px; } body.h #s-shots .scrim { height: 380px
<div class="scene" id="s-desk2"></div> <div class="scene" id="s-desk2"></div>
<div class="scene" id="s-desk3"></div> <div class="scene" id="s-desk3"></div>
<div class="scene" id="s-more"></div>
<div class="scene" id="s-submit"> <div class="scene" id="s-submit">
<div id="sbtn"><span class="pi i-send"></span>Submit for Review<span class="hov"></span></div> <div id="sbtn"><span class="pi i-send"></span>Submit for Review<span class="hov"></span></div>
</div> </div>

View file

@ -15,8 +15,9 @@ function rng(seed) { // mulberry32
// chords per bar (root midi in octave 3, intervals) // chords per bar (root midi in octave 3, intervals)
const CH = { Fm: [53, [0, 3, 7]], Db: [49, [0, 4, 7]], Ab: [56, [0, 4, 7]], Eb: [51, [0, 4, 7]] }; const CH = { Fm: [53, [0, 3, 7]], Db: [49, [0, 4, 7]], Ab: [56, [0, 4, 7]], Eb: [51, [0, 4, 7]] };
// 18 bars: hook (0-1) · command + scan (1-5) · fixed, shots, decl (6-10) · desktop (10-14) · submit (15-16) · brand (16-17) // 20 bars (the video ends half way into the last): hook (0-1) · command + scan (1-5) · fixed, shots, decl (6-10) ·
const BARS = ['Fm', 'Db', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Eb', 'Fm']; // desktop (10-14) · the CLI montage (15-16) · submit (16-17) · brand (18-19)
const BARS = ['Fm', 'Db', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Db', 'Ab', 'Eb', 'Fm', 'Ab', 'Db', 'Eb', 'Fm', 'Fm'];
const ARP = [0, 2, 4, 3, 5, 4, 2, 3, 0, 2, 4, 6, 5, 4, 3, 2]; const ARP = [0, 2, 4, 3, 5, 4, 2, 3, 0, 2, 4, 6, 5, 4, 3, 2];
export async function renderMusic() { export async function renderMusic() {

View file

@ -10,8 +10,8 @@ export const BEAT = 60 / BPM; // 0.46875 s
export const BAR = BEAT * 4; // 1.875 s export const BAR = BEAT * 4; // 1.875 s
export const FPS = 30; export const FPS = 30;
export const B = n => n * BEAT; // beats -> seconds export const B = n => n * BEAT; // beats -> seconds
export const BEATS = 72; // 18 bars export const BEATS = 78; // 19.5 bars
export const DURATION = B(BEATS); // 33.75 s export const DURATION = B(BEATS); // 36.5625 s
/** Scenes in beats (start, end). Cuts: the hook's hard cut, then whips and masks on the beat. */ /** Scenes in beats (start, end). Cuts: the hook's hard cut, then whips and masks on the beat. */
export const SCENES = [ export const SCENES = [
@ -23,8 +23,9 @@ export const SCENES = [
{ id: 'desk1', from: 42, to: 48, in: 'wipe' }, // desktop: Portfolio across studios { id: 'desk1', from: 42, to: 48, in: 'wipe' }, // desktop: Portfolio across studios
{ id: 'desk2', from: 48, to: 54, in: 'whip-left' }, // desktop: release timeline, rollout to 20% { id: 'desk2', from: 48, to: 54, in: 'whip-left' }, // desktop: release timeline, rollout to 20%
{ id: 'desk3', from: 54, to: 60, in: 'whip-left' }, // desktop: Checks, rejection risks turn green { id: 'desk3', from: 54, to: 60, in: 'whip-left' }, // desktop: Checks, rejection risks turn green
{ id: 'submit', from: 60, to: 66, in: 'zoom' }, // "It never presses Submit. You do." { id: 'more', from: 60, to: 66, in: 'whip-left' }, // montage: api coverage · play build --dry · console fill --dry
{ id: 'brand', from: 66, to: 72, in: 'iris' }, // logo, storebound.dev, platforms { id: 'submit', from: 66, to: 72, in: 'zoom' }, // "It never presses Submit. You do."
{ id: 'brand', from: 72, to: 78, in: 'iris' }, // logo, storebound.dev, platforms
].map(s => ({ ...s, start: B(s.from), end: B(s.to) })); ].map(s => ({ ...s, start: B(s.from), end: B(s.to) }));
export const scene = id => SCENES.find(s => s.id === id); export const scene = id => SCENES.find(s => s.id === id);
/** Transition length (seconds) per kind; the incoming scene starts at the cut, the outgoing one leaves before it. */ /** Transition length (seconds) per kind; the incoming scene starts at the cut, the outgoing one leaves before it. */
@ -44,7 +45,8 @@ export const CAPTIONS = [
{ id: 'desk1', at: B(42), to: B(48), lines: ['Every app.', 'Every *studio.*'] }, { id: 'desk1', at: B(42), to: B(48), lines: ['Every app.', 'Every *studio.*'] },
{ id: 'desk2', at: B(48), to: B(54), lines: ['Both stores.', 'One *timeline.*'] }, { id: 'desk2', at: B(48), to: B(54), lines: ['Both stores.', 'One *timeline.*'] },
{ id: 'desk3', at: B(54), to: B(60), lines: ['Risks turn', '*green.*'], hl: 'green' }, { id: 'desk3', at: B(54), to: B(60), lines: ['Risks turn', '*green.*'], hl: 'green' },
{ id: 'submit', at: B(60.5), to: B(66), lines: ['It never presses *Submit.*', 'You do.'] }, { id: 'more', at: B(60), to: B(66), lines: ['Every *endpoint.*', 'Build, upload, fill the forms.'] },
{ id: 'submit', at: B(66.5), to: B(72), lines: ['It never presses *Submit.*', 'You do.'] },
]; ];
/** /**
@ -141,14 +143,51 @@ export const DESKTOP = {
cursor: [[0.5, 'off'], [1.0, 'scanAgain']], flip: 1.25, callout: { at: 1.55, target: 'scanClean', text: '0 rejection risks' } }, cursor: [[0.5, 'off'], [1.0, 'scanAgain']], flip: 1.25, callout: { at: 1.55, target: 'scanClean', text: '0 rejection risks' } },
}; };
// ---------- more: a montage of real CLI output, three panels, two cuts on the beat ----------
/**
* Real output, trimmed (tests/teaser.test.ts runs each command and checks every line):
* api coverage in the repo; the API revision dates in parentheses are left out
* play build --dry in a throwaway Capacitor project (example.com config); the clock and "[build]" prefixes are left out
* console fill examples/demo-app; the "(dataSafety.…)" source column is left out
* at = the panel's cut (seconds, absolute); stat = the pill under the card.
*/
export const MORE = [
{ at: B(60), cmd: 'storebound api coverage', sub: 'App Store Connect · Google Play',
lines: [
'App Store Connect API 4.5.1: 1303 operations',
'Google Play Android Developer API v3: 145 operations',
'Google Play Developer Reporting API v1beta1: 25 operations',
],
stat: { text: '*1303* App Store Connect + *170* Google Play endpoints' } },
{ at: B(62), cmd: 'storebound play build --dry --version-code 12', sub: 'plan',
lines: [
'capacitor: android :app:bundleRelease, versionCode 12',
"signing: the project's own signingConfig",
'would run (in android): ./gradlew :app:bundleRelease',
'build planned (dry run)',
],
stat: { text: 'Dry run first. *Always.*' } },
{ at: B(64), cmd: 'storebound console fill apple-app-privacy --dry', sub: 'App Privacy',
lines: [
'[ok] Data type: Contact Info > Email Address: Yes',
'[ok] Data type: Identifiers > User ID: Yes',
'[ok] Data type: Diagnostics > Crash Data: Yes',
'[check] Data type: Usage Data > Advertising Data: (you decide)',
],
stat: { text: 'Fills it in. *You* press Publish.' } },
];
/** The two cuts inside the montage (on the beat). */
export const MORE_CUTS = MORE.slice(1).map(p => p.at);
// ---------- end ---------- // ---------- end ----------
export const SUBMIT_HOVER = B(61.5); // the cursor stops on the button, it never clicks export const SUBMIT_HOVER = B(67.5); // the cursor stops on the button, it never clicks
export const URL = 'storebound.dev'; export const URL = 'storebound.dev';
export const PLATFORMS = 'Open source · macOS · Windows · Linux'; export const PLATFORMS = 'Open source · macOS · Windows · Linux';
// ---------- sound cues (music.js) ---------- // ---------- sound cues (music.js) ----------
/** Every cut that gets a hit, with the kind of transition (a whoosh leads into whips, masks and zooms). */ /** Every cut that gets a hit, with the kind of transition (a whoosh leads into whips, masks and zooms). */
export const CUTS = SCENES.slice(1).map(s => ({ t: s.start, kind: s.in, id: s.id })); export const CUTS = [...SCENES.slice(1).map(s => ({ t: s.start, kind: s.in, id: s.id })), ...MORE_CUTS.map(t => ({ t, kind: 'cut', id: 'more' }))]
.sort((a, b) => a.t - b.t);
/** Ticks: mails landing, findings landing, green flips, callouts. */ /** Ticks: mails landing, findings landing, green flips, callouts. */
export const TICKS = [ export const TICKS = [
...MAILS.map(m => ({ t: m.at, kind: 'mail' })), ...MAILS.map(m => ({ t: m.at, kind: 'mail' })),
@ -157,6 +196,7 @@ export const TICKS = [
...FINDINGS.map(f => ({ t: f.at, kind: 'bad' })), ...FINDINGS.map(f => ({ t: f.at, kind: 'bad' })),
...FLIP_AT.map((t, i) => ({ t, kind: 'good', step: i })), ...FLIP_AT.map((t, i) => ({ t, kind: 'good', step: i })),
...Object.entries(DESKTOP).map(([id, d]) => ({ t: scene(id).start + d.callout.at, kind: 'pop' })), ...Object.entries(DESKTOP).map(([id, d]) => ({ t: scene(id).start + d.callout.at, kind: 'pop' })),
...MORE.map(p => ({ t: p.at + 0.3, kind: 'pop' })),
]; ];
/** Seconds at which each typed character lands (key clicks). */ /** Seconds at which each typed character lands (key clicks). */
export function keyTimes() { export function keyTimes() {

View file

@ -1,7 +1,7 @@
// Teaser picture: every element is set from the time t alone (window.teaser.seek(t)), so frames render // Teaser picture: every element is set from the time t alone (window.teaser.seek(t)), so frames render
// deterministically, in any order. URL: ?w=1080&h=1920 (or 1920x1080) · &t=12.5 to hold a frame · &play=1 to preview. // deterministically, in any order. URL: ?w=1080&h=1920 (or 1920x1080) · &t=12.5 to hold a frame · &play=1 to preview.
import { B, BEAT, CAPTIONS, captionTimes, CMD, DATA_SAFETY_ROWS, DECL_ASK, DECL_LINES, DECL_TOTAL, DESKTOP, DURATION, ENTER_AT, FINDINGS, import { B, BEAT, CAPTIONS, captionTimes, CMD, DATA_SAFETY_ROWS, DECL_ASK, DECL_LINES, DECL_TOTAL, DESKTOP, DURATION, ENTER_AT, FINDINGS,
FLIP_AT, FPS, MAIL_SUBJECT, MAILS, OLD_MAILS, PLATFORMS, RESCAN_CMD, RESCAN_LINE, RESCAN_LINE_AT, RESCAN_NONE, RESCAN_TYPE_AT, FLIP_AT, FPS, MAIL_SUBJECT, MAILS, MORE, MORE_CUTS, OLD_MAILS, PLATFORMS, RESCAN_CMD, RESCAN_LINE, RESCAN_LINE_AT, RESCAN_NONE, RESCAN_TYPE_AT,
RISKS_AT, RISKS_LINE, SCAN_HEAD, SCENES, SDK_AT, SDKS, SHOTS_TOTAL, SUBMIT_HOVER, TRANS, TYPE_AT, TYPE_CPS, URL, scene } from './script.js'; RISKS_AT, RISKS_LINE, SCAN_HEAD, SCENES, SDK_AT, SDKS, SHOTS_TOTAL, SUBMIT_HOVER, TRANS, TYPE_AT, TYPE_CPS, URL, scene } from './script.js';
const q = new URLSearchParams(location.search); const q = new URLSearchParams(location.search);
@ -89,6 +89,7 @@ const g1 = $('#bg .g1'), g2 = $('#bg .g2'), g3 = $('#bg .g3'), grid = $('#bg .gr
const HITS = [ const HITS = [
{ t: B(3), a: 0.5, c: '#ff3b3b' }, { t: B(4), a: 0.6, c: '#ff3b3b' }, { t: ENTER_AT, a: 0.5, c: '#ffffff' }, { t: B(3), a: 0.5, c: '#ff3b3b' }, { t: B(4), a: 0.6, c: '#ff3b3b' }, { t: ENTER_AT, a: 0.5, c: '#ffffff' },
...SCENES.slice(2).map(s => ({ t: s.start, a: s.id === 'brand' ? 0.55 : 0.28, c: '#ffffff' })), ...SCENES.slice(2).map(s => ({ t: s.start, a: s.id === 'brand' ? 0.55 : 0.28, c: '#ffffff' })),
...MORE_CUTS.map(t => ({ t, a: 0.28, c: '#ffffff' })),
...FINDINGS.map(f => ({ t: f.at, a: 0.18, c: '#ff3b3b' })), ...FINDINGS.map(f => ({ t: f.at, a: 0.18, c: '#ff3b3b' })),
]; ];
function background(t) { function background(t) {
@ -532,6 +533,43 @@ function cursor(t) {
} }
const id3 = id => id === 'desk3'; const id3 = id => id === 'desk3';
// ---------- more: three panels of real CLI output, a cut on the beat between them ----------
const moreEl = $('#s-more');
const MC = V ? { x: 60, w: 960, top: 640, stat: 1010 } : { x: 260, w: 1400, top: 370, stat: 740 };
/** Colour the real text without changing it: counts white, [ok] green, [check] yellow, the dry-run verdict green. */
const moreLine = l => esc(l)
.replace(/^(\[ok\])/, '<span class="ok">$1</span>').replace(/^(\[check\])/, '<span class="ask">$1</span>')
.replace(/(\d+ operations)/, '<span class="n">$1</span>').replace(/(: )(Yes)$/, '$1<span class="n">$2</span>')
.replace(/^(build planned \(dry run\))$/, '<span class="ok">$1</span>');
moreEl.innerHTML = MORE.map(p => `<div class="panel">
<div class="card" style="left:${MC.x}px;top:${MC.top}px;width:${MC.w}px"><div class="ch"><span><span class="ps">$</span> ${esc(p.cmd)}</span>${V ? '' : `<span class="sub">${esc(p.sub)}</span>`}</div>
<div class="body">${p.lines.map(l => `<span class="ln">${moreLine(l)}</span>`).join('')}</div></div>
<div class="pill abs stat" style="left:50%;top:${MC.stat}px${V ? ';white-space:normal;width:max-content;max-width:960px;text-align:center;border-radius:30px;font-size:46px;line-height:1.15' : ';font-size:52px'}">${p.stat.text.split(' ').map(w => w.startsWith('*') ? `<b>${esc(w.replace(/\*/g, ''))}</b>` : esc(w)).join(' ')}</div></div>`).join('');
const morePanels = [...moreEl.querySelectorAll('.panel')].map((el, i) => ({
el, card: el.querySelector('.card'), lines: [...el.querySelectorAll('.ln')], stat: el.querySelector('.stat'), at: MORE[i].at, until: MORE[i + 1]?.at ?? Infinity,
}));
function more(t) {
const s = scene('more');
if (t < s.start - 0.2 || t > s.end + 0.5) return;
morePanels.forEach((p, i) => {
const on = (i === 0 ? t >= s.start - 0.2 : t >= p.at) && t < p.until;
set(p.el, 'visibility', on ? 'visible' : 'hidden');
if (!on) return;
const r = t - p.at;
// the first panel arrives with the scene's whip; the next two cut in with a short push
const ce = i === 0 ? 1 : eoq(prog(r, 0, 0.22));
set(p.card, 'transform', `translateX(${((1 - ce) * 90).toFixed(1)}px) scale(${lerp(1.05, 1, ce).toFixed(4)})`);
p.lines.forEach((el, j) => {
const lp = prog(r, (i === 0 ? 0.12 : 0.06) + j * 0.07, 0.18);
set(el, 'opacity', String(clamp(lp * 2)));
set(el, 'transform', `translateX(${((1 - eoc(lp)) * 30).toFixed(1)}px)`);
});
const sp = prog(r, 0.3, 0.3);
set(p.stat, 'opacity', String(clamp(sp * 2.5)));
set(p.stat, 'transform', `translate(-50%, ${((1 - eoc(sp)) * 26).toFixed(1)}px) scale(${lerp(0.85, 1, eob(sp)).toFixed(3)})`);
});
}
// ---------- submit + brand ---------- // ---------- submit + brand ----------
const sbtn = $('#sbtn'), shov = $('#sbtn .hov'); const sbtn = $('#sbtn'), shov = $('#sbtn .hov');
if (V) sbtn.style.top = '980px'; else sbtn.style.top = '560px'; if (V) sbtn.style.top = '980px'; else sbtn.style.top = '560px';
@ -570,6 +608,7 @@ function seek(t) {
shots(t); shots(t);
decl(t); decl(t);
desktop(t); desktop(t);
more(t);
endCards(t); endCards(t);
cursor(t); cursor(t);
captions(t); captions(t);

View file

@ -1,6 +1,8 @@
// The teaser video (media/teaser): the scan text it shows is the real `storebound scan` output of the teaser fixtures, // The teaser video (media/teaser): the scan text it shows is the real `storebound scan` output of the teaser fixtures,
// every cut sits on the beat grid, every caption is short and stays readable, every scene holds long enough. // every cut sits on the beat grid, every caption is short and stays readable, every scene holds long enough.
import { beforeAll, describe, expect, test } from 'bun:test'; import { beforeAll, describe, expect, test } from 'bun:test';
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path'; import { join } from 'node:path';
const ROOT = join(import.meta.dir, '..'); const ROOT = join(import.meta.dir, '..');
@ -16,6 +18,7 @@ interface Teaser {
SCAN_HEAD: { text: string }[]; SDKS: { name: string; what: string; dep: string; where: string }[]; SCAN_HEAD: { text: string }[]; SDKS: { name: string; what: string; dep: string; where: string }[];
RISKS_LINE: string; FINDINGS: Finding[]; RESCAN_LINE: string; RESCAN_NONE: string; RISKS_LINE: string; FINDINGS: Finding[]; RESCAN_LINE: string; RESCAN_NONE: string;
DECL_LINES: { what: string; value: string; where: string }[]; DECL_ASK: string; CMD: string; DECL_LINES: { what: string; value: string; where: string }[]; DECL_ASK: string; CMD: string;
MORE: { at: number; cmd: string; lines: string[]; stat: { text: string } }[]; MORE_CUTS: number[];
} }
const path: string = join(ROOT, 'media/teaser/script.js'); const path: string = join(ROOT, 'media/teaser/script.js');
const T = (await import(path)) as Teaser; const T = (await import(path)) as Teaser;
@ -30,6 +33,59 @@ const scanText = (dir: string, demo: boolean): string => {
let before = '', after = ''; let before = '', after = '';
beforeAll(() => { before = scanText('teaser', false); after = scanText('teaser-fixed', true); }); beforeAll(() => { before = scanText('teaser', false); after = scanText('teaser-fixed', true); });
/** Runs a CLI command as the montage shows it (`storebound …` -> bun cli/index.ts …), offline, no store keys. */
const run = (cmd: string, cwd: string): string => {
const env = { ...process.env, NO_COLOR: '1', ASC_KEY_ID: '', ASC_ISSUER_ID: '', ASC_P8: '', PLAY_SERVICE_ACCOUNT: '' };
const r = Bun.spawnSync(['bun', CLI, ...cmd.replace(/^storebound /, '').split(' ')], { cwd, env, stdout: 'pipe', stderr: 'pipe' });
expect(r.exitCode, cmd).toBe(0);
return r.stdout.toString() + r.stderr.toString();
};
/** A throwaway Capacitor project with an example.com config (as in tests/build-sign.test.ts) for `play build --dry`. */
function buildProject(): string {
const d = mkdtempSync(join(tmpdir(), 'sb-teaser-'));
const put = (f: string, body = ''): void => { mkdirSync(join(d, f, '..'), { recursive: true }); writeFileSync(join(d, f), body); };
put('storebound.config.ts', `export default { app: { name: 'Example', privacyPolicyUrl: 'https://example.com/p', supportUrl: 'https://example.com', website: 'https://example.com', contactEmail: 'hi@example.com' },
languages: [{ id: 'en', apple: 'en-US', play: 'en-US' }], apple: { bundleId: 'com.example.game' }, play: { packageName: 'com.example.game' } };\n`);
put('capacitor.config.ts', 'export default {}');
put('android/settings.gradle'); put('android/gradlew', '#!/bin/sh'); put('android/app/build.gradle');
return d;
}
describe('teaser: the CLI montage is real output', () => {
test('three panels, two cuts on the beat', () => {
expect(T.MORE).toHaveLength(3);
expect(T.MORE_CUTS).toEqual([T.MORE[1]!.at, T.MORE[2]!.at]);
const s = T.SCENES.find(x => x.id === 'more')!;
expect(T.MORE[0]!.at).toBe(s.start);
for (const t of T.MORE_CUTS) { expect(t).toBeGreaterThan(s.start); expect(t).toBeLessThan(s.end); }
});
test('`storebound api coverage`: the operation counts (revision dates left out)', () => {
const p = T.MORE[0]!;
expect(p.cmd).toBe('storebound api coverage');
const out = run(p.cmd, ROOT).replace(/ \(\d{8}\)/g, '');
for (const l of p.lines) expect(out).toContain(l);
const ops = (name: string): number => Number(out.match(new RegExp(`${name}[^:\n]*: (\\d+) operations`))![1]);
const apple = ops('App Store Connect API'), play = ops('Google Play Android Developer API') + ops('Google Play Developer Reporting API');
expect(p.stat.text).toBe(`*${apple}* App Store Connect + *${play}* Google Play endpoints`);
});
test('`storebound play build --dry`: the plan (clock and [build] prefix left out, the gradle flags trimmed)', () => {
const p = T.MORE[1]!;
expect(p.cmd).toStartWith('storebound play build --dry');
const d = buildProject();
try {
const out = run(p.cmd, d).split('\n').map(l => l.replace(/^\d\d:\d\d:\d\d \[build\] /, '').replace(/ \(\d+s\)$/, ''));
for (const l of p.lines) expect(out.some(o => o.startsWith(l)), l).toBe(true);
} finally { rmSync(d, { recursive: true, force: true }); }
});
test('`storebound console fill apple-app-privacy --dry` in examples/demo-app: answer lines (source column left out)', () => {
const p = T.MORE[2]!;
expect(p.cmd).toBe('storebound console fill apple-app-privacy --dry');
const out = run(p.cmd, join(ROOT, 'examples/demo-app')).split('\n').map(l => l.trim().replace(/\s+\([^()]*\)$/, ''));
for (const l of p.lines) expect(out).toContain(l);
expect(out.join('\n')).toContain('press Publish yourself');
});
});
describe('teaser: the scan text is real', () => { describe('teaser: the scan text is real', () => {
test('command, header, SDKs and the risks line come from `storebound scan` of tests/fixtures/scan/teaser', () => { test('command, header, SDKs and the risks line come from `storebound scan` of tests/fixtures/scan/teaser', () => {
expect(T.CMD).toBe('storebound scan'); expect(T.CMD).toBe('storebound scan');
@ -67,7 +123,7 @@ describe('teaser: timing', () => {
expect(T.SCENES.at(-1)!.end).toBeCloseTo(T.DURATION, 9); expect(T.SCENES.at(-1)!.end).toBeCloseTo(T.DURATION, 9);
for (const s of T.SCENES) expect(near(s.start), s.id).toBe(true); for (const s of T.SCENES) expect(near(s.start), s.id).toBe(true);
expect(T.DURATION).toBeGreaterThan(29); expect(T.DURATION).toBeGreaterThan(29);
expect(T.DURATION).toBeLessThan(35); expect(T.DURATION).toBeLessThan(38);
}); });
test('every scene holds at least 2.5 s', () => { test('every scene holds at least 2.5 s', () => {
for (const s of T.SCENES) expect(s.end - s.start, s.id).toBeGreaterThanOrEqual(2.5); for (const s of T.SCENES) expect(s.end - s.start, s.id).toBeGreaterThanOrEqual(2.5);