gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc7cdef62c7cdef62Log: Apollo STOP, workers pausedmrec7cdef62/tests/realdata-063.mjs

4.1 KB

  1. // tests/realdata-063.mjs — tracker#29 (mission 063), NOT the gate: on a COPY of live storage/ (STATUS.md has the procedure),
  2. // signed in (cookie from .scratch/real-sid) at 390 + 1280: how the checks LOOK on /my/unwatched, a show page (REAL_SHOW) and
  3. // /my/movies — per page the count of checks by class and by on-screen look (computed circle fill/stroke, check stroke), and
  4. // the screenshot pixel inside the first disc. Then ONE click on /my/unwatched's first check (on the COPY): the row leaves the
  5. // list, also after a reload. Screenshots → $REAL_OUT. Env: REAL_PORT (8730), REAL_CHROME (8731), REAL_SHOW (/shows/Foundation).
  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 || 8730}`, OUT = process.env.REAL_OUT || '/tmp/w063/real';
  10. const SID = readFileSync('.scratch/real-sid', 'utf8').trim();
  11. const SHOW = process.env.REAL_SHOW || '/shows/Foundation';
  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. const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 60000, label: 'hydrated' });
  17. const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));
  18. const load = async (path) => { const t = Date.now(); await page.goto(BASE + path, { timeout: 60000 }); await hydrated(); return Date.now() - t; };
  19. const looks = () => ev(`JSON.stringify((() => { const cnt = {}; for (const b of document.querySelectorAll('.checkicon')) {
  20. const c = getComputedStyle(b.querySelector('circle')), p = getComputedStyle(b.querySelector('path'));
  21. const k = b.getAttribute('class') + ' fill=' + c.fill + ' stroke=' + c.stroke + ' mark=' + p.stroke; cnt[k] = (cnt[k] || 0) + 1; } return cnt; })())`);
  22. await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  23. const out = [];
  24. for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {
  25. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });
  26. for (const [name, path] of [['my-unwatched', '/my/unwatched'], ['show', SHOW], ['my-movies', '/my/movies']]) {
  27. const ms = await load(path);
  28. await page.send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: 0, y: 0 });
  29. if (name === 'show') await ev(`document.querySelector('show-seasons') && document.querySelector('show-seasons').scrollIntoView()`);
  30. 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: 10000, label: 'images' }).catch(() => {});
  31. await shot(`${name}-${w}`);
  32. out.push(`${w} ${path} (${ms} ms): ${await looks()}`);
  33. }
  34. }
  35. // one click on the copy: the first row leaves the list, also after a reload
  36. await load('/my/unwatched');
  37. const first = await ev(`document.querySelector('unwatched-row button.checkicon').value`);
  38. const n0 = await ev(`document.querySelectorAll('unwatched-row').length`);
  39. const t = Date.now();
  40. await page.click('unwatched-row button.checkicon');
  41. await page.waitFor(`!document.querySelector('unwatched-row button.checkicon[value="${first}"]')`, { timeout: 30000, label: 'row gone' });
  42. const clickMs = Date.now() - t;
  43. const n1 = await ev(`document.querySelectorAll('unwatched-row').length`);
  44. await load('/my/unwatched');
  45. const gone = await ev(`!document.querySelector('unwatched-row button.checkicon[value="${first}"]')`);
  46. out.push(`click on /my/unwatched ${first}: ${n0} rows → ${n1} after ${clickMs} ms; after a reload still gone: ${gone}, ${await ev(`document.querySelectorAll('unwatched-row').length`)} rows`);
  47. console.log(out.join('\n'));
  48. console.log('problems', JSON.stringify(page.problems ? page.problems() : []));
  49. await browser.close();

Branches

Latest commits

  • c7cdef62Log: Apollo STOP, workers pausedmre
  • d0c083fbLog: usage stopmre
  • c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmre
  • 1eb6f1a1Missions AP56, BS1mre
  • 4871f8adLog: AP52 live on day52, browser gate greenmre
  • d9bf2988Merge ap52: day52, tracker#58 server argument, #51 modal close rule, #56 keyed season rowsmre
  • c4a60ef2Log: RT52 retest passed, AP52 startedmre
  • 83760a55Browser gate: search results belong to the address form of the typed text (tracker#52 navigate replace)mre
  • 6e951d91AP52: show-page rows are keyed records; closing a season is one upsert and removes (tracker#56, hybriel#331)mre
  • 3bb4ccddAP52: modal close button refers to its nested rule with Style.buttonModalX (tracker#51, hybriel#333)mre
  • ba16933fAP52: login callback and title route are static handlers taking the server as third argument (tracker#58, hybriel#332)mre
  • 85153900AP52: re-vendor Hybriel set day52 (source 77cfca31, bin 0a8ed496)mre
  • 7c051eddLog: hybriel#338 answermre
  • d049b8b8Log: HM50 live, #52 donemre
  • 6d05fa37Log: HM50 Part A mergedmre
  • 1c7dab74HM50: the shell reads the framework's online state, netProbe removed (tracker#55)mre
  • e8b91697HM50: search address follows the text via navigate(path, replace = true) (tracker#52)mre
  • 6fe1896cHM50: re-vendor Hybriel set day50 (source 0ae38232, bin d3ef9d16)mre
  • 2f391aa9Log: HM50 startedmre
  • 4b59c03dHM50 mission: doc pathmre