gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6f7b61ba6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker6f7b61ba/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

  • 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