tracker
All repositories: gitoria
5.5 KB
// tests/realdata-066.mjs — tracker#19 (mission 066), NOT the gate: on a COPY of live storage/ after the collection seed ran// (STATUS.md ticket #19 has the procedure). At 390 + 1280: full loads (×3) of /franchises, the timelines whose name matches// REAL_MATCH (default "Star Wars|Alien"), a movie page of each (the widget: prev / name / next read from the page), the release// toggle on the timeline page; signed in as the creator (cookie from .scratch/real-sid, if there) /franchises shows "Edit" and// /franchises/edit its forms. Screenshots → $REAL_OUT. Env: REAL_PORT (8738), REAL_CHROME (8739), REAL_OUT (/tmp/w066/real).import { writeFileSync, readFileSync, mkdirSync, existsSync } from 'node:fs';import { launchBrowser } from './cdp.mjs';process.env.HL_CHROME ||= '/opt/google/chrome/chrome';const BASE = `http://127.0.0.1:${process.env.REAL_PORT || 8738}`, OUT = process.env.REAL_OUT || '/tmp/w066/real';const MATCH = new RegExp(process.env.REAL_MATCH || 'Star Wars|Alien');mkdirSync(OUT, { recursive: true });const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8739), Number(process.env.REAL_CHROME || 8739)] });const page = await browser.newPage();const ev = (e) => page.evaluate(e);const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 60000, label: 'hydrated' });const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));const load = async (path) => { const t = Date.now(); await page.goto(BASE + path, { timeout: 60000 }); await hydrated(); return Date.now() - t; };const out = [];await load('/franchises');const timelines = JSON.parse(await ev(`JSON.stringify(Array.from(document.querySelectorAll('#timeline-list a.timeline-link')).map(a => ({ name: a.querySelector('timeline-link-name').textContent, href: a.getAttribute('href'), n: a.querySelector('timeline-link-count').textContent })))`));out.push(`/franchises: ${timelines.length} timelines listed, ${await ev(`document.querySelectorAll('#franchise-list a').length`)} franchises; html ${(await (await fetch(BASE + '/franchises')).text()).length} bytes`);const picked = timelines.filter(t => MATCH.test(t.name));out.push('matching: ' + picked.map(t => `${t.name} (${t.n})`).join(', '));for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });const times = [await load('/franchises'), await load('/franchises'), await load('/franchises')];out.push(`${w} /franchises full loads ms: ${times.join(' / ')}; scrollWidth ${await ev('document.documentElement.scrollWidth')}`);await shot(`franchises-${w}`);for (const t of picked) {const tt = [await load(t.href), await load(t.href)];const items = await ev(`Array.from(document.querySelectorAll('a.timeline-item')).map(a => a.querySelector('film-title').textContent + ' ' + a.querySelector('.timeline-date').textContent).join(' | ')`);out.push(`${w} ${t.href} (${tt.join(' / ')} ms): ${items}`);await shot(`timeline-${t.href.split('/').pop()}-${w}`);await ev(`document.querySelector('timeline-head button[value="release"]').click()`);await new Promise(r => setTimeout(r, 300));out.push(`${w} release order: ` + await ev(`Array.from(document.querySelectorAll('a.timeline-item')).map(a => a.querySelector('film-title').textContent).join(' | ')`));// the 2nd title's page (it has both a prequel and, if there are ≥ 3, a sequel)await load(t.href);const target = await ev(`(document.querySelectorAll('a.timeline-item')[1] || document.querySelector('a.timeline-item')).getAttribute('href')`);const mt = [await load(target), await load(target)];const wd = await ev(`JSON.stringify(Array.from(document.querySelectorAll('franchise-widget')).map(w => [w.querySelector('.fw-prev').textContent.trim().replace(/\\s+/g, ' '), w.querySelector('a.fw-timeline').textContent, w.querySelector('.fw-next').textContent.trim().replace(/\\s+/g, ' ')].join(' | ')))`);out.push(`${w} ${target} (${mt.join(' / ')} ms) widget: ${wd}; scrollWidth ${await ev('document.documentElement.scrollWidth')}`);await ev(`document.querySelector('franchise-widget') && document.querySelector('franchise-widget').scrollIntoView({ block: 'center' })`);await shot(`widget-${target.split('/').pop()}-${w}`);}}if (existsSync('.scratch/real-sid')) {await page.send('Network.setCookie', { name: 'trackersid', value: readFileSync('.scratch/real-sid', 'utf8').trim(), url: BASE });for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });const t1 = await load('/franchises');const edit = await ev(`!!document.querySelector('#franchises-edit')`);const t2 = await load('/franchises/edit');out.push(`${w} creator: /franchises ${t1} ms, Edit link ${edit}; /franchises/edit ${t2} ms, forms ${await ev(`!!document.querySelector('#fe-name')`)}`);await shot(`franchise-edit-creator-${w}`);if (picked[0]) { await load(picked[0].href + '/edit'); out.push(`${w} creator: ${picked[0].href}/edit rows ${await ev(`document.querySelectorAll('#edit-rows edit-row').length`)}`); await shot(`timeline-edit-creator-${w}`); }}}console.log(out.join('\n'));console.log('problems', JSON.stringify(page.problems ? page.problems() : []));await browser.close();
Branches
Latest commits
- 6e72f9d1Merge hm65-fields: episode boot scan reads three fieldsmre
- 07a5c883HM65 report measured field projection and complete validationmre
- 0eab858fRead only catalog date fields during the episode boot scanmre
- d3179273log: HM65 hl:heap vendoringmre
- cb78a1a0HM65 report missing heap diagnostic package with repromre
- 89606a5cHM65 briefmre
- 096ce0d4log: DP69 live on day48mre
- b3d8a80bDP69 brief, RV48 mergedmre
- ce6d7d32Merge rv48: Hybriel day48mre
- 3da2ea86RV48: report day48 cold starts, gates and cleanupmre
- 8d9ecdfeRV48: re-vendor Hybriel set day48 (source b6a8f429, bin 660a9524)mre
- 4a802ae7status: RV48 runningmre
- 0a5412b6RV48 brief, day48 outmre
- 56665efelog: CB69 mergedmre
- 05448a98Merge cb69-imports: appTitle in a dependency-free topicmre
- e55b379dKeep shared app title independent of the route import graphmre
- 9a99659blog: hybriel#334, batch waits for day48mre
- 85fa6c9blog: CB68 result, CB69 startedmre
- 2f07c1b7log: DP68 boot gate failed, CB68mre
- 9652782dlog: HM59 merged, DP68 startedmre