gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit1ef7a3b11ef7a3b1RV44: report day44 gates and migration/restart proofsmre1ef7a3b1/tests/realdata-m029.mjs

4.1 KB

  1. // tests/realdata-m029.mjs — missions 029/030 (tracker#33/#34/#35), NOT the gate. Against a server on a COPY of live storage/
  2. // (tests/realdata-m028.sh or realdata-m026.sh starts one): every path of REAL_PATHS (comma list) loaded in headless Chrome at 390
  3. // and 1280 px, signed out and — with REAL_SID_FILE — signed in as the creator; full-page screenshot <REAL_OUT>/<name>-<in|out>-<w>.png
  4. // and the visible text <name>-<in|out>-<w>.txt (to LOOK at). Also prints, per load, the poster's and the Follow button's boxes and
  5. // the status pill's text + colours (mission 030), when the page has them.
  6. // Env: REAL_PORT, REAL_CHROME (one debug port), REAL_SID_FILE (optional), REAL_OUT, REAL_PATHS, REAL_WIDTHS (390,1280).
  7. import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
  8. import { launchBrowser } from './cdp.mjs';
  9. process.env.HL_CHROME ||= '/opt/google/chrome/chrome';
  10. const PORT = Number(process.env.REAL_PORT || 8730), BASE = `http://127.0.0.1:${PORT}`, OUT = process.env.REAL_OUT;
  11. const SID = process.env.REAL_SID_FILE ? readFileSync(process.env.REAL_SID_FILE, 'utf8').trim() : null;
  12. const PATHS = process.env.REAL_PATHS.split(','), WIDTHS = (process.env.REAL_WIDTHS || '390,1280').split(',').map(Number);
  13. mkdirSync(OUT, { recursive: true });
  14. const nameOf = (p) => p.slice(1).replace(/[^A-Za-z0-9-]+/g, '_');
  15. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8729), Number(process.env.REAL_CHROME || 8729)] });
  16. try {
  17. for (const who of SID ? ['out', 'in'] : ['out']) {
  18. const page = await browser.newPage();
  19. if (who === 'in') await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  20. for (const w of WIDTHS) {
  21. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: 900, deviceScaleFactor: 1, mobile: w < 600 });
  22. for (const p of PATHS) {
  23. const t = Date.now();
  24. await page.goto(BASE + p, { timeout: 120000 });
  25. await page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 120000, label: 'hydrated' });
  26. // an incomplete title completes on open (skeleton → full): wait until no skeleton is left (max 60 s)
  27. await page.waitFor(`!document.querySelector('#showloading')`, { timeout: 60000, label: 'complete' }).catch(() => {});
  28. await page.waitFor(`Array.from(document.querySelectorAll('img')).every(i => i.complete)`, { timeout: 15000, label: 'images' }).catch(() => {});
  29. const ms = Date.now() - t;
  30. const info = await page.evaluate(`(() => {
  31. const box = (el) => { if (!el) return null; const r = el.getBoundingClientRect(); return { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height) }; };
  32. const poster = document.querySelector('show-poster img, show-poster skeleton-poster');
  33. const follow = document.querySelector('#follow');
  34. const pill = document.querySelector('show-title .pill');
  35. const cs = pill ? getComputedStyle(pill) : null;
  36. return JSON.stringify({ poster: box(poster), posterSrc: poster && poster.getAttribute('src'), follow: box(follow), followText: follow && follow.textContent.trim(),
  37. pill: pill ? { text: pill.textContent.trim(), bg: cs.backgroundColor, color: cs.color, border: cs.borderTopWidth + ' ' + cs.borderTopStyle, box: box(pill) } : null,
  38. h1: box(document.querySelector('h1')), scrollX: document.documentElement.scrollWidth > innerWidth });
  39. })()`);
  40. const name = `${nameOf(p)}-${who}-${w}`;
  41. writeFileSync(`${OUT}/${name}.txt`, await page.evaluate('document.body.innerText'));
  42. const m = await page.send('Page.getLayoutMetrics');
  43. const h = Math.min(Math.ceil(m.cssContentSize.height), 6000);
  44. const shot = await page.send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true, clip: { x: 0, y: 0, width: w, height: h, scale: 1 } });
  45. writeFileSync(`${OUT}/${name}.png`, Buffer.from(shot.data, 'base64'));
  46. console.log(`${name} ${ms} ms ${info}`);
  47. }
  48. }
  49. await page.close().catch(() => {});
  50. }
  51. } finally { await browser.close().catch(() => {}); }
  52. process.exit(0);

Branches

Latest commits

  • 1ef7a3b1RV44: report day44 gates and migration/restart proofsmre
  • a5f62f6cRV44: re-vendor Hybriel set day44 (source 222edef7, bin 4f0f263e)mre
  • 6159a248Merge branch 'hm62-personindex' into rv44mre
  • a8923d93log: RV44 startedmre
  • cf28cf77mission RV44mre
  • 585782dfLog: tracker#60 Chrome look, STATUS rewrittenmre
  • 147d0172conductor: caramboleyo is the user, not owner/creatorApollo
  • 21dd0cfblog: #60 live measurement, reviewmre
  • 7793cf94HM62b report: person indexes with fixed mpackdbmre
  • b4c8d3a9Document tracker#62 fixed-index migration and GC proofmre
  • 09d66ed5status: #60 livemre
  • 4171672flog: #60 livemre
  • f52862a2log: HM62b startedmre
  • 88fde2c4mission HM62bmre
  • a722e526log: #62 blocked by hybriel#317mre
  • 074a7418log: #62 assigned to Tracker; pending rulemre
  • 06f6ae8fHM62 report: mpackdb index gapmre
  • 66f83de3WIP tracker#62 native person indexes blocked by schema migration gapmre
  • 380ba349Merge packed people order for tracker#62mre
  • 86fe5430log: HM62 startedmre