gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit71b4634571b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre71b46345/tests/realdata-check.mjs

4.9 KB

  1. // tests/realdata-check.mjs — mission 047 REAL-DATA check (NOT part of the gate): a dev server on :8730 over a COPY of Byrodin's
  2. // storage/, a session file for the creator (az5b2) whose id is in .scratch/real-sid (STATUS.md has the procedure). Times
  3. // / , /my/* and the first followed show (direct + CLIENT-SIDE from /my/shows), expands/collapses a season, checks every
  4. // check svg is a drawn SVG, screenshots 390 + 1280 into /tmp/w047/real/. Run: node tests/realdata-check.mjs
  5. // (#15: REAL_PORT / REAL_CHROME / REAL_OUT override 8730 / 8731 / /tmp/w047/real; REAL_SHOW = a show path to time instead of the first followed)
  6. import { writeFileSync, readFileSync } from 'node:fs';
  7. import { launchBrowser } from '../tests/cdp.mjs';
  8. process.env.HL_CHROME ||= '/opt/google/chrome/chrome';
  9. const BASE = `http://127.0.0.1:${process.env.REAL_PORT || 8730}`, OUT = process.env.REAL_OUT || '/tmp/w047/real', SID = readFileSync('.scratch/real-sid', 'utf8').trim();
  10. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8731), Number(process.env.REAL_CHROME || 8731)] });
  11. const page = await browser.newPage();
  12. const ev = (e) => page.evaluate(e);
  13. await page.send('Network.enable', {});
  14. await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  15. const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 30000, label: 'hydrated' });
  16. const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));
  17. const svgState = () => ev(`JSON.stringify((() => { const s = Array.from(document.querySelectorAll('button.checkicon svg, season-caret svg'));
  18. return { checks: document.querySelectorAll('button.checkicon').length, badNs: s.filter(e => e.namespaceURI !== 'http://www.w3.org/2000/svg').length,
  19. undrawn: Array.from(document.querySelectorAll('button.checkicon svg circle')).filter(c => !(c.getBoundingClientRect().width > 0)).length }; })())`);
  20. const res = [];
  21. for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {
  22. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });
  23. let showPath = null;
  24. for (const [name, path] of [['home', '/'], ['my-shows', '/my/shows'], ['my-unwatched', '/my/unwatched'], ['my-schedule', '/my/schedule']]) {
  25. const t = Date.now();
  26. await page.goto(BASE + path, { timeout: 60000 });
  27. await hydrated();
  28. if (name === 'my-shows') await page.waitFor(`Array.from(document.querySelectorAll('img.myshow-poster')).every(i => i.complete)`, { timeout: 30000 });
  29. const ms = Date.now() - t;
  30. const info = await ev(`JSON.stringify({ rows: document.querySelectorAll('my-show-row, unwatched-row, schedule-row').length, user: !!document.querySelector('#logout'), scrollW: document.documentElement.scrollWidth, headerH: document.querySelector('application-header').getBoundingClientRect().height })`);
  31. res.push(`${w} ${path} ${ms} ms ${info}`);
  32. await shot(`${name}-${w}`);
  33. if (name === 'my-shows') showPath = process.env.REAL_SHOW || await ev(`document.querySelector('a.myshow-title').getAttribute('href')`);
  34. }
  35. // direct load of that show
  36. let t = Date.now();
  37. await page.goto(BASE + showPath); await hydrated();
  38. res.push(`${w} ${showPath} (direct) ${Date.now() - t} ms ${await svgState()}`);
  39. await shot(`show-direct-${w}`);
  40. // CLIENT-SIDE: /my/shows → click the first title
  41. await page.goto(BASE + '/my/shows'); await hydrated();
  42. await ev(`window.__w047 = 'same document'`);
  43. t = Date.now();
  44. await page.click(`a.myshow-title[href="${showPath}"]`);
  45. await page.waitFor(`location.pathname === ${JSON.stringify(showPath)} && !!document.querySelector('button.checkicon svg circle')`, { timeout: 20000, label: 'client nav' });
  46. res.push(`${w} client-side nav → ${showPath} ${Date.now() - t} ms marker=${await ev('window.__w047')} ${await svgState()}`);
  47. await shot(`show-clientnav-${w}`);
  48. // expand the first collapsed season, then collapse it again
  49. const sid = await ev(`(() => { const r = document.querySelector('season-row.collapsed button.season-toggle'); return r ? r.value : null })()`);
  50. if (sid) {
  51. await page.click(`button.season-toggle[value="${sid}"]`);
  52. await page.waitFor(`document.querySelector('button.season-toggle[value="${sid}"]').closest('season-row').classList.contains('expanded')`, { timeout: 20000 });
  53. res.push(`${w} after expand ${await svgState()}`);
  54. await shot(`show-expanded-${w}`);
  55. await page.click(`button.season-toggle[value="${sid}"]`);
  56. await page.waitFor(`document.querySelector('button.season-toggle[value="${sid}"]').closest('season-row').classList.contains('collapsed')`, { timeout: 20000 });
  57. res.push(`${w} after collapse ${await svgState()}`);
  58. }
  59. }
  60. console.log(res.join('\n'));
  61. console.log('problems', JSON.stringify(page.problems ? page.problems() : []));
  62. await browser.close();

Branches

Latest commits

  • 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
  • 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre
  • cbdc4ea7tracker#12: link icons TMDB/IMDb/TVDB/TVmaze; sync fills missing ids (TVmaze lookup); movies fetched via /movie/mre
  • b105bcd8tracker#11: Hybriel master ff51cf46 (checks no longer vanish), mobile-first styles, carets, follow button, sign-in modal, inverted check, orange castmre
  • 31b758aatracker#10: installable app (manifest, service worker, offline shell), own icon + faviconmre
  • 2fa9d997tracker#9: TMDB sync (followed shows: seasons, episodes, posters), tools/sync-tmdb.hl + daily run 04:00 UTC, fake TMDB in gatemre
  • 49e1f61edeploy.sh: back up live storage/.sessions/.env before every deploy (newest 5 kept)mre
  • 54070a4etracker#8: /my/unwatched + /my/schedule (301 from old), S01E01, title (year), 1 episode, watched-set lookup (unwatched 15s -> 1s)mre
  • 3251488atracker#7: /my/shows (followed shows, newest follow first, poster, title, last watched SxxEyy); gate can take screenshots (TRACKER_GATE_SHOTS)mre
  • 44b7d9f9tracker#6: /schedule — upcoming episodes of followed shows, soonest firstmre
  • 91c9fc8ctracker#5: /unwatched — unwatched released episodes of followed shows, newest firstmre
  • a97c0295tracker#4: show page /shows/:slug (header, seasons, episodes, watch checks) + tools/relink-episode-seasons.hlmre
  • 05f407c5tracker: no border on any button except inverted ones (Log out, ident status and identities too); header brand weight 100mre
  • 17375427tracker#2: tools/migrate.hl + tools/verify.hl — old MongoDB data into mpackdb with new idsmre
  • 31aac936tracker#3: no border on the header and on filled buttons; inverted buttons keep theirsmre
  • 2ad9d29ctracker#1: login exactly like calendar (identity selector in the header, empty homepage)mre
  • 3691e176tracker#1: empty tracker with the ident login (state of 2026-09-27)mre