gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc8da40f3c8da40f3|||PR AP61: re-vendor Hybriel set day61 (source a05af47c, bin a11042e5)Trackerc8da40f3/tests/realdata-m026.mjs

4.9 KB

  1. // tests/realdata-m026.mjs — mission 026 (tracker#31, duplicate titles), NOT the gate: what the creator sees on a COPY of live storage
  2. // (tests/realdata-m026.sh start …), signed in as az5b2 (cookie from $REAL_SID_FILE). Prints one JSON line per check and writes
  3. // screenshots (390 + 1280) to $REAL_SHOTS: /my/series (Reacher's last watched episode, Archive 81's row), Reacher's page (season 3
  4. // checked or not), /my/unwatched (Reacher S03 rows), Archive 81's page, the search "archive 81", a talk show with many seasons
  5. // (The View) and its full load time. Env: REAL_PORT, REAL_CHROME, REAL_SID_FILE, REAL_SHOTS, REAL_LABEL (file name prefix).
  6. import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
  7. import { join } from 'node:path';
  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}`;
  11. const SID = readFileSync(process.env.REAL_SID_FILE, 'utf8').trim(), SHOTS = process.env.REAL_SHOTS, LABEL = process.env.REAL_LABEL || 'x';
  12. if (SHOTS) mkdirSync(SHOTS, { recursive: true });
  13. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8729), Number(process.env.REAL_CHROME || 8729)] });
  14. const page = await browser.newPage();
  15. await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  16. const ev = (e) => page.evaluate(e);
  17. const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 120000, label: 'hydrated' });
  18. const open = async (path) => { const t = Date.now(); await page.goto(BASE + path, { timeout: 120000 }); await hydrated(); return Date.now() - t; };
  19. const shot = async (name, full) => {
  20. if (!SHOTS) return;
  21. for (const [w, h, m] of [[390, 844, true], [1280, 900, false]]) {
  22. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: 1, mobile: m });
  23. await new Promise(r => setTimeout(r, 300));
  24. const opts = { format: 'png' };
  25. if (full) { const hh = await ev('document.documentElement.scrollHeight'); opts.clip = { x: 0, y: 0, width: w, height: Math.min(hh, 6000), scale: 1 }; opts.captureBeyondViewport = true; }
  26. writeFileSync(join(SHOTS, `${LABEL}-${name}-${w}.png`), Buffer.from((await page.send('Page.captureScreenshot', opts)).data, 'base64'));
  27. }
  28. await page.send('Emulation.clearDeviceMetricsOverride', {});
  29. };
  30. const out = {};
  31. try {
  32. await open('/my/series');
  33. out.mySeries = JSON.parse(await ev(`JSON.stringify(Array.from(document.querySelectorAll('my-show-row')).filter(r => /Reacher|Archive 81|Flight Attendant|Raised by Wolves/.test(r.textContent)).map(r => [r.querySelector('a.myshow-title').textContent, r.querySelector('a.myshow-title').getAttribute('href'), (r.querySelector('my-show-episode') || {}).textContent || '']))`));
  34. out.mySeriesRows = await ev(`document.querySelectorAll('my-show-row').length`);
  35. await shot('my-series');
  36. const seasons = () => ev(`JSON.stringify(Array.from(document.querySelectorAll('season-row')).map(r => r.querySelector('season-label').textContent + ': ' + r.querySelector('season-count').textContent + ' ' + ((r.querySelector('button.checkicon') || {}).getAttribute ? r.querySelector('button.checkicon').getAttribute('class') : '')))`);
  37. await open('/series/Reacher');
  38. out.reacher = JSON.parse(await seasons());
  39. await shot('reacher', true);
  40. await open('/my/unwatched');
  41. out.unwatchedReacher = JSON.parse(await ev(`JSON.stringify(Array.from(document.querySelectorAll('unwatched-row')).filter(r => /Reacher/.test(r.textContent)).map(r => r.querySelector('unwatched-episode').textContent))`));
  42. out.unwatchedRows = await ev(`document.querySelectorAll('unwatched-row').length`);
  43. await shot('my-unwatched');
  44. out.archiveLoad = await open('/series/Archive-81');
  45. out.archive = { h1: await ev(`(document.querySelector('show-header h1 type-name') || {}).textContent`), seasons: JSON.parse(await seasons()), path: await ev('location.pathname') };
  46. await shot('archive-81', true);
  47. await open('/search/archive%2081');
  48. out.search = JSON.parse(await ev(`JSON.stringify(Array.from(document.querySelectorAll('a.search-title')).map(a => a.textContent + ' ' + a.getAttribute('href')))`));
  49. await shot('search-archive');
  50. for (const p of ['/shows/The-View', '/shows/EastEnders', '/series/EastEnders']) {
  51. const r = await fetch(BASE + p, { redirect: 'manual' });
  52. if (r.status === 200) { out.talkPath = p; break; }
  53. if (r.status === 301) { out.talkPath = r.headers.get('location').replace(BASE, ''); break; }
  54. }
  55. if (out.talkPath) {
  56. out.talkLoads = [];
  57. for (let i = 0; i < 3; i++) out.talkLoads.push(await open(out.talkPath));
  58. out.talkSeasons = await ev(`document.querySelectorAll('season-row').length`);
  59. await shot('talk');
  60. }
  61. } catch (e) { out.error = String(e.stack || e); }
  62. console.log(JSON.stringify(out, null, 1));
  63. await browser.close();
  64. process.exit(out.error ? 1 : 0);

Branches

Latest commits

  • c8da40f3|||PR AP61: re-vendor Hybriel set day61 (source a05af47c, bin a11042e5)Tracker
  • 0b86324aMerge branch 'records-dp73' into mainTracker
  • 9ce5f59b|||PR records: DP73 live 613ae0e; deploy.sh keeps 2 backupsTracker
  • 613ae0ecMerge branch 'bs3' into mainTracker
  • 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
  • 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker
  • 310613f1Merge branch 'records-dp72' into mainTracker
  • 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