tracker
All repositories: gitoria
7.0 KB
// tests/realdata-062.mjs — mission 062 (t26 merged: #26 + #28 + guests lazy + lean watch clicks), NOT the gate: on a COPY of live// storage/ (STATUS.md has the procedure), signed in (cookie from .scratch/real-sid). Per width (390, 1280): full load of a series// (REAL_SERIES) and a movie (REAL_MOVIE) + screenshots; on the series "Show all" and a click on its first GUEST (a /person/tmdb/…// link) → the person page (created on that click, filled from TMDB) — time + screenshot. Then WATCH clicks (episode check, 6 ×,// alternating = the state is back afterwards) and FOLLOW clicks (2 ×) on REAL_CLICK (Picard, The Simpsons): ms from the click until// the answer's websocket frame arrived (page clock), and the bytes the browser received for it. Screenshots → $REAL_OUT.// Env: REAL_PORT (8730), REAL_CHROME (8731), REAL_OUT (/tmp/w062/real), REAL_SERIES (Star-Trek-Picard), REAL_MOVIE (Superman),// REAL_CLICK (Star-Trek-Picard,The-Simpsons).import { writeFileSync, readFileSync, mkdirSync } 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 || 8730}`, OUT = process.env.REAL_OUT || '/tmp/w062/real';const SID = readFileSync('.scratch/real-sid', 'utf8').trim();const SERIES = process.env.REAL_SERIES || 'Star-Trek-Picard', MOVIE = process.env.REAL_MOVIE || 'Superman';const CLICK = (process.env.REAL_CLICK || 'Star-Trek-Picard,The-Simpsons').split(',').filter(Boolean);mkdirSync(OUT, { recursive: true });const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8731), Number(process.env.REAL_CHROME || 8731)] });const page = await browser.newPage();await page.captureWs();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 imgsDone = () => page.waitFor(`Array.from(document.querySelectorAll('img')).filter(i => { const r = i.getBoundingClientRect(); return r.top < innerHeight && r.bottom > 0 }).every(i => i.complete)`, { timeout: 30000, label: 'imgs' }).catch(() => {});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(); await imgsDone(); return Date.now() - t; };const castInfo = () => ev(`JSON.stringify({ h1: (document.querySelector('show-header h1') || {}).textContent, cast: document.querySelectorAll('show-cast a.artist-link').length,guests: document.querySelectorAll('show-cast a.artist-link[href^="/person/tmdb/"]').length, crew: document.querySelectorAll('show-crew a.crew-link').length,shortId: (document.querySelector('#shortid') || {}).textContent || null })`).then(JSON.parse);await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });const out = [];let guestDone = false;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 });for (const slug of [SERIES, MOVIE]) {const ms = await load('/shows/' + slug);const html = (await (await fetch(BASE + '/shows/' + slug, { headers: { cookie: 'trackersid=' + SID } })).text()).length;await shot(`${slug}-${w}`);await ev(`(document.querySelector('show-crew') || document.querySelector('show-cast') || document.body).scrollIntoView()`);await shot(`${slug}-credits-${w}`);out.push(`${w} /shows/${slug}: full load ${ms} ms, HTML ${html} bytes, ${JSON.stringify(await castInfo())}`);}// a guest star: Show all, the first /person/tmdb/ link → the person page (created by THIS click on the first width, found after)await load('/shows/' + SERIES);if (await ev(`!!document.getElementById('casttoggle')`)) await ev(`document.getElementById('casttoggle').click()`);const href = await ev(`(document.querySelector('show-cast a.artist-link[href^="/person/tmdb/"]') || {}).getAttribute ? document.querySelector('show-cast a.artist-link[href^="/person/tmdb/"]').getAttribute('href') : null`);if (href) {const name = await ev(`document.querySelector('show-cast a.artist-link[href^="/person/tmdb/"]').textContent`);const t = Date.now();await ev(`document.querySelector('show-cast a.artist-link[href^="/person/tmdb/"]').click()`);await page.waitFor(`location.pathname.startsWith('/person/') && !location.pathname.startsWith('/person/tmdb/') && !!document.querySelector('person-meta h1') && !document.querySelector('#personloading')`, { timeout: 60000, label: 'guest page' });const ms = Date.now() - t;await imgsDone();const p = await ev(`JSON.stringify({ path: location.pathname, h1: document.querySelector('person-meta h1').textContent, shortId: (document.querySelector('#shortid') || {}).textContent || null,films: document.querySelectorAll('a.film-row').length, error: (document.querySelector('#fillerror') || {}).textContent || null })`);await shot(`guest-person-${w}`);out.push(`${w} guest "${name}" ${href} → ${p} in ${ms} ms (${guestDone ? 'person existed' : 'created by this click'})`);guestDone = true;} else out.push(`${w} no guest link on ${SERIES}`);}// watch + follow clicks (desktop width)const clickTimes = async (sel, changed, n) => {const res = [];for (let i = 0; i < n; i++) {const before = await ev(`document.querySelector(${JSON.stringify(sel)}).getAttribute('class') + '|' + document.querySelector(${JSON.stringify(sel)}).textContent`);await page.resetWs();// on the page's own clock: from the click until the answer's frame arrived (the DOM changes with it: hl:web applies the ack's// value + session sync in one go) — CDP's polling is not countedawait ev(`window.__c0 = performance.now(); window.__hlWsAt = 0; document.querySelector(${JSON.stringify(sel)}).click()`);await page.waitFor(`(document.querySelector(${JSON.stringify(sel)}).getAttribute('class') + '|' + document.querySelector(${JSON.stringify(sel)}).textContent) !== ${JSON.stringify(before)}`, { timeout: 30000, label: 'click' });const ms = await ev(`Math.round(window.__hlWsAt - window.__c0)`);await new Promise(r => setTimeout(r, 300));const bytes = (await page.wsFrames()).reduce((a, f) => a + f.length, 0);res.push(`${ms} ms/${bytes} B`);}return res.join(', ');};for (const slug of CLICK) {await load('/shows/' + slug);const ep = await ev(`(document.querySelector('episode-row button.checkicon') || {}).value || null`);const info = await castInfo();if (ep) out.push(`watch clicks /shows/${slug} (cast ${info.cast}, crew ${info.crew}) episode ${ep}: ${await clickTimes(`episode-row button.checkicon[value="${ep}"]`, null, 6)}`);out.push(`follow clicks /shows/${slug}: ${await clickTimes('#follow', null, 2)}`);}console.log(out.join('\n'));console.log('problems', JSON.stringify(page.problems ? page.problems() : []));await browser.close();
Branches
Latest commits
- 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
- c41587d2Merge branch 'bs2' into mainTracker
- 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
- 019d5cedMerge branch 'records-1110' into mainTracker
- f88ae8b9|||PR records: day56 toggle live, reviewTracker
- b6b3bb4dMerge branch 'ap56e' into mainTracker
- 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
- 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
- 4b54f6f9Merge branch 'records-audit' into mainTracker
- cab4a3bc|||PR records: branch audit, PR-onlyTracker
- 641e1c4cMerge branch 'records-dp71' into mainTracker
- 85a6e9f5|||PR records: DP71 checked in ChromeTracker
- f5be5f18records: gitoria PR-only planTracker
- 46a37036records: DP71 liveTracker
- 3bcb7039Status/log: DP71 in progressTracker
- 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker
- 783957c2Merge branch 'sr1-search' into mainTracker
- 792b9652README: search results come from the routeTracker
- fd8570b1|||PR search: one server exchange per keystrokeTracker
- e8f5cbcaLog: SR1 result, SR1bTracker