gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit833aee2f833aee2flog: #50 closed, HM56 startedmre833aee2f/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

  • 833aee2flog: #50 closed, HM56 startedmre
  • ac58c1e5mission: HM56mre
  • 58979c0clog: HM54 held for decision, DP65 startedmre
  • bb2ebc67log: #64 live, #53 mergedmre
  • 27cde42fMerge hm53-dom: tracker#53 inputs bound to membersmre
  • 2156cc7flog: HM54 reviewmre
  • 9fb82efclog: HM54 gap, fill continuesmre
  • b632eb8dlog: HM53 done, HM54 startedmre
  • ccb1a263tracker#53: bind editor drafts and use key event focus targetmre
  • 3356fcfclog: #52 blocked, HM53 startedmre
  • 833dcfc9Merge hm52-search: report only, tracker#52 blocked by framework gapmre
  • 73010cc0HM52: report replace-navigation search draft regressionmre
  • 1742e92bstatus: DP64 and HM52 runningmre
  • 29ad5b58log: #64 merged, DP64 and HM52 startedmre
  • fafddbf9Merge hm64-catalog: tracker#64 catalog from packed entriesmre
  • b2e2206dlog: #63 livemre
  • 5831e0e0log: HM64 donemre
  • 4042b923Flatten catalog membership rows into paired slotsmre
  • ea8a759elog: #61 #62 live, DP63 and HM64 startedmre
  • 40439456Merge hm63-searchtext: tracker#63 packed search textmre