const { chromium } = require('@playwright/test'); (async () => { const b = await chromium.launch(); const p = await b.newPage(); await p.addInitScript(() => { window.__GGS__ = { simId: 'test', baseUrl: '' }; window.fetch = () => Promise.resolve({ ok:true, json:()=>Promise.resolve({}) }); // Heartbeat stummschalten }); await p.goto('about:blank'); await p.addScriptTag({ path: 'C:/xampp/htdocs/geograsim/App/assets/js/live-client.js' }); const read = () => p.evaluate(() => window.__GGS_LIVE__ ? window.__GGS_LIVE__.activeMs : null); const set = (v) => p.evaluate((v) => window.__GGS_LIVE__.setPaused(v), v); await p.waitForTimeout(300); const a1 = await read(); await p.waitForTimeout(2500); const a2 = await read(); // sollte gestiegen sein await set(true); await p.waitForTimeout(2500); const a3 = await read(); // sollte eingefroren sein await set(false); await p.waitForTimeout(2500); const a4 = await read(); // sollte wieder steigen const grewNormal = (a2 - a1) > 1500; const frozen = (a3 - a2) < 300; const resumed = (a4 - a3) > 1500; console.log(JSON.stringify({ a1,a2,a3,a4, grewNormal, frozen, resumed, verdict: (grewNormal && frozen && resumed) ? 'PASS' : 'FAIL' }, null, 2)); await b.close(); })();