const { chromium } = require('@playwright/test'); (async () => { const browser = await chromium.launch(); for (const era of [1850, 1990, 2026]) { const context = await browser.newContext(); await context.addInitScript(() => { localStorage.setItem('wal.tutorial.seen', '1'); }); const page = await context.newPage(); await page.goto('http://localhost/geograsim/App/sims/wal/game.html'); await page.waitForTimeout(1200); await page.click('[data-era-cta="' + era + '"]'); await page.waitForTimeout(700); const sIntro = await page.evaluate(() => ({ title: document.getElementById('modalTitle')?.textContent, tag: document.getElementById('modalTag')?.textContent, })); if (await page.locator('.modal-foot button:has-text("Weiterreisen")').count()) { await page.click('.modal-foot button:has-text("Weiterreisen")'); await page.waitForTimeout(300); } if (await page.locator('.panel-actions button:has-text("Hinsehen")').count()) { await page.click('.panel-actions button:has-text("Hinsehen")'); await page.waitForTimeout(300); } const enc = await page.evaluate(() => ({ title: document.getElementById('modalTitle')?.textContent, choices: Array.from(document.querySelectorAll('.choice-label')).map(c => c.textContent), })); console.log('═══ Era ' + era + ' ═══'); console.log(' Stage-Intro: ', sIntro.title); console.log(' Stage-Tag: ', sIntro.tag); console.log(' Encounter 1: ', enc.title); console.log(' Choices: ', enc.choices.join(' | ')); console.log(''); await context.close(); } await browser.close(); })();