feat: add age-based event gating, event timer, and UI polish
- Add minAge/maxAge to events so infants can't go treasure hunting - Cache event panel DOM to prevent high-speed button destruction - Add 10s auto-select countdown for choice events - Fix event title/text field mapping (name/description → title/text) - Add rotating clock icon for time flow feedback - Fix speed/pause button active states - Fix shop affordability check (disable + show insufficient money) - Add red styling for unmet choice requirements - Fix log re-rendering on every tick
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
const puppeteer = require('puppeteer-core');
|
||||
|
||||
(async () => {
|
||||
const browser = await puppeteer.launch({
|
||||
executablePath: '/usr/bin/chromium-browser',
|
||||
headless: true,
|
||||
args: ['--no-sandbox', '--disable-setuid-sandbox']
|
||||
});
|
||||
const page = await browser.newPage();
|
||||
|
||||
page.on('console', msg => console.log('PAGE CONSOLE:', msg.text()));
|
||||
page.on('pageerror', err => console.log('PAGE ERROR:', err.message));
|
||||
|
||||
await page.goto('http://localhost:8765', { waitUntil: 'networkidle0' });
|
||||
|
||||
// Click start button
|
||||
await page.click('.choice-btn');
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
// Try to make a choice in child event
|
||||
const buttons = await page.$$('.choice-btn');
|
||||
console.log('Child event buttons:', buttons.length);
|
||||
if (buttons.length > 0) {
|
||||
await buttons[0].click();
|
||||
await page.waitForTimeout(500);
|
||||
}
|
||||
|
||||
// Check what happened
|
||||
const title = await page.$eval('#eventTitle', el => el.textContent);
|
||||
const age = await page.$eval('#age', el => el.textContent);
|
||||
console.log('After first choice - Title:', title, 'Age:', age);
|
||||
|
||||
const buttons2 = await page.$$('.choice-btn');
|
||||
console.log('Buttons after first choice:', buttons2.length);
|
||||
if (buttons2.length > 0) {
|
||||
const texts = await Promise.all(buttons2.map(b => b.evaluate(el => el.textContent)));
|
||||
console.log('Button texts:', texts);
|
||||
}
|
||||
|
||||
await browser.close();
|
||||
})();
|
||||
Reference in New Issue
Block a user