gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitd049b8b8d049b8b8Log: HM50 live, #52 donemred049b8b8/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

  • d049b8b8Log: HM50 live, #52 donemre
  • 6d05fa37Log: HM50 Part A mergedmre
  • 1c7dab74HM50: the shell reads the framework's online state, netProbe removed (tracker#55)mre
  • e8b91697HM50: search address follows the text via navigate(path, replace = true) (tracker#52)mre
  • 6fe1896cHM50: re-vendor Hybriel set day50 (source 0ae38232, bin d3ef9d16)mre
  • 2f391aa9Log: HM50 startedmre
  • 4b59c03dHM50 mission: doc pathmre
  • ed526d67HM50 missionmre
  • 2f986ca3Log: RT50 passmre
  • 1c4715a4RT50 mission: day50 repro retestmre
  • 57d1c0dcLog: day50 retest requestmre
  • 60b1f419Log: Anton #336 result, wake checkmre
  • 919a18aalog: scratchmre
  • 6b504440status tidymre
  • 9332bd10log: DP70 livemre
  • be11daa0DP70 brief fixmre
  • 886a7028DP70 brief, HM67 mergedmre
  • b41cdd6dMerge hm67-searchids: packed search IDsmre
  • 385904eaReport HM67 matched heap measurements and gate proofmre
  • e5c9b659Pack retained search IDs into UTF-8 bytesmre