const { chromium } = require('@playwright/test'); (async () => { const browser = await chromium.launch(); const page = await browser.newPage(); const errors = []; page.on('console', m => { if (m.type()==='error') errors.push(m.text()); }); page.on('pageerror', e => errors.push('PAGEERROR: '+e.message)); await page.goto('http://localhost/geograsim/App/sims/weltkueche/game.html'); await page.waitForTimeout(1500); const r = await page.evaluate(async () => { try { if (!DISHES.length) await loadWeltkuecheData(); const dish = DISHES.find(d => d.id === 'tiroler-groestl'); if (!dish) return { error: 'no tiroler-groestl dish' }; current = { dish }; const task = buildTaskFor('kartoffel'); const art = ING.kartoffel.art; const correctAT = explainChoice('kartoffel', 'oesterreich', true).text; const correctDE = explainChoice('kartoffel', 'deutschland', true).text; const wrongUA = explainChoice('kartoffel', 'ukraine', false).text; const bad = Object.entries(ING).filter(([k,v]) => !['der','die','das'].includes(v && v.art)).map(([k])=>k); return { art, taskCorrect: task.correct, correctAT, correctDE, wrongUA, badArticles: bad, ingCount: Object.keys(ING).length }; } catch (e) { return { error: String(e), stack: e.stack }; } }); console.log(JSON.stringify({ result: r, consoleErrors: errors }, null, 2)); await browser.close(); })();