const { chromium } = require('@playwright/test'); (async () => { const b = await chromium.launch(); const p = await b.newPage(); const errs=[]; p.on('pageerror',e=>errs.push(e.message)); p.on('console',m=>{if(m.type()==='error')errs.push(m.text());}); await p.goto('http://localhost/geograsim/App/sims/weltkueche/game.html'); await p.waitForTimeout(1500); const r = await p.evaluate(async () => { try { if (!DISHES.length) await loadWeltkuecheData(); function taskFor(ingKey, heimat){ current = { dish: { id:'test-'+ingKey, heimat: heimat, ings:[ingKey], signature:{} } }; try { delete _taskCache[ingKey]; } catch(_){} return buildTaskFor(ingKey); } const dEggsDE = _wkDist('oesterreich','deutschland'); const dEggsFR = _wkDist('oesterreich','frankreich'); const eier = taskFor('eier','oesterreich'); const kart = taskFor('kartoffel','oesterreich'); const milch = taskFor('milch','oesterreich'); // alle Zutaten müssen fehlerfrei bauen let buildErr = null; for (const k of Object.keys(ING)) { current = { dish:{id:'x',heimat:'oesterreich',ings:[k],signature:{}} }; try { delete _taskCache[k]; buildTaskFor(k); } catch(e){ buildErr = k+': '+e.message; break; } } return { distDE: Math.round(dEggsDE), distFR: Math.round(dEggsFR), eierCorrect: eier.correct, eierChoices: eier.choices, eierDistractors: eier.choices.length - eier.correct.length, kartoffelCorrect: kart.correct, milchCorrect: milch.correct, buildErr, ingCount: Object.keys(ING).length, }; } catch(e){ return { error:String(e), stack:e.stack }; } }); console.log(JSON.stringify({result:r, pageErrors:errs}, null, 2)); await b.close(); })();