tracker
All repositories: gitoria
6.9 KB
// tests/realdata-check.mjs — the REAL-DATA check (NOT part of the gate; mission 047, extended in tracker.worldapi.org#13): a dev// server on :8730 over a COPY of Byrodin's storage/, a session file for the creator (az5b2) whose id is in .scratch/real-sid// (STATUS.md has the procedure). Full load of /, /movies (+ page 2), /shows, /my/movies, /my/* and the first followed show// (direct + CLIENT-SIDE from /my/shows): navigate → document complete → socket open → every poster on the page loaded.// Pagination clicks on /movies, the homepage headings, Back. Checks every check svg is drawn; screenshots 390 + 1280 into// $REAL_SHOTS (default /tmp/w050/real). Run: node tests/realdata-check.mjs// (#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)import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';import { launchBrowser } from '../tests/cdp.mjs';process.env.HL_CHROME ||= '/opt/google/chrome/chrome';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();mkdirSync(OUT, { recursive: true });const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8731), Number(process.env.REAL_CHROME || 8731)] });const page = await browser.newPage();const ev = (e) => page.evaluate(e);await page.send('Network.enable', {});await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 30000, label: 'hydrated' });// every poster IN THE VIEWPORT loaded (the tiles are loading="lazy": the ones further down or right load when scrolled to)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' });const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));const svgState = () => ev(`JSON.stringify((() => { const s = Array.from(document.querySelectorAll('button.checkicon svg, season-caret svg'));return { checks: document.querySelectorAll('button.checkicon').length, badNs: s.filter(e => e.namespaceURI !== 'http://www.w3.org/2000/svg').length,undrawn: Array.from(document.querySelectorAll('button.checkicon svg circle')).filter(c => !(c.getBoundingClientRect().width > 0)).length }; })())`);const res = [];for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });let showPath = null;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']]) {const t = Date.now();await page.goto(BASE + path, { timeout: 60000 });await hydrated();await postersDone();const ms = Date.now() - t;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 })`);res.push(`${w} ${path} ${ms} ms ${info}`);await shot(`${name}-${w}`);if (name === 'my-shows') showPath = process.env.REAL_SHOW || await ev(`document.querySelector('a.myshow-title').getAttribute('href')`);}// direct load of that showlet t = Date.now();await page.goto(BASE + showPath); await hydrated();res.push(`${w} ${showPath} (direct) ${Date.now() - t} ms ${await svgState()}`);// CLIENT-SIDE: /my/shows → click the first titleawait page.goto(BASE + '/my/shows'); await hydrated();await ev(`window.__w050 = 'same document'`);t = Date.now();await page.click(`a.myshow-title[href="${showPath}"]`);await page.waitFor(`location.pathname === ${JSON.stringify(showPath)} && !!document.querySelector('button.checkicon svg circle')`, { timeout: 20000, label: 'client nav' });res.push(`${w} client-side nav → ${showPath} ${Date.now() - t} ms marker=${await ev('window.__w050')} ${await svgState()}`);// the homepage's "Movies" heading → /movies, client-side; the pagination: "Next", then "4" (a number), then Backawait page.goto(BASE + '/'); await hydrated();await ev(`window.__w050 = 'same document'`);t = Date.now();await page.click('#home-movies h2 a');await page.waitFor(`location.pathname === '/movies' && document.querySelectorAll('a.tile').length === 24`, { timeout: 20000, label: 'heading → /movies' });await postersDone();res.push(`${w} heading click → /movies ${Date.now() - t} ms marker=${await ev('window.__w050')}`);const pageClick = async (label, want) => {const first = await ev(`document.querySelector('a.tile').getAttribute('href')`);const tt = Date.now();await ev(`Array.from(document.querySelectorAll('pagination button')).find(b => b.textContent === ${JSON.stringify(label)}).click()`);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 });await postersDone();res.push(`${w} pagination "${label}" → ${want} ${Date.now() - tt} ms marker=${await ev('window.__w050')} title="${await ev('document.title')}"`);};await pageClick('Next', '/movies/page/2');await pageClick('4', '/movies/page/4');await ev('window.scrollTo(0, document.documentElement.scrollHeight)');await postersDone();await shot(`movies-page-4-bottom-${w}`);await pageClick('Previous', '/movies/page/3');await ev('history.back()');await page.waitFor(`location.pathname === '/movies/page/4' && document.querySelector('pagination li.current').textContent.trim() === '4'`, { timeout: 20000, label: 'back' });res.push(`${w} Back → /movies/page/4 (current 4) marker=${await ev('window.__w050')}`);}console.log(res.join('\n'));console.log('problems', JSON.stringify(page.problems ? page.problems() : []));await browser.close();
Branches
- mainmain branch
Latest commits
- 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
- 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
- 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