gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc41587d2c41587d2Merge branch 'bs2' into mainTrackerc41587d2/tests/realdata-070.mjs

3.9 KB

  1. // tests/realdata-070.mjs — mission 070 (t18 + t20 + t19 merged, Hybriel 8efba065), NOT the gate: on a COPY of live storage/ after
  2. // the jobs (STATUS.md mission 070 has the procedure), signed in as the creator (cookie from $REAL_SID_FILE). At 390 + 1280: every
  3. // page kind's full load (to hydrated + visible images), its heading, no sideways scroll, a screenshot → $REAL_OUT; the console
  4. // problems at the end. Env: REAL_PORT (8750), REAL_CHROME (8752), REAL_OUT (/tmp/w070/real), REAL_SID_FILE, REAL_WIDGET (a movie
  5. // slug in a timeline: Star-Trek-First-Contact), REAL_SERIES (Star-Trek-Picard).
  6. import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
  7. import { launchBrowser } from './cdp.mjs';
  8. process.env.HL_CHROME ||= '/opt/google/chrome/chrome';
  9. const BASE = `http://127.0.0.1:${process.env.REAL_PORT || 8750}`, OUT = process.env.REAL_OUT || '/tmp/w070/real';
  10. const SID = readFileSync(process.env.REAL_SID_FILE, 'utf8').trim();
  11. mkdirSync(OUT, { recursive: true });
  12. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8752), Number(process.env.REAL_CHROME || 8752)] });
  13. const page = await browser.newPage();
  14. const ev = (e) => page.evaluate(e);
  15. const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 60000, label: 'hydrated' });
  16. const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));
  17. const load = async (path) => {
  18. const t = Date.now(); await page.goto(BASE + path, { timeout: 60000 }); await hydrated();
  19. await 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: 15000, label: 'images' }).catch(() => {});
  20. return Date.now() - t;
  21. };
  22. await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  23. // a franchise page and a timeline from /franchises itself
  24. await load('/franchises');
  25. const fr = await ev(`JSON.stringify({ f: (document.querySelector('a.franchise-row') || { getAttribute: () => null }).getAttribute('href'), t: (document.querySelector('a.timeline-link') || { getAttribute: () => null }).getAttribute('href') })`).then(JSON.parse);
  26. const PAGES = [['home', '/'], ['movies-list', '/movies'], ['series-list', '/series'], ['shows-list', '/shows'], ['franchises', '/franchises'],
  27. ...(fr.f ? [['franchise', fr.f]] : []), ...(fr.t ? [['timeline', fr.t]] : []),
  28. ['movie-widget', '/movies/' + (process.env.REAL_WIDGET || 'Star-Trek-First-Contact')], ['series-cast', '/series/' + (process.env.REAL_SERIES || 'Star-Trek-Picard')],
  29. ['show', '/shows/Saturday-Night-Live'], ['my-series', '/my/series'], ['my-shows', '/my/shows'], ['my-movies', '/my/movies'], ['my-unwatched', '/my/unwatched'],
  30. ['my-schedule', '/my/schedule'], ['search', '/search/star%20trek']];
  31. const out = [];
  32. for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {
  33. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });
  34. for (const [name, path] of PAGES) {
  35. const ms = await load(path);
  36. const info = await ev(`JSON.stringify({ h1: (document.querySelector('h1') || {}).innerText ? document.querySelector('h1').innerText.replace(/\\s+/g, ' ') : '', sideways: document.documentElement.scrollWidth > ${w},
  37. widgets: document.querySelectorAll('franchise-widget').length, cast: document.querySelectorAll('show-cast a.artist-link').length, rows: document.querySelectorAll('my-show-row, a.tile, search-row, a.timeline-item, a.franchise-row, a.timeline-link, episode-row').length })`);
  38. await shot(`${name}-${w}`);
  39. out.push(`${w} ${path} ${ms} ms ${info}`);
  40. }
  41. }
  42. console.log('PAGES\n' + out.join('\n'));
  43. console.log('problems', JSON.stringify(page.problems ? page.problems() : []));
  44. await browser.close();

Branches

Latest commits

  • 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
  • 8ad275a4Log/status: tracker 68, SR1Tracker