gitoriaLog in with ident

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit0553b51f0553b51ftracker#19 (mission 066): franchises and timelines — tables, /franchises, /franchises/<slug>, /timelines/<slug> (Timeline | Release sort, series by last episode), the Prequel | Timeline | Sequel widget with the franchise above, the creator's editor, TMDB collection seed in the app (resumes, paced); gate tests/franchises.mjs 48/0 + browser.mjs 266/0, tests/realdata-066.mjs, docs/franchises.md, README + STATUSmre0553b51f/tests/realdata-check.mjs

6.9 KB

  1. // tests/realdata-check.mjs — the REAL-DATA check (NOT part of the gate; mission 047, extended in tracker.worldapi.org#13): a dev
  2. // server on :8730 over a COPY of Byrodin's storage/, a session file for the creator (az5b2) whose id is in .scratch/real-sid
  3. // (STATUS.md has the procedure). Full load of /, /movies (+ page 2), /shows, /my/movies, /my/* and the first followed show
  4. // (direct + CLIENT-SIDE from /my/shows): navigate → document complete → socket open → every poster on the page loaded.
  5. // Pagination clicks on /movies, the homepage headings, Back. Checks every check svg is drawn; screenshots 390 + 1280 into
  6. // $REAL_SHOTS (default /tmp/w050/real). Run: node tests/realdata-check.mjs
  7. // (#15: REAL_PORT / REAL_CHROME / REAL_OUT override 8730 / 8731 / the shots dir; REAL_SHOW = a show path to time instead of the first followed)
  8. import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
  9. import { launchBrowser } from '../tests/cdp.mjs';
  10. process.env.HL_CHROME ||= '/opt/google/chrome/chrome';
  11. const BASE = `http://127.0.0.1:${process.env.REAL_PORT || 8730}`, OUT = process.env.REAL_OUT || process.env.REAL_SHOTS || '/tmp/w050/real', SID = readFileSync('.scratch/real-sid', 'utf8').trim();
  12. mkdirSync(OUT, { recursive: true });
  13. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8731), Number(process.env.REAL_CHROME || 8731)] });
  14. const page = await browser.newPage();
  15. const ev = (e) => page.evaluate(e);
  16. await page.send('Network.enable', {});
  17. await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  18. const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 30000, label: 'hydrated' });
  19. // every poster IN THE VIEWPORT loaded (the tiles are loading="lazy": the ones further down or right load when scrolled to)
  20. const postersDone = () => page.waitFor(`Array.from(document.querySelectorAll('img.myshow-poster, img.tile-poster')).filter(i => { const r = i.getBoundingClientRect(); return r.top < innerHeight && r.bottom > 0 && r.left < innerWidth && r.right > 0 }).every(i => i.complete && i.naturalWidth > 0)`, { timeout: 30000, label: 'posters' });
  21. const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));
  22. const svgState = () => ev(`JSON.stringify((() => { const s = Array.from(document.querySelectorAll('button.checkicon svg, season-caret svg'));
  23. return { checks: document.querySelectorAll('button.checkicon').length, badNs: s.filter(e => e.namespaceURI !== 'http://www.w3.org/2000/svg').length,
  24. undrawn: Array.from(document.querySelectorAll('button.checkicon svg circle')).filter(c => !(c.getBoundingClientRect().width > 0)).length }; })())`);
  25. const res = [];
  26. for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {
  27. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });
  28. let showPath = null;
  29. for (const [name, path] of [['home', '/'], ['movies', '/movies'], ['movies-page-2', '/movies/page/2'], ['shows', '/shows'], ['shows-page-2', '/shows/page/2'], ['my-movies', '/my/movies'], ['my-shows', '/my/shows'], ['my-unwatched', '/my/unwatched'], ['my-schedule', '/my/schedule']]) {
  30. const t = Date.now();
  31. await page.goto(BASE + path, { timeout: 60000 });
  32. await hydrated();
  33. await postersDone();
  34. const ms = Date.now() - t;
  35. const info = await ev(`JSON.stringify({ rows: document.querySelectorAll('my-show-row, unwatched-row, schedule-row').length, tiles: document.querySelectorAll('a.tile').length, hometiles: document.querySelectorAll('a.hometile').length, current: (document.querySelector('pagination li.current') || {}).textContent || null, user: !!document.querySelector('#logout'), scrollW: document.documentElement.scrollWidth, headerH: document.querySelector('application-header').getBoundingClientRect().height })`);
  36. res.push(`${w} ${path} ${ms} ms ${info}`);
  37. await shot(`${name}-${w}`);
  38. if (name === 'my-shows') showPath = process.env.REAL_SHOW || await ev(`document.querySelector('a.myshow-title').getAttribute('href')`);
  39. }
  40. // direct load of that show
  41. let t = Date.now();
  42. await page.goto(BASE + showPath); await hydrated();
  43. res.push(`${w} ${showPath} (direct) ${Date.now() - t} ms ${await svgState()}`);
  44. // CLIENT-SIDE: /my/shows → click the first title
  45. await page.goto(BASE + '/my/shows'); await hydrated();
  46. await ev(`window.__w050 = 'same document'`);
  47. t = Date.now();
  48. await page.click(`a.myshow-title[href="${showPath}"]`);
  49. await page.waitFor(`location.pathname === ${JSON.stringify(showPath)} && !!document.querySelector('button.checkicon svg circle')`, { timeout: 20000, label: 'client nav' });
  50. res.push(`${w} client-side nav → ${showPath} ${Date.now() - t} ms marker=${await ev('window.__w050')} ${await svgState()}`);
  51. // the homepage's "Movies" heading → /movies, client-side; the pagination: "Next", then "4" (a number), then Back
  52. await page.goto(BASE + '/'); await hydrated();
  53. await ev(`window.__w050 = 'same document'`);
  54. t = Date.now();
  55. await page.click('#home-movies h2 a');
  56. await page.waitFor(`location.pathname === '/movies' && document.querySelectorAll('a.tile').length === 24`, { timeout: 20000, label: 'heading → /movies' });
  57. await postersDone();
  58. res.push(`${w} heading click → /movies ${Date.now() - t} ms marker=${await ev('window.__w050')}`);
  59. const pageClick = async (label, want) => {
  60. const first = await ev(`document.querySelector('a.tile').getAttribute('href')`);
  61. const tt = Date.now();
  62. await ev(`Array.from(document.querySelectorAll('pagination button')).find(b => b.textContent === ${JSON.stringify(label)}).click()`);
  63. await page.waitFor(`location.pathname === ${JSON.stringify(want)} && document.querySelector('a.tile').getAttribute('href') !== ${JSON.stringify(first)} && document.querySelector('pagination li.current').textContent.trim() === ${JSON.stringify(want.split('/').pop() === 'movies' ? '1' : want.split('/').pop())}`, { timeout: 20000, label: 'page ' + want });
  64. await postersDone();
  65. res.push(`${w} pagination "${label}" → ${want} ${Date.now() - tt} ms marker=${await ev('window.__w050')} title="${await ev('document.title')}"`);
  66. };
  67. await pageClick('Next', '/movies/page/2');
  68. await pageClick('4', '/movies/page/4');
  69. await ev('window.scrollTo(0, document.documentElement.scrollHeight)');
  70. await postersDone();
  71. await shot(`movies-page-4-bottom-${w}`);
  72. await pageClick('Previous', '/movies/page/3');
  73. await ev('history.back()');
  74. await page.waitFor(`location.pathname === '/movies/page/4' && document.querySelector('pagination li.current').textContent.trim() === '4'`, { timeout: 20000, label: 'back' });
  75. res.push(`${w} Back → /movies/page/4 (current 4) marker=${await ev('window.__w050')}`);
  76. }
  77. console.log(res.join('\n'));
  78. console.log('problems', JSON.stringify(page.problems ? page.problems() : []));
  79. await browser.close();

