- Full classic layer: roads/walkers, 11-tier housing evolution, food chain, industry chains, trade routes, taxes/wages, ratings, fires & collapse - Fantasy layer: heroes (XP/levels/auras), mana & 7 spells, monsters/invasions, walls/towers/legions/golems, campaign of 5 scenarios + endless sandbox - Canvas2D isometric engine with procedural sprites, zero runtime deps - Save/load slots + autosave, WebAudio synth music/SFX, HUD/menus/minimap - Tests: headless sim smoke test + Playwright E2E (build/combat/save)
36 lines
1.5 KiB
JavaScript
36 lines
1.5 KiB
JavaScript
// Browser smoke test: load game, start sandbox, watch for console errors.
|
|
import { chromium } from 'playwright-core';
|
|
|
|
const exe = '/root/.cache/ms-playwright/chromium_headless_shell-1148/chrome-linux/headless_shell';
|
|
const errors = [];
|
|
const browser = await chromium.launch({ executablePath: exe, args: ['--no-sandbox', '--disable-gpu'] });
|
|
const page = await browser.newPage({ viewport: { width: 1440, height: 900 } });
|
|
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://127.0.0.1:5173/', { waitUntil: 'networkidle' });
|
|
await page.waitForTimeout(1200);
|
|
await page.screenshot({ path: '/tmp/shot_menu.png' });
|
|
|
|
// start sandbox
|
|
await page.click('#mm-sandbox');
|
|
await page.waitForTimeout(2500);
|
|
await page.screenshot({ path: '/tmp/shot_game.png' });
|
|
|
|
// try placing a road via clicks on canvas (center-ish drag)
|
|
const cv = await page.$('#world');
|
|
const box = await cv.boundingBox();
|
|
console.log('canvas at', box);
|
|
// select housing tab then road card
|
|
const tabs = await page.$$('#cattabs .cattab');
|
|
console.log('tabs:', tabs.length);
|
|
|
|
// speed up time & let it run
|
|
for (let i = 0; i < 6; i++) { await page.mouse.click(box.x + box.width / 2, box.y + 60); await page.waitForTimeout(300); }
|
|
await page.screenshot({ path: '/tmp/shot_later.png' });
|
|
|
|
console.log('CONSOLE ERRORS:', errors.length);
|
|
errors.slice(0, 12).forEach(e => console.log(' -', e.slice(0, 220)));
|
|
await browser.close();
|
|
process.exit(errors.length ? 1 : 0);
|