const { chromium } = require('@playwright/test'); (async () => { const browser = await chromium.launch(); // Test A: ohne tutorial.seen → Tutorial-Modal → Skip → Stage-Intro const ctxA = await browser.newContext(); const pageA = await ctxA.newPage(); await pageA.goto('http://localhost/geograsim/App/sims/wal/game.html'); await pageA.waitForTimeout(800); await pageA.click('[data-era-cta="2026"]'); await pageA.waitForTimeout(300); console.log('A1 Tutorial title:', await pageA.evaluate(() => document.getElementById('modalTitle')?.textContent)); // Click Überspringen await pageA.click('.modal-foot button:has-text("Überspringen")'); await pageA.waitForTimeout(400); console.log('A2 After Skip title:', await pageA.evaluate(() => document.getElementById('modalTitle')?.textContent)); console.log('A2 Modal active: ', await pageA.evaluate(() => document.querySelector('#modal.active') ? 'YES' : 'NO')); await ctxA.close(); // Test B: ohne tutorial.seen → Tutorial → durch alle 4 Steps → Stage-Intro const ctxB = await browser.newContext(); const pageB = await ctxB.newPage(); await pageB.goto('http://localhost/geograsim/App/sims/wal/game.html'); await pageB.waitForTimeout(800); await pageB.click('[data-era-cta="2026"]'); await pageB.waitForTimeout(300); for (let i = 0; i < 3; i++) { await pageB.click('.modal-foot button:has-text("Weiter")'); await pageB.waitForTimeout(150); } await pageB.click('.modal-foot button:has-text("Los geht\'s")'); await pageB.waitForTimeout(400); console.log('B After full tutorial:', await pageB.evaluate(() => document.getElementById('modalTitle')?.textContent)); console.log('B Modal active: ', await pageB.evaluate(() => document.querySelector('#modal.active') ? 'YES' : 'NO')); await ctxB.close(); // Test C: mit tutorial.seen → kein Tutorial, direkt Stage-Intro const ctxC = await browser.newContext(); await ctxC.addInitScript(() => localStorage.setItem('wal.tutorial.seen', '1')); const pageC = await ctxC.newPage(); await pageC.goto('http://localhost/geograsim/App/sims/wal/game.html'); await pageC.waitForTimeout(800); await pageC.click('[data-era-cta="2026"]'); await pageC.waitForTimeout(400); console.log('C Direct (seen=1): ', await pageC.evaluate(() => document.getElementById('modalTitle')?.textContent)); await ctxC.close(); await browser.close(); })();