Branches

Latest commits

  • 0553b51ftracker#19 (mission 066): franchises and timelines — tables, /franchises, /franchises/<slug>, /timelines/<slug> (Timeline | Release sort, series by last episode), the Prequel | Timeline | Sequel widget with the franchise above, the creator's editor, TMDB collection seed in the app (resumes, paced); gate tests/franchises.mjs 48/0 + browser.mjs 266/0, tests/realdata-066.mjs, docs/franchises.md, README + STATUSmre
  • fa1f9dfatracker#29 (mission 063): unwatched check muted grey outline + check (accent only on hover), watched stays solid — no code regression, the accent outline read as ticked; gate checks real checks visibly (computed style + screenshot pixel) on /my/unwatched, show, movie, /my/movies; gate 266, tests/realdata-063.mjs, README + STATUSmre
  • d8b12d67tracker#27 (mission 060): short ids for movies, series and persons — old 702 kept (data/old-short-ids.json), new random [a-z0-9]{5} unique across both, claimed at creation, background backfill (resumes), shown under poster/photo, /<shortId> → 301; gate 259, tests/realdata-060*, README + STATUSmre
  • f14db671tracker#22-#25 (mission 058): episode air dates, season check = all episodes watched, movie watched check (+ /my/movies count), /genres/<genre> pages (movies + series, newest first, paginated); gate 238, tests/realdata-058.mjs, README + STATUSmre
  • 1704ec45tracker#17 (mission 057): season caret down/up, skeleton rows while a season loads, sessionless showSeasonEpisodes face (no page re-mount), client-only close; gate 214, tests/realdata-057.mjs, README + STATUSmre
  • f2fe3e36mission 056: README + STATUS (merge, fixes, Hybriel 8590df63, real-data check), tests/realdata-056.mjs, tools/check-public-slugs.hlmre
  • f40c250emission 056: re-vendor hybriel master 8590df63 (#121, #122); an adult title's page is Not found for non-followers; gate: leave the page before stopping the servermre
  • 2b7fdd6cmission 056: signed-out header one row on phones ("Log in", nowrap), backfill skips adult titles' posters, gate checksmre
  • 2c53d5efMerge branch 't16-person' (tracker#16 person pages) into main; filmography shows only public titles (054 adult flag), gate race fix (backfill start line)mre
  • c171227emission 054: hide adult/unknown titles from the public lists and the search; in-app adult-flag backfill (TMDB details + poster per title, resumes), gate + real-data proofmre
  • 139fafd8tracker#16: short bio (4 lines, click = all), real-data check script, README + STATUSmre
  • 93be9476tracker#16: person pages /person/<slug> with the filmography fetched from TMDB on the first visit (step by step), gatemre
  • 47a3cae6STATUS: mission 053 merge commit idsmre
  • dcc5eecaMerge branch 't14-search'mre
  • 03edc783Merge branch 't15-tvmaze'mre
  • 71b46345tracker#15: numbering check by date or title, placeholder titles in other languages, docs + real-data proofmre
  • 6bb2daf1tracker#13: homepage (tiles, intro, latest movies/shows), /shows, /movies/page/N, /my/movies; lists cached in memorymre
  • b8bd1157tracker#14: README + STATUS (search, real-data numbers, gate, merge notes)mre
  • 65c694a8tracker#14: search — header magnifier, /search/<text> (in-memory word-prefix index over titles + people), Fetch from web (TMDB search/multi, ours left out), Add = import via syncShow; gate +25 checks, real-data scriptmre
  • 34f2c15btracker#15: TVmaze merge in the sync (gaps only: new episodes/seasons, empty titles/air dates; numbering check), fake TVmaze episodes + gatemre