mirror of
https://github.com/hanzoai/site.git
synced 2026-11-20 21:14:28 +00:00
* Type scripts under strict Playwright's API the checks use is declared in host.ts (the package is the app repo's); caught errors read through why(). tabs-tree.test waits for the typed tabsTree. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the shared components under strict Window globals (__lenis, __hzHold, google) and the two react-dom calls are declared in components/*.d.ts, since @types/react-dom is not a dependency and the lockfile is frozen. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type components/v2 under strict Props, state, refs and DOM events in the 93 v2 files. A2Motion's easing tuples are as const. Two real bugs: x-archimedes/MaskLines imported a NoJs that does not exist, and x-hypatia/PinChapters returned the element from a ref callback, which React 19 reads as a cleanup. AppSheet no longer sets aria-label to a JSX label. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type components/home under strict The race, cost and frontier figures, the plan cards, the repository card and the product stories take Run, Models and Plan types from lib. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Type the hero devices and the app routes under strict HeroScene and its parts describe hero-scenes.json; the [slug] pages take params as a Promise, and metadata and viewport carry Next's types. Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Give the integrations previews their Preview type Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk * Use the bench Card type for the closing cards Claude-Session: https://claude.ai/code/session_015XYKLix9PSyn6Jw2HWKprk
32 lines
1.9 KiB
TypeScript
32 lines
1.9 KiB
TypeScript
// Click-to-open check: from each page, click a model card, land on the model page, press ✕, and expect to fly back to
|
|
// the same page and scroll position. Usage: node scripts/opener.mjs (dev server on :4180)
|
|
import puppeteer from 'puppeteer-core';
|
|
import { lock } from './lock.ts';
|
|
import { why } from './why.ts';
|
|
await lock();
|
|
const b = await puppeteer.launch({ executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', headless: true, args: ['--use-gl=angle'] });
|
|
let bad = 0;
|
|
for (const [from, sel] of [['/', '.x-mgrid [data-card]'], ['/models/', '.xmo-tile[data-card]']]) {
|
|
const page = await b.newPage();
|
|
await page.setViewport({ width: 1470, height: 900 });
|
|
try {
|
|
await page.goto('http://localhost:4180' + from, { waitUntil: 'networkidle2', timeout: 120000 });
|
|
const y = await page.evaluate(async (sel) => { const c = document.querySelector(sel)!; c.scrollIntoView({ block: 'center' }); await new Promise((r) => setTimeout(r, 900)); return Math.round(scrollY); }, sel);
|
|
const slug = await page.$eval(sel, (c) => (c as HTMLElement).dataset.card);
|
|
await page.click(sel);
|
|
await page.waitForFunction((s) => location.pathname.replace(/\/$/, '') === '/' + s, { timeout: 15000 }, slug);
|
|
await page.waitForSelector('.x-mclose', { timeout: 15000 });
|
|
await new Promise((r) => setTimeout(r, 1500));
|
|
await page.click('.x-mclose');
|
|
await page.waitForFunction((f) => location.pathname === f, { timeout: 15000 }, from);
|
|
await new Promise((r) => setTimeout(r, 2200));
|
|
const back = await page.evaluate(() => Math.round(scrollY));
|
|
const ok = Math.abs(back - y) < 80;
|
|
if (!ok) bad++;
|
|
console.log(`${from} -> /${slug} -> ${from}: ${ok ? 'OK' : 'PROBLEM'} scroll ${y} -> ${back}`);
|
|
} catch (e) { bad++; console.log(`${from}: FAILED ${why(e, 140)}`); }
|
|
finally { await page.close(); }
|
|
}
|
|
await b.close();
|
|
process.exit(bad ? 1 : 0);
|