tracker
All repositories: gitoria
4.0 KB
// tests/tmdbfix-chrome.mjs — tracker#36 (mission T36): look at titles of a COPY in the creator's Chrome on lisbeth (:9223): ONE own plain// tab (Target.createTarget WITHOUT a browser context), closed in finally, browser disconnected (never closed), one own cookie (deleted// again), at 390×844 / 800×1280 / 1280×800 / 1280×900, a screenshot of every page and size plus the visible text of the page head.// BASE=http://localhost:8761 SID=<session id of the copy> OUT=/abs/shots CDP=http://127.0.0.1:9223 PATHS='/shows/The-Daily-Show,/movies/X' node tests/tmdbfix-chrome.mjs// Run it under `timeout 600 flock /media/STORAGE/claude-scratch/atlas/lisbeth.lock …` (WORKER-RULES). Prints one JSON line per page and size.import fs from 'node:fs';const BASE = process.env.BASE, SID = process.env.SID, OUT = process.env.OUT, CDP = process.env.CDP || 'http://127.0.0.1:9223';const PATHS = (process.env.PATHS || '').split(',').filter(Boolean);if (!BASE || !SID || !OUT || !PATHS.length) { console.log('set BASE, SID, OUT, PATHS'); process.exit(2); }fs.mkdirSync(OUT, { recursive: true });const SIZES = [[390, 844, true, 2], [800, 1280, false, 1], [1280, 800, false, 1], [1280, 900, false, 1]];const ver = await (await fetch(CDP + '/json/version')).json();const ws = new WebSocket(ver.webSocketDebuggerUrl.replace(/^ws:\/\/[^/]+/, CDP.replace('http', 'ws')));await new Promise((res, rej) => { ws.onopen = res; ws.onerror = rej; });let nextId = 1; const waiting = new Map(); const events = [];ws.onmessage = (m) => { const j = JSON.parse(m.data); if (j.id && waiting.has(j.id)) { const w = waiting.get(j.id); waiting.delete(j.id); j.error ? w.rej(new Error(j.error.message)) : w.res(j.result); } else if (j.method) events.push(j); };const send = (method, params = {}, sessionId) => new Promise((res, rej) => { const id = nextId++; waiting.set(id, { res, rej }); ws.send(JSON.stringify({ id, method, params, ...(sessionId ? { sessionId } : {}) })); });const sleep = (ms) => new Promise(r => setTimeout(r, ms));let targetId = null, sid = null;const cookieUrl = BASE;try {targetId = (await send('Target.createTarget', { url: 'about:blank' })).targetId;sid = (await send('Target.attachToTarget', { targetId, flatten: true })).sessionId;const S = (m, p) => send(m, p, sid);await S('Page.enable'); await S('Network.enable'); await S('Runtime.enable');await S('Network.setCookie', { name: 'trackersid', value: SID, url: cookieUrl });const ev = async (expr) => (await S('Runtime.evaluate', { expression: expr, returnByValue: true })).result.value;for (const [w, h, mobile, dsf] of SIZES) {await S('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: dsf, mobile });for (const p of PATHS) {await S('Page.navigate', { url: BASE + p });for (let i = 0; i < 100; i++) { await sleep(300); if (await ev("document.readyState === 'complete' && !!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1")) break; }await sleep(1500);const info = await ev(`JSON.stringify({ url: location.pathname, title: document.title, h1: (document.querySelector('h1') || {}).textContent || null, scrollW: document.documentElement.scrollWidth, innerW: innerWidth,head: document.body.innerText.replace(/\\s+/g, ' ').slice(0, 260), checks: document.querySelectorAll('button.checkicon').length, imgs: Array.from(document.images).filter(i => i.complete && i.naturalWidth > 0).length + '/' + document.images.length })`);const shot = (await S('Page.captureScreenshot', { format: 'png' })).data;const name = `${p.replace(/[^A-Za-z0-9]+/g, '_')}-${w}x${h}.png`;fs.writeFileSync(`${OUT}/${name}`, Buffer.from(shot, 'base64'));console.log(JSON.stringify({ size: `${w}x${h}`, shot: name, ...JSON.parse(info) }));}}await S('Emulation.clearDeviceMetricsOverride');await S('Network.deleteCookies', { name: 'trackersid', url: cookieUrl });} finally {if (targetId) { try { await send('Target.closeTarget', { targetId }); } catch (e) { console.log('close failed: ' + e.message); } }ws.close();}
Branches
Latest commits
- d2e6d26bMerge branch 'records-park55' into mainTracker
- f567f025|||PR records: park #55, no Claude workers ruleTracker
- c21aff6bMerge branch 'records-hm55c' into mainTracker
- 9ba258d3|||PR records: HM55b resultTracker
- 64f2d300Merge branch 'records-hm55b2' into mainTracker
- ae3b80dc|||PR records: HM55b briefTracker
- 7ef3cb3bMerge branch 'records-st55' into mainTracker
- fec2e080|||PR records: STATUS HM55Tracker
- 8e174918Merge branch 'records-hm55b' into mainTracker
- b1ecee57|||PR records: HM55 stateTracker
- 28eab08cMerge branch 'records-hm55' into mainTracker
- d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
- 3059f86cMerge branch 'records-design-rule' into mainTracker
- 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
- d1390692Merge branch 'records-dp75b' into mainTracker
- a4d1a7d2|||PR records: later steps checked, branch auditTracker
- e070e16fMerge branch 'records-dp75' into mainTracker
- 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
- bfc4ea4dMerge branch 'ap62' into mainTracker
- 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker