aboutsummaryrefslogtreecommitdiffstats
path: root/tools/media-grid-dups-test.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-22 09:38:19 -0700
committerAdam Soltys <[email protected]>2026-10-22 09:38:19 -0700
commit6a5f1e64d14d6295b0c641809fd375e2d513ef79 (patch)
tree306acce609761f668b1aa1efd5fec878cc202032 /tools/media-grid-dups-test.js
parent210c2978a1a608f27e2caeb4eb39fffdc28347bc (diff)
downloadcoinosv3-6a5f1e64d14d6295b0c641809fd375e2d513ef79.tar.gz
coinosv3-6a5f1e64d14d6295b0c641809fd375e2d513ef79.zip
Videos grid: a clip whose host says it's deleted (404/410) is left out for a day instead of sitting there as a blank tile
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'tools/media-grid-dups-test.js')
-rw-r--r--tools/media-grid-dups-test.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/media-grid-dups-test.js b/tools/media-grid-dups-test.js
index 360ae0c..0077f48 100644
--- a/tools/media-grid-dups-test.js
+++ b/tools/media-grid-dups-test.js
@@ -30,6 +30,7 @@ const server = Bun.serve({ port: 0, fetch: (req) => {
const a = +range[1], b = range[2] ? Math.min(+range[2], f.size - 1) : f.size - 1;
return new Response(f.slice(a, b + 1), { status: 206, headers: { 'content-type': 'video/webm', 'accept-ranges': 'bytes', 'content-range': 'bytes ' + a + '-' + b + '/' + f.size, 'content-length': String(b - a + 1) } });
}
+ if (path === '/dead.webm') return new Response('gone', { status: 404 });
if (path === '/still.png') return new Response(png, { headers: { 'content-type': 'image/png' } });
if (path.startsWith('/punks') || path === '/verify-worker.js') return new Response(Bun.file('dist' + path));
return new Response(html, { headers: { 'content-type': 'text/html' } });
@@ -45,6 +46,8 @@ const seeded = [
post('Transylvania lightning conference 2026 ' + U('again'), U('again'), 200),
post('Transylvania lightning conference 2026 ' + U('other'), U('other'), 300),
post('the last clip ' + U('last'), U('last'), 400),
+ // a clip its host has since deleted (it says so: 404) — no blank tile for it
+ finalizeEvent({ kind: 1, created_at: now - 500, tags: [['imeta', 'url ' + U('dead'), 'm video/webm', 'dim 320x180']], content: 'deleted since ' + U('dead') }, SK),
];
const browser = await puppeteer.launch({ executablePath: '/usr/bin/google-chrome', headless: 'new', args: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] });
@@ -80,12 +83,13 @@ try {
await page.reload({ waitUntil: 'domcontentloaded' });
await waitText('receive', 20000);
await page.evaluate(() => document.querySelector('.app-nav-button[aria-label="Feed"]').click());
- check('the clips are in the feed', await waitFor(() => document.querySelectorAll('.notes-feed video.note-video').length >= 6, null, 20000));
+ check('the clips are in the feed', await waitFor(() => document.querySelectorAll('.notes-feed video.note-video').length >= 7, null, 20000));
await page.evaluate(() => document.querySelector('.media-mode[data-mode="videos"]').click());
await waitFor(() => document.querySelectorAll('.media-grid .media-tile').length >= 3, null, 15000);
+ await waitFor(() => document.querySelectorAll('.media-grid .media-tile').length === 3, null, 8000);
await sleep(1500);
const tiles = await page.evaluate(() => document.querySelectorAll('.media-grid .media-tile').length);
- check('one tile per clip: the reposted file once, the re-uploaded post once, the other one', tiles === 3, tiles + ' tiles');
+ check('one tile per clip: the reposted file once, the re-uploaded post once, the other one, none for the deleted one', tiles === 3, tiles + ' tiles');
await page.evaluate(() => document.querySelector('.media-grid .media-tile').click());
check('the pager opens', await waitFor(() => !!document.querySelector('.mp-slide.mp-cur video.mp-media'), null, 6000));
check('the clip is drawn no bigger than 1.5× its pixels', await waitFor(() => { const v = document.querySelector('.mp-slide.mp-cur video.mp-media'); return v && v.videoWidth && v.getBoundingClientRect().width <= v.videoWidth * 1.5 + 1 && v.style.maxWidth; }, null, 8000),