← Public packages
@kentcdodds/cloudflare-connect-personal-software-ecosystem
I Built Your Personal Software Ecosystem: Kent C. Dodds's Cloudflare Connect 2026 lightning talk deck (Reveal.js). How Kody gives every user one of everything on Cloudflare.
Files
// Opens the built Reveal.js deck in headless Chromium with all network access blocked, in both
// prefers-color-scheme light and dark and at 1920x1080 and 1280x720. For each it checks the theme,
// walks every slide with the keyboard (Space, so it goes down each vertical stack; showing every
// fragment), checks the stack position and slide number, and screenshots each one into
// <outDir>/<scheme>-<width>/. It checks 2D navigation (Down / Up within a stack, Left / Right
// between stacks, stack memory) and saves the overview (Esc) as <outDir>/overview-<scheme>.png. It also checks the T theme toggle, the speaker view (S), overview (O),
// deep links, loading with transitions on, and that the page carries no em dash (U+2014).
// For the animated widgets (four from kody.codes, four flow widgets of the deck's own) it checks ?static and reduced-motion stills, that only the
// current slide's widget animates, that clicks inside one change it but not the slide, and
// saves two animation frames of each into <outDir>/widgets-<scheme>-<width>/.
// It fails on text under 24px (36px at 1080p), console errors, any network request, missing fonts,
// content that overflows the slide, a slide without notes, or a hash that doesn't match.
// Usage: node scripts/verify.mjs [url-or-file] [outDir]
// Needs `playwright` (devDependency); set CHROMIUM_PATH to pick a browser binary.
import { mkdirSync, readFileSync, existsSync } from 'node:fs'
import { pathToFileURL } from 'node:url'
import { chromium } from 'playwright'
const target = process.argv[2] ?? 'dist/index.html'
const url = /^https?:|^file:/.test(target) ? target : pathToFileURL(target).href
const outDir = process.argv[3] ?? 'verify-shots'
const docPath = url.split(/[?#]/)[0]
const problems = []
const pad = (n) => String(n).padStart(2, '0')
const EM_DASH = '\u2014'
if (existsSync(target) && readFileSync(target, 'utf8').includes(EM_DASH)) problems.push(`${target} contains an em dash (U+2014)`)
const browser = await chromium.launch({ executablePath: process.env.CHROMIUM_PATH || undefined })
async function newContext(colorScheme, width = 1920, height = 1080) {
const context = await browser.newContext({ viewport: { width, height }, colorScheme })
// Only the deck page itself (including the speaker view's ?receiver frames) and data: URIs may load.
await context.route('**/*', (route) => {
const u = route.request().url()
if (u.startsWith('data:') || u.split(/[?#]/)[0] === docPath) return route.continue()
problems.push(`network request: ${u}`)
return route.abort()
})
return context
}
const watch = (p, name) => {
p.on('console', (m) => { if (m.type() === 'error') problems.push(`${name} console: ${m.text()}`) })
p.on('pageerror', (e) => problems.push(`${name} pageerror: ${e.message}`))
}
const ready = (p) => p.waitForFunction(() => window.__deck?.isReady() && document.fonts.status === 'loaded')
let ids = []
const wordCounts = []
for (const [w, h] of [[1920, 1080], [1280, 720]]) for (const scheme of ['dark', 'light']) {
const dir = `${outDir}/${scheme}-${w}`
mkdirSync(dir, { recursive: true })
const context = await newContext(scheme, w, h)
const page = await context.newPage()
watch(page, `${scheme} ${w} deck`)
await page.goto(`${docPath}?static`)
await ready(page)
const theme = await page.evaluate(() => document.documentElement.dataset.theme)
if (theme !== scheme) problems.push(`${scheme}: data-theme is ${theme}`)
ids = await page.evaluate(() => window.__deck.getSlides().map((s) => s.id))
// Expected stack position of every slide, from the markup: [h, v] per slide in order.
const positions = await page.evaluate(() =>
[...document.querySelectorAll('.reveal .slides > section')].flatMap((stack, h) => {
const inner = stack.querySelectorAll(':scope > section')
return inner.length ? [...inner].map((_, v) => [h, v]) : [[h, 0]]
}),
)
if (positions.length !== ids.length) problems.push(`${scheme} ${w}: ${positions.length} stack positions for ${ids.length} slides`)
const fonts = await page.evaluate(() => [...document.fonts].filter((f) => f.status === 'loaded').map((f) => f.family))
for (const fam of ['Bricolage Grotesque', 'Wix Madefor Text']) if (!fonts.some((f) => f.includes(fam))) problems.push(`font not loaded: ${fam}`)
for (let i = 0; i < ids.length; i++) {
if (i > 0) await page.keyboard.press('Space')
await page.waitForFunction((id) => location.hash === `#/${id}`, ids[i], { timeout: 3000 }).catch(() => {})
const hash = await page.evaluate(() => location.hash)
if (hash !== `#/${ids[i]}`) problems.push(`${scheme} ${w} slide ${i + 1}: hash ${hash} != #/${ids[i]}`)
const { h, v, number } = await page.evaluate(() => ({ ...window.__deck.getIndices(), number: document.querySelector('.reveal .slide-number')?.textContent.replace(/\s+/g, '') }))
if (h !== positions[i]?.[0] || v !== positions[i]?.[1]) problems.push(`${scheme} ${w} slide ${ids[i]}: at ${h}.${v}, expected ${positions[i]?.join('.')}`)
if (number !== `${i + 1}/${ids.length}`) problems.push(`${scheme} ${w} slide ${ids[i]}: slide number ${number}, expected ${i + 1}/${ids.length}`)
// Show every fragment, so the screenshot and the checks cover the slide's final state.
while (await page.evaluate(() => window.__deck.availableFragments().next)) await page.keyboard.press('ArrowRight')
await page.waitForTimeout(120)
const overflow = await page.evaluate(() => {
const slide = window.__deck.getCurrentSlide()
const box = slide.getBoundingClientRect()
const bad = []
for (const el of slide.querySelectorAll('*')) {
if (el.closest('aside.notes') || el.tagName === 'STYLE') continue
const r = el.getBoundingClientRect()
if (!r.width && !r.height) continue
if (r.right > box.right + 1 || r.bottom > box.bottom + 1 || r.left < box.left - 1 || r.top < box.top - 1) bad.push(`${el.tagName}.${el.className}`)
if (el.scrollWidth > el.clientWidth + 1 && !['visible', 'clip'].includes(getComputedStyle(el).overflowX) && el.tagName !== 'BODY') bad.push(`${el.tagName}.${el.className} scrolls sideways`)
}
return bad.slice(0, 5)
})
if (overflow.length) problems.push(`${scheme} ${w} slide ${ids[i]} overflows: ${overflow.join(', ')}`)
if (scheme === 'dark' && w === 1920) {
// Audience text: at least 24px on the 1280x720 canvas (36px at 1080p).
const { small, words } = await page.evaluate(() => {
const slide = window.__deck.getCurrentSlide()
const scale = slide.getBoundingClientRect().width / slide.offsetWidth
const small = new Set()
const walker = document.createTreeWalker(slide, NodeFilter.SHOW_TEXT)
let text = ''
while (walker.nextNode()) {
const node = walker.currentNode
const el = node.parentElement
if (!node.textContent.trim() || el.closest('aside.notes, style')) continue
text += ` ${node.textContent}`
// Widget labels follow the site's scale inside a 600 to 760px card: floor 11px.
if (parseFloat(getComputedStyle(el).fontSize) < (el.closest('.pw-host') ? 11 : 21.5)) small.add(`${el.tagName}.${el.className} "${node.textContent.trim().slice(0, 30)}"`)
}
return { small: [...small], words: text.split(/\s+/).filter((w) => /[\p{L}\p{N}]/u.test(w)).length, scale }
})
if (small.length) problems.push(`slide ${ids[i]} has text under 22px: ${small.join(', ')}`)
wordCounts.push(`${ids[i]}:${words}`)
const notes = await page.evaluate(() => window.__deck.getCurrentSlide().querySelector('aside.notes')?.textContent.trim() ?? '')
if (!notes) problems.push(`slide ${ids[i]} has no speaker notes`)
}
await page.screenshot({ path: `${dir}/${pad(i + 1)}-${ids[i]}.png` })
}
if (w === 1920) {
// T toggles the theme and back.
await page.keyboard.press('t')
const flipped = await page.evaluate(() => document.documentElement.dataset.theme)
if (flipped === scheme) problems.push(`${scheme}: T did not toggle the theme`)
await page.keyboard.press('t')
if ((await page.evaluate(() => document.documentElement.dataset.theme)) !== scheme) problems.push(`${scheme}: second T did not restore the theme`)
if ((await page.evaluate(() => localStorage.getItem('cf-connect-pse-theme'))) !== null) problems.push(`${scheme}: theme override not cleared`)
}
await context.close()
}
// Keyboard, overview, speaker view, deep links, transitions on.
const context = await newContext('dark')
const page = await context.newPage()
watch(page, 'deck')
await page.goto(`${docPath}?static`)
await ready(page)
await page.keyboard.press('End')
await page.keyboard.press('Home')
if ((await page.evaluate(() => window.__deck.getIndices().h)) !== 0) problems.push('Home did not go to slide 1')
await page.keyboard.press('o')
if (!(await page.evaluate(() => window.__deck.isOverview()))) problems.push('O did not open the overview')
await page.keyboard.press('Escape')
// 2D navigation. Each stack: Down walks to its bottom without leaving the column, Up walks back.
const stacks = await page.evaluate(() =>
[...document.querySelectorAll('.reveal .slides > section')].map((stack) => [...stack.querySelectorAll(':scope > section')].map((s) => s.id)),
)
for (const [h, column] of stacks.entries()) {
await page.evaluate((h) => window.__deck.slide(h, 0), h)
for (let v = 1; v < column.length; v++) {
await page.evaluate(() => { while (window.__deck.availableFragments().next) window.__deck.nextFragment() })
await page.keyboard.press('ArrowDown')
const at = await page.evaluate(() => ({ ...window.__deck.getIndices(), id: window.__deck.getCurrentSlide().id }))
if (at.h !== h || at.v !== v || at.id !== column[v]) problems.push(`Down in stack ${h + 1} went to ${at.id} (${at.h}.${at.v}), expected ${column[v]}`)
}
const before = await page.evaluate(() => window.__deck.getIndices())
await page.keyboard.press('ArrowDown')
if ((await page.evaluate(() => window.__deck.getIndices().h)) !== h) problems.push(`Down at the bottom of stack ${h + 1} left the column`)
await page.evaluate(({ h, v }) => window.__deck.slide(h, v), { h: before.h, v: before.v })
for (let v = column.length - 2; v >= 0; v--) {
// Up hides a slide's shown fragments before it moves (Reveal's behaviour), so hide them first.
await page.evaluate(() => { while (window.__deck.availableFragments().prev) window.__deck.prevFragment() })
await page.keyboard.press('ArrowUp')
const at = await page.evaluate(() => window.__deck.getIndices())
if (at.h !== h || at.v !== v) problems.push(`Up in stack ${h + 1} went to ${at.h}.${at.v}, expected ${h}.${v}`)
}
}
// Right moves to the next column's top; Left comes back to the slide last seen in a stack.
const deepStack = stacks.findIndex((c) => c.length >= 3)
await page.evaluate((h) => window.__deck.slide(h, 2), deepStack)
await page.evaluate(() => { while (window.__deck.availableFragments().next) window.__deck.nextFragment() })
await page.keyboard.press('ArrowRight')
const right = await page.evaluate(() => window.__deck.getIndices())
if (right.h !== deepStack + 1 || right.v !== 0) problems.push(`Right from stack ${deepStack + 1} went to ${right.h}.${right.v}, expected ${deepStack + 1}.0`)
await page.evaluate(() => { while (window.__deck.availableFragments().prev) window.__deck.prevFragment() })
await page.keyboard.press('ArrowLeft')
const left = await page.evaluate(() => window.__deck.getIndices())
if (left.h !== deepStack || left.v !== 2) problems.push(`Left back to stack ${deepStack + 1} went to ${left.h}.${left.v}, expected ${deepStack}.2 (stack memory)`)
// Overview (Esc) shows one column per stack.
for (const scheme of ['dark', 'light']) {
const oc = await newContext(scheme)
const op = await oc.newPage()
watch(op, `overview ${scheme}`)
await op.goto(`${docPath}?static#/cloudflare-runtime`)
await ready(op)
await op.keyboard.press('Escape')
await op.waitForFunction(() => window.__deck.isOverview())
await op.waitForTimeout(600)
const columns = await op.evaluate(() => document.querySelectorAll('.reveal .slides > section').length)
if (columns !== stacks.length) problems.push(`overview ${scheme}: ${columns} columns, expected ${stacks.length}`)
// Reveal's overview zooms around the current slide, so for the screenshot only, zoom out until
// every column fits (same transform Reveal uses, smaller scale, centred on the whole grid).
await op.evaluate(() => {
const slides = document.querySelector('.reveal .slides')
const stacks = [...slides.querySelectorAll(':scope > section')]
const offset = (el, axis) => Number(el.style.transform.match(/translate3d\(([-\d.]+)px, ([-\d.]+)px/)?.[axis] ?? 0)
const pitchX = offset(stacks[1], 1)
const tallest = stacks.reduce((a, s) => (s.children.length > a.children.length ? s : a))
const rows = tallest.querySelectorAll(':scope > section').length
const pitchY = offset(tallest.querySelectorAll(':scope > section')[1], 2)
const base = Number(slides.style.transform.match(/scale\(([\d.]+)\)/)[1])
const fit = Math.min((innerWidth * 0.96) / (pitchX * stacks.length), (innerHeight * 0.94) / (pitchY * rows)) / base
slides.style.transform = `translate(-50%, -50%) scale(${base}) scale(${fit}) translateX(${-pitchX * (stacks.length - 1) / 2}px) translateY(${-pitchY * (rows - 1) / 2}px)`
})
await op.waitForTimeout(400)
await op.screenshot({ path: `${outDir}/overview-${scheme}.png` })
await oc.close()
}
await page.evaluate(() => {
const { h, v } = window.__deck.getIndices(document.getElementById('secret-gateway'))
window.__deck.slide(h, v)
})
if ((await page.evaluate(() => window.__deck.getCurrentSlide().id)) !== 'secret-gateway') problems.push('could not open secret-gateway for the speaker view')
const [popup] = await Promise.all([context.waitForEvent('page'), page.keyboard.press('s')])
watch(popup, 'speaker')
await popup.waitForLoadState()
try {
await popup.waitForFunction(() => document.querySelector('.speaker-controls-notes .value')?.textContent.includes('materialize at egress'), null, { timeout: 15000 })
const frame = popup.frames().find((f) => f.url().includes('receiver'))
if (!frame) problems.push('speaker view: no current-slide frame')
else {
await frame.waitForFunction(() => window.__deck?.isReady(), null, { timeout: 15000 })
const cur = await frame.evaluate(() => window.__deck.getCurrentSlide().id)
if (cur !== 'secret-gateway') problems.push(`speaker view current slide is ${cur}, expected secret-gateway`)
}
await popup.waitForTimeout(800)
await popup.screenshot({ path: `${outDir}/speaker-view.png` })
} catch (e) {
problems.push(`speaker view did not render notes: ${e.message.split('\n')[0]}`)
}
for (const link of ['#/title', '#/cloudflare-runtime', '#/cloudflare-data', '#one-of-everything', '#/worker-loader', `#${ids.at(-1)}`]) {
const p = await context.newPage()
watch(p, 'transitions')
await p.goto(`${docPath}${link}`) // no ?static: transitions on
await ready(p)
const got = await p.evaluate(() => window.__deck.getCurrentSlide().id)
if (got !== link.replace(/^#\/?/, '')) problems.push(`deep link ${link} opened ${got}`)
if ((await p.evaluate(() => window.__deck.getConfig().transition)) !== 'slide') problems.push('default transition is not slide')
await p.close()
}
// Widgets: in ?static every one is a finished still; with motion, only the current slide's widget
// animates, entering restarts it, clicks swap state without moving the deck, and reduced motion
// gets the still.
{
const widgetSlides = await page.evaluate(() => window.__widgets.map((w) => w.slide.id))
if (widgetSlides.length !== 8) problems.push(`expected 8 widgets, found ${widgetSlides.length}`)
const sp = await context.newPage()
watch(sp, 'static widgets')
await sp.goto(`${docPath}?static#/${widgetSlides[0]}`)
await ready(sp)
const st = await sp.evaluate(() => window.__widgets.map((w) => ({ motion: 'motion' in w.pw.dataset, key: w.key, still: w.still, running: document.getAnimations().filter((a) => a.playState === 'running' && w.el.contains(a.effect?.target)).length })))
for (const [i, w] of st.entries()) if (w.motion || w.key !== w.still || w.running) problems.push(`?static widget on ${widgetSlides[i]}: motion ${w.motion}, state ${w.key} (still ${w.still}), ${w.running} running animations`)
await sp.close()
const rc = await browser.newContext({ viewport: { width: 1280, height: 720 }, reducedMotion: 'reduce' })
const rp = await rc.newPage()
await rp.goto(`${docPath}#/${widgetSlides[1]}`)
await ready(rp)
await rp.waitForTimeout(1200)
const soft = await rp.evaluate(() => { const w = window.__widgets.find((x) => x.slide === window.__deck.getCurrentSlide()); return { motion: 'motion' in w.pw.dataset, soft: 'soft' in w.pw.dataset, running: document.getAnimations().filter((a) => a.playState === 'running' && w.el.contains(a.effect?.target)).length } })
if (!soft.motion || !soft.soft || !soft.running) problems.push(`prefers-reduced-motion: widget should keep running, softened (${JSON.stringify(soft)})`)
await rc.close()
for (const [w, h] of [[1920, 1080], [1280, 720]]) for (const scheme of ['dark', 'light']) {
const wc = await newContext(scheme, w, h)
const wp = await wc.newPage()
watch(wp, `${scheme} ${w} widgets`)
const dir = `${outDir}/widgets-${scheme}-${w}`
mkdirSync(dir, { recursive: true })
for (const id of widgetSlides) {
await wp.goto(`${docPath}#/${id}`)
await ready(wp)
await wp.waitForTimeout(1500)
await wp.screenshot({ path: `${dir}/${id}-a.png` })
const state = await wp.evaluate((id) => {
const all = window.__widgets
const mine = all.find((w) => w.slide.id === id)
const elsewhere = document.getAnimations().filter((a) => a.playState === 'running' && all.some((w) => w !== mine && w.el.contains(a.effect?.target))).length
return { motion: 'motion' in mine.pw.dataset, paused: 'paused' in mine.pw.dataset, others: all.filter((w) => w !== mine && w.active).length, elsewhere, running: document.getAnimations().filter((a) => a.playState === 'running' && mine.el.contains(a.effect?.target)).length }
}, id)
if (!state.motion || state.paused || !state.running) problems.push(`${scheme} ${w} ${id}: widget not animating (${JSON.stringify(state)})`)
if (state.others || state.elsewhere) problems.push(`${scheme} ${w} ${id}: ${state.others} other widgets active, ${state.elsewhere} off-slide animations running`)
await wp.waitForTimeout(7500)
await wp.screenshot({ path: `${dir}/${id}-b.png` })
const overflow = await wp.evaluate(() => {
const box = window.__deck.getCurrentSlide().getBoundingClientRect()
return [...window.__deck.getCurrentSlide().querySelectorAll('.pw-host, .pw-host *')].filter((el) => {
const r = el.getBoundingClientRect()
return (r.width || r.height) && (r.right > box.right + 1 || r.bottom > box.bottom + 1 || r.left < box.left - 1 || r.top < box.top - 1)
}).length
})
if (overflow) problems.push(`${scheme} ${w} ${id}: widget overflows the slide mid-animation`)
if (scheme === 'dark' && w === 1920) {
// Clicking a control or the card itself changes the widget, never the slide.
const before = await wp.evaluate(() => JSON.stringify(window.__deck.getIndices()))
const keyBefore = await wp.evaluate((id) => window.__widgets.find((w) => w.slide.id === id).key, id)
const target = await wp.evaluate((id) => {
const host = window.__widgets.find((w) => w.slide.id === id)
const buttons = [...host.el.querySelectorAll('[data-pw-go]')]
const pick = buttons.find((b) => b.dataset.pwGo !== host.key && b.dataset.pwGo !== host.key.split('-')[0]) ?? buttons[0]
const r = pick.getBoundingClientRect()
return [r.x + r.width / 2, r.y + r.height / 2]
}, id)
await wp.mouse.click(...target)
const card = await wp.evaluate((id) => { const r = window.__widgets.find((w) => w.slide.id === id).pw.getBoundingClientRect(); return [r.x + 12, r.y + 12] }, id)
await wp.mouse.click(...card)
await wp.waitForTimeout(700)
const after = await wp.evaluate(() => JSON.stringify(window.__deck.getIndices()))
const keyAfter = await wp.evaluate((id) => window.__widgets.find((w) => w.slide.id === id).key, id)
if (after !== before) problems.push(`${id}: clicking inside the widget moved the deck ${before} -> ${after}`)
if (keyAfter === keyBefore) problems.push(`${id}: clicking a control left the widget on ${keyBefore}`)
await wp.screenshot({ path: `${dir}/${id}-clicked.png` })
// The clicker still works right after a click.
await wp.keyboard.press('ArrowRight')
await wp.waitForTimeout(300)
if ((await wp.evaluate(() => JSON.stringify(window.__deck.getIndices()))) === before) problems.push(`${id}: Right did not move on after a widget click`)
const left = await wp.evaluate((id) => { const w = window.__widgets.find((x) => x.slide.id === id); return { active: w.active, paused: 'paused' in w.pw.dataset, timer: w.timer } }, id)
if (left.active || !left.paused) problems.push(`${id}: widget still running after leaving its slide`)
}
}
await wc.close()
}
}
// Phones: Chromium as Chrome on Android (Pixel 7, touch) in portrait, where Reveal switches to its
// scroll view under 435px, and landscape, each with and without reduced motion (Android's
// "Remove animations"); WebKit as an iPhone 15 as a second engine. Every widget slide is
// opened by deep link and reached by swiping (scrolling in portrait, a touch swipe in
// landscape); its widget must animate, and a tap on a control must change it, not the slide.
{
const { devices, webkit } = await import('playwright')
const engines = [['chromium', browser, ['Pixel 7', 'Pixel 7 landscape']]]
try {
engines.push(['webkit', await webkit.launch(), ['iPhone 15', 'iPhone 15 landscape']])
} catch (e) {
problems.push(`WebKit not available for the mobile check (npx playwright install webkit): ${e.message.split('\n')[0]}`)
}
const widgetIds = await page.evaluate(() => window.__widgets.map((w) => w.slide.id))
const widgetState = (p) => p.evaluate(() => {
const cur = window.__deck.getCurrentSlide()
const w = window.__widgets.find((x) => x.slide === cur)
return { id: cur.id, motion: !!w && 'motion' in w.pw.dataset, key: w?.key, running: w ? document.getAnimations().filter((a) => a.playState === 'running' && w.el.contains(a.effect?.target)).length : 0 }
})
for (const [engine, b, devs] of engines) for (const dev of devs) for (const reducedMotion of ['no-preference', 'reduce']) {
const { defaultBrowserType, ...opts } = devices[dev]
const mc = await b.newContext({ ...opts, reducedMotion })
await mc.route('**/*', (route) => (route.request().url().startsWith('data:') || route.request().url().split(/[?#]/)[0] === docPath ? route.continue() : route.abort()))
const label = `${engine} ${dev} ${reducedMotion}`
const orient = dev.includes('landscape') ? 'landscape' : 'portrait'
const dir = `${outDir}/mobile-${engine}-${orient}`
mkdirSync(dir, { recursive: true })
for (const id of widgetIds) {
const mp = await mc.newPage()
watch(mp, label)
await mp.goto(`${docPath}#/${id}`)
await ready(mp)
await mp.waitForTimeout(1500)
const st = await widgetState(mp)
if (st.id !== id || !st.motion || !st.running) problems.push(`${label} #/${id}: ${JSON.stringify(st)}`)
if (reducedMotion === 'no-preference') await mp.screenshot({ path: `${dir}/${id}.png` })
if (reducedMotion === 'no-preference') {
// Tap a control: the widget changes, the slide doesn't.
const tap = await mp.evaluate(() => {
const w = window.__widgets.find((x) => x.slide === window.__deck.getCurrentSlide())
const btn = [...w.el.querySelectorAll('[data-pw-go]')].find((b) => b.dataset.pwGo !== w.key && b.dataset.pwGo !== w.key.split('-')[0])
const r = btn.getBoundingClientRect()
return [r.x + r.width / 2, r.y + r.height / 2]
})
await mp.touchscreen.tap(...tap)
await mp.waitForTimeout(500)
const after = await widgetState(mp)
if (after.id !== id || after.key === st.key) problems.push(`${label} #/${id}: tap on a control went from ${st.id}/${st.key} to ${after.id}/${after.key}`)
}
await mp.close()
}
if (reducedMotion === 'no-preference') {
// Swipe through the deck from the start and check each widget as it comes up.
const mp = await mc.newPage()
watch(mp, `${label} swipe`)
await mp.goto(docPath)
await ready(mp)
const seen = new Set()
for (let step = 0; step < 80 && seen.size < widgetIds.length; step++) {
if (orient === 'portrait') {
await mp.evaluate(() => { const vp = document.querySelector('.reveal-viewport'); vp.scrollBy(0, vp.clientHeight) })
} else {
// A finger swipe as the browser reports it to Reveal: touch pointer events.
const vp = mp.viewportSize()
const swipe = (from, to) => mp.evaluate(([from, to]) => {
const el = document.querySelector('.reveal .slides')
const fire = (type, [x, y]) => el.dispatchEvent(new PointerEvent(type, { pointerType: 'touch', isPrimary: true, pointerId: 7, clientX: x, clientY: y, bubbles: true, cancelable: true }))
fire('pointerdown', from)
fire('pointermove', [(from[0] + to[0]) / 2, (from[1] + to[1]) / 2])
fire('pointermove', to)
fire('pointerup', to)
}, [from, to])
// Swipe up within a column when there's a slide below, else swipe left.
if (await mp.evaluate(() => window.__deck.availableRoutes().down)) await swipe([vp.width / 2, vp.height * 0.8], [vp.width / 2, vp.height * 0.2])
else await swipe([vp.width * 0.8, vp.height / 2], [vp.width * 0.2, vp.height / 2])
}
await mp.waitForTimeout(900)
const st = await widgetState(mp)
if (widgetIds.includes(st.id) && !seen.has(st.id)) {
seen.add(st.id)
if (!st.motion || !st.running) problems.push(`${label} swiped to ${st.id}: widget not animating ${JSON.stringify(st)}`)
}
}
if (seen.size !== widgetIds.length) problems.push(`${label}: swiping reached only ${[...seen].join(', ')}`)
await mp.close()
}
await mc.close()
}
for (const [engine, b] of engines) if (engine !== 'chromium') await b.close()
}
const html = await page.content()
if (html.includes(EM_DASH)) problems.push('rendered page contains an em dash (U+2014)')
await browser.close()
console.log(`Words per slide: ${wordCounts.join(' ')}`)
if (problems.length) {
console.error([...new Set(problems)].join('\n'))
process.exit(1)
}
console.log(`OK: ${ids.length} slides in ${stacks.length} vertical stacks (2D navigation, stack memory, slide numbers) in light and dark at 1920x1080 and 1280x720, speaker view, T toggle, widgets (static stills, softened reduced motion, Android and iPhone emulation, one animating at a time, clicks stay in the widget), no network requests, no overflow, no em dash. Screenshots in ${outDir}/`)