Add co-op server, deploy docs, e2e suite and wire in the music tracks

- server/: Node (ws) static server + authoritative co-op rooms; dual-stack
  listen, proxy-aware client IP and Origin check, keep-alive pings, per-socket
  rate limits, graceful shutdown; 59 node:test tests
- docs/DEPLOY.md + deploy/netwall.service: Debian 13 LXC, systemd, nginx
  Proxy Manager walk-through, path prefix, troubleshooting
- e2e/: Playwright suite (smoke, touch, end flow, two-browser co-op incl.
  reconnect, 14-size layout matrix); npm run e2e
- Music: tracks.json now points at the uploaded theme/battle/boss/win/lose
  files; stingers fade out when a new game starts
- PAUSED indicator, refreshed icon

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
Claude 2026-10-09 19:57:27 +00:00
parent 1c2071e6db
commit faf0cfa603
27 changed files with 3383 additions and 28 deletions

49
e2e/run.js Normal file
View file

@ -0,0 +1,49 @@
'use strict';
/*
* End-to-end browser tests (desktop, phone touch, co-op with two browsers) driven by Playwright.
*
* npm install # installs playwright-core (devDependency)
* npx playwright-core install chromium-headless-shell # once, downloads the browser
* npm run e2e [-- name-filter]
*
* Starts the real server on a random port, runs every scenario in e2e/scenarios, saves screenshots to e2e/out/.
* Set E2E_URL to test an already running server instead (needed for the co-op scenario to see that server).
*/
const fs = require('fs');
const path = require('path');
async function main() {
let chromium;
try { ({ chromium } = require('playwright-core')); } catch (e) {
console.error('playwright-core is not installed: run "npm install" first (it is a devDependency).'); process.exit(2);
}
const filter = process.argv[2] || '';
const out = path.join(__dirname, 'out') + path.sep;
fs.mkdirSync(out, { recursive: true });
let srv = null, url = process.env.E2E_URL;
if (!url) {
const { createServer } = require('../server');
srv = await createServer({ port: 0, host: '127.0.0.1', log: () => {} });
url = 'http://127.0.0.1:' + srv.port + '/';
}
const browser = await chromium.launch({ args: ['--no-sandbox'] });
const files = fs.readdirSync(path.join(__dirname, 'scenarios')).filter((f) => f.endsWith('.js') && f.includes(filter)).sort();
let failed = 0;
for (const f of files) {
const t0 = Date.now();
process.stdout.write('\n=== ' + f + '\n');
try {
await require('./scenarios/' + f)({ browser, url, out });
console.log('PASS ' + f + ' (' + ((Date.now() - t0) / 1000).toFixed(1) + 's)');
} catch (e) {
failed++;
console.log('FAIL ' + f + ': ' + e.message);
}
}
await browser.close();
if (srv) await srv.close();
console.log('\n' + (failed ? failed + ' scenario(s) failed' : 'all ' + files.length + ' scenarios passed'));
process.exit(failed ? 1 : 0);
}
main().catch((e) => { console.error(e); process.exit(1); });

47
e2e/scenarios/01-smoke.js Normal file
View file

@ -0,0 +1,47 @@
module.exports = async function ({ browser, url: URL, out: OUT }) {
const errors = [];
const setups = [
['desktop', { viewport: { width: 1280, height: 800 } }],
['phone-portrait', { viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true }],
['phone-landscape', { viewport: { width: 844, height: 390 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true }],
];
for (const [name, opts] of setups) {
const ctx = await browser.newContext(opts);
const page = await ctx.newPage();
page.on('console', m => { if (m.type() === 'error' || m.type() === 'warning') errors.push(`[${name}] console.${m.type()}: ${m.text()}`); });
page.on('pageerror', e => errors.push(`[${name}] pageerror: ${e.message}\n${e.stack}`));
await page.goto(URL);
await page.waitForTimeout(600);
await page.screenshot({ path: OUT + name + '-1-menu.png' });
await page.click('#btnSolo');
await page.waitForTimeout(400);
await page.screenshot({ path: OUT + name + '-2-help.png' });
await page.click('#btnHelpClose');
await page.waitForTimeout(300);
// build a bit
const box = await page.locator('#board').boundingBox();
const cell = async (cx, cy) => {
const r = await page.evaluate(([cx, cy]) => { const r = window.NW.app.renderer; const p = r.cellToScreen(cx, cy); return p; }, [cx, cy]);
return { x: box.x + r.x, y: box.y + r.y };
};
await page.click('.tbtn[data-type="wall"]');
for (let y = 2; y <= 12; y++) { const p = await cell(12, y); await page.mouse.click(p.x, p.y); }
await page.click('.tbtn[data-type="filter"]');
const isTouch = !!opts.hasTouch;
for (const [cx, cy] of [[10, 12], [14, 12], [13, 9]]) {
const p = await cell(cx, cy);
if (isTouch) { await page.touchscreen.tap(p.x, p.y); await page.waitForTimeout(80); await page.touchscreen.tap(p.x, p.y); }
else { await page.mouse.click(p.x, p.y); }
await page.waitForTimeout(80);
}
await page.screenshot({ path: OUT + name + '-3-built.png' });
await page.click('#btnWave');
await page.waitForTimeout(4000);
await page.screenshot({ path: OUT + name + '-4-wave.png' });
const st = await page.evaluate(() => { const v = window.NW.app.ctrl.view; return { gold: v.gold, lives: v.lives, wave: v.wave, towers: v.towers.length, monsters: v.monsters.length }; });
console.log(name, JSON.stringify(st));
await ctx.close();
}
if (errors.length) throw new Error('console errors:\n' + errors.join('\n'));
console.log('no console errors');
};

78
e2e/scenarios/02-touch.js Normal file
View file

@ -0,0 +1,78 @@
const assert = (c, m) => { if (!c) throw new Error('ASSERT: ' + m); console.log('ok -', m); };
module.exports = async function ({ browser, url: URL, out: OUT }) {
const errors = [];
for (const [name, opts] of [['portrait', { viewport: { width: 390, height: 844 } }], ['landscape', { viewport: { width: 844, height: 390 } }]]) {
console.log('=== ' + name);
const ctx = await browser.newContext({ ...opts, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
const page = await ctx.newPage();
page.on('pageerror', e => errors.push(`[${name}] pageerror: ${e.message}`));
page.on('console', m => { if (m.type() === 'error') errors.push(`[${name}] console.error: ${m.text()}`); });
const cdp = await ctx.newCDPSession(page);
const touch = (type, pts) => cdp.send('Input.dispatchTouchEvent', { type, touchPoints: pts.map((p, i) => ({ x: p.x, y: p.y, id: i + 1 })) });
await page.goto(URL); await page.waitForTimeout(400);
await page.tap('#btnSolo'); await page.waitForTimeout(300);
await page.tap('#btnHelpClose'); await page.waitForTimeout(200);
const box = await page.locator('#board').boundingBox();
const cellPt = async (cx, cy) => { const r = await page.evaluate(([a, b]) => NW.app.renderer.cellToScreen(a, b), [cx, cy]); return { x: box.x + r.x, y: box.y + r.y }; };
const state = () => page.evaluate(() => { const a = NW.app, v = a.ctrl.view; return { towers: v.towers.length, gold: v.gold, pending: a.pending, selType: a.selType, zoom: a.renderer.zoom, rot: a.renderer.rot, confirmHidden: document.getElementById('confirm').hidden, marks: a.renderer.marks.length, hint: document.getElementById('hint').textContent }; });
// 1) drag-paint walls with one finger
await page.tap('.tbtn[data-type="wall"]');
const a = await cellPt(8, 5), b = await cellPt(8, 11);
await touch('touchStart', [a]);
for (let i = 1; i <= 12; i++) await touch('touchMove', [{ x: a.x + (b.x - a.x) * i / 12, y: a.y + (b.y - a.y) * i / 12 }]);
await touch('touchEnd', []);
let s = await state();
assert(s.towers >= 7, `drag painted a wall line (${s.towers} walls)`);
// 2) turret: first tap previews (no build), confirm bar appears, tapping the check builds it
await page.tap('.tbtn[data-type="filter"]');
const t1 = await cellPt(10, 8);
await page.touchscreen.tap(t1.x, t1.y); await page.waitForTimeout(150);
let s2 = await state();
assert(s2.towers === s.towers && s2.pending && s2.pending.x === 10 && s2.pending.y === 8, 'first tap only previews');
assert(!s2.confirmHidden, 'confirm bar is visible');
assert(/Route|Need|✕/.test(s2.hint), 'hint shows route info: ' + s2.hint);
await page.screenshot({ path: OUT + `touch-${name}-1-preview.png` });
await page.tap('#btnConfirmBuild'); await page.waitForTimeout(150);
let s3 = await state();
assert(s3.towers === s.towers + 1, 'confirm builds the tower');
// tap-again-to-build
const t2 = await cellPt(10, 10);
await page.touchscreen.tap(t2.x, t2.y); await page.waitForTimeout(120);
await page.touchscreen.tap(t2.x, t2.y); await page.waitForTimeout(150);
let s4 = await state();
assert(s4.towers === s.towers + 2, 'tapping the previewed cell again builds');
// 3) tapping an existing tower selects it (even with a build type active)
await page.touchscreen.tap(t1.x, t1.y); await page.waitForTimeout(150);
const sel = await page.evaluate(() => ({ t: NW.app.selTower, type: NW.app.selType, info: document.getElementById('info').innerText.slice(0, 60) }));
assert(sel.t && !sel.type, 'tap on tower selects it: ' + JSON.stringify(sel.info));
await page.screenshot({ path: OUT + `touch-${name}-2-selected.png` });
await page.tap('#info [data-act="up"]'); await page.waitForTimeout(150);
const lv = await page.evaluate(() => NW.app.ctrl.view.towers.find(t => t.id === NW.app.selTower).level);
assert(lv === 2, 'upgrade via info panel');
// 4) pinch zoom with two fingers, then reset
const c = await cellPt(13, 8);
await touch('touchStart', [{ x: c.x - 30, y: c.y }, { x: c.x + 30, y: c.y }]);
for (let i = 1; i <= 10; i++) await touch('touchMove', [{ x: c.x - 30 - i * 8, y: c.y }, { x: c.x + 30 + i * 8, y: c.y }]);
await touch('touchEnd', []);
const z = (await state()).zoom;
assert(z > 1.8, 'pinch zoomed in (zoom ' + z.toFixed(2) + ')');
assert(!(await page.locator('#btnFit').isHidden()), 'fit button visible when zoomed');
await page.screenshot({ path: OUT + `touch-${name}-3-zoomed.png` });
await page.tap('#btnFit'); await page.waitForTimeout(100);
assert((await state()).zoom === 1, 'fit resets zoom');
// 5) long-press pings the map
await page.evaluate(() => { NW.app.selType = null; NW.app.selTower = 0; });
const lp = await cellPt(15, 4);
await touch('touchStart', [lp]); await page.waitForTimeout(650); await touch('touchEnd', []);
assert((await state()).marks >= 1, 'long-press creates a map ping');
console.log('rotation', (await state()).rot);
await ctx.close();
}
if (errors.length) throw new Error('console errors:\n' + errors.join('\n'));
console.log('no console errors');
};

View file

@ -0,0 +1,53 @@
const assert = (c, m) => { if (!c) throw new Error('ASSERT: ' + m); console.log('ok -', m); };
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
async function until(fn, ms, what) { const t0 = Date.now(); for (;;) { try { const v = await fn(); if (v) return v; } catch (e) {} if (Date.now() - t0 > ms) throw new Error('TIMEOUT: ' + what); await sleep(50); } }
module.exports = async function ({ browser, url: URL, out: OUT }) {
const errors = [];
const ctx = await browser.newContext({ viewport: { width: 1100, height: 700 } });
const page = await ctx.newPage();
page.on('pageerror', e => errors.push('pageerror: ' + e.message));
page.on('console', m => { if (m.type() === 'error') errors.push('console.error: ' + m.text()); });
await page.goto(URL); await sleep(300);
await page.click('.mapcard[data-map="hub"]');
assert((await page.evaluate(() => NW.app.ctrl.board.mapId)) === 'hub', 'map picker switches the preview board to hub');
assert((await page.evaluate(() => NW.app.ctrl.board.spawns.length)) === 3, 'hub has 3 gateways');
await page.click('#btnSolo'); await sleep(200); await page.click('#btnHelpClose');
// lose
await page.evaluate(() => { NW.app.ctrl.sim.lives = 1; });
await page.click('#btnSpeed'); await page.click('#btnSpeed');
await page.click('#btnWave');
await until(() => page.evaluate(() => !document.getElementById('end').hidden), 60000, 'end overlay after losing');
assert((await page.evaluate(() => document.getElementById('endTitle').textContent)) === 'Breach!', 'lose title');
await page.screenshot({ path: OUT + 'end-lose.png' });
await page.click('#btnAgain'); await sleep(300);
let st = await page.evaluate(() => ({ s: NW.app.ctrl.view.state, hidden: document.getElementById('end').hidden, lives: NW.app.ctrl.view.lives, towers: NW.app.ctrl.view.towers.length, map: NW.app.ctrl.board.mapId }));
assert(st.s === 'playing' && st.hidden && st.lives === 20 && st.towers === 0 && st.map === 'hub', 'play again resets the same map: ' + JSON.stringify(st));
// win (set winWave to 1)
await page.evaluate(() => { NW.app.ctrl.sim.winWave = 1; });
await page.click('#btnWave');
await until(() => page.evaluate(() => !document.getElementById('end').hidden), 90000, 'end overlay after winning');
assert((await page.evaluate(() => document.getElementById('endTitle').textContent)) === 'Server secured!', 'win title');
assert(!(await page.locator('#btnContinue').isHidden()), 'keep going button shown');
await page.screenshot({ path: OUT + 'end-win.png' });
await page.click('#btnContinue'); await sleep(300);
st = await page.evaluate(() => ({ s: NW.app.ctrl.view.state, hidden: document.getElementById('end').hidden }));
assert(st.s === 'playing' && st.hidden, 'continue resumes endless play');
await page.keyboard.press('Space'); await sleep(300);
assert((await page.evaluate(() => NW.app.ctrl.view.wave)) === 2, 'space starts the next wave');
// keyboard shortcuts
await page.keyboard.press('2');
assert((await page.evaluate(() => NW.app.selType)) === 'filter', 'key 2 selects filter');
await page.keyboard.press('Escape');
assert((await page.evaluate(() => NW.app.selType)) === null, 'escape clears');
await page.keyboard.press('p'); assert((await page.evaluate(() => NW.app.ctrl.view.paused)) === true, 'p pauses');
await page.keyboard.press('p');
// menu while playing
await page.click('#btnMenu'); await sleep(200);
assert(!(await page.locator('#btnCloseMenu').isHidden()), 'menu has back-to-game while playing');
await page.keyboard.press('Escape'); await sleep(200);
assert(await page.locator('#menu').isHidden(), 'escape closes the menu');
if (errors.length) throw new Error('console errors:\n' + errors.join('\n'));
console.log('no console errors');
};

94
e2e/scenarios/04-coop.js Normal file
View file

@ -0,0 +1,94 @@
const assert = (c, m) => { if (!c) throw new Error('ASSERT: ' + m); console.log('ok -', m); };
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
async function until(fn, ms, what) { const t0 = Date.now(); for (;;) { try { const v = await fn(); if (v) return v; } catch (e) {} if (Date.now() - t0 > ms) throw new Error('TIMEOUT: ' + what); await sleep(50); } }
module.exports = async function ({ browser, url: URL, out: OUT }) {
const errors = [];
const mk = async (name, opts) => {
const ctx = await browser.newContext(opts); const page = await ctx.newPage();
page.on('pageerror', e => errors.push(`[${name}] pageerror: ${e.message}`));
page.on('console', m => { if (m.type() === 'error') errors.push(`[${name}] console.error: ${m.text()}`); });
return { ctx, page, name };
};
const A = await mk('host-desktop', { viewport: { width: 1280, height: 800 } });
const B = await mk('guest-phone', { viewport: { width: 390, height: 844 }, deviceScaleFactor: 2, isMobile: true, hasTouch: true });
// host creates a room
await A.page.goto(URL); await sleep(300);
await A.page.click('#btnCoop');
await A.page.fill('#inName', 'Alice');
await A.page.click('#btnCreate');
await until(() => A.page.evaluate(() => NW.app.ctrl.kind === 'remote' && NW.app.ctrl.status === 'joined'), 5000, 'host joined');
const room = await A.page.evaluate(() => NW.app.ctrl.room);
assert(/^[A-Z0-9]{4}$/.test(room), 'room code ' + room);
// guest opens the invite link
await B.page.goto(URL + '?room=' + room); await sleep(300);
assert(await B.page.inputValue('#inCode') === room, 'invite link prefilled the code');
await B.page.fill('#inName', 'Bob');
await B.page.tap('#btnJoin');
await until(() => B.page.evaluate(() => NW.app.ctrl.kind === 'remote' && NW.app.ctrl.status === 'joined'), 5000, 'guest joined');
await until(() => A.page.evaluate(() => NW.app.ctrl.players.length === 2), 3000, 'host sees 2 players');
const slots = await Promise.all([A, B].map(p => p.page.evaluate(() => NW.app.ctrl.you.slot)));
assert(slots[0] === 0 && slots[1] === 1, 'slots 0 and 1: ' + slots);
assert((await B.page.evaluate(() => NW.app.renderer.rot)) > 0, 'guest phone portrait board rotated');
const boxA = await A.page.locator('#board').boundingBox(), boxB = await B.page.locator('#board').boundingBox();
const cellPt = async (p, box, cx, cy) => { const r = await p.page.evaluate(([a, b]) => NW.app.renderer.cellToScreen(a, b), [cx, cy]); return { x: box.x + r.x, y: box.y + r.y }; };
// host builds walls, guest sees them
await A.page.click('.tbtn[data-type="wall"]');
for (let y = 3; y <= 9; y++) { const p = await cellPt(A, boxA, 12, y); await A.page.mouse.click(p.x, p.y); }
await until(() => B.page.evaluate(() => NW.app.ctrl.view.towers.filter(t => t.type === 'wall').length === 7), 3000, 'guest sees 7 walls');
// both mirrored boards must converge on the same maze (each applies server changes with its own display delay)
await until(async () => {
const [ra, rb] = await Promise.all([A, B].map((p) => p.page.evaluate(() => NW.app.ctrl.board.routeLen)));
return Math.abs(ra - rb) < 1e-6 && ra > 26;
}, 3000, 'mirrored boards agree on the route length');
console.log('ok - mirrored boards agree on the route length');
// guest builds a turret (tap, tap), host sees it owned by slot 1
await B.page.tap('.tbtn[data-type="filter"]');
const gp = await cellPt(B, boxB, 11, 6);
await B.page.touchscreen.tap(gp.x, gp.y); await sleep(150); await B.page.touchscreen.tap(gp.x, gp.y);
await until(() => A.page.evaluate(() => NW.app.ctrl.view.towers.some(t => t.type === 'filter' && t.owner === 1)), 3000, 'host sees guest turret with owner 1');
await until(async () => (await A.page.evaluate(() => NW.app.ctrl.view.gold)) === 80 && (await B.page.evaluate(() => NW.app.ctrl.view.gold)) === 80, 3000, 'shared credits 140-35-25=80 on both screens');
console.log('ok - shared credit pool');
// cursors and pings
const mp = await cellPt(A, boxA, 6, 6);
await A.page.mouse.move(mp.x, mp.y); await A.page.mouse.move(mp.x + 5, mp.y + 5);
await until(() => B.page.evaluate(() => NW.app.ctrl.view.cursors.some(c => c.slot === 0)), 3000, 'guest sees host cursor');
await A.page.keyboard.down('Alt'); await A.page.mouse.click(mp.x, mp.y); await A.page.keyboard.up('Alt');
await until(() => B.page.evaluate(() => NW.app.renderer.marks.length > 0), 3000, 'guest sees host ping');
// either player starts the wave; both see monsters; kills are shared
await B.page.tap('#btnWave');
await until(() => A.page.evaluate(() => NW.app.ctrl.view.monsters.length > 0), 4000, 'host sees monsters');
await sleep(2500);
await A.page.screenshot({ path: OUT + 'coop-host.png' });
await B.page.screenshot({ path: OUT + 'coop-guest.png' });
const mA = await A.page.evaluate(() => NW.app.ctrl.view.monsters.length), mB = await B.page.evaluate(() => NW.app.ctrl.view.monsters.length);
assert(Math.abs(mA - mB) <= 2 && mA > 0, `both see the same monsters (${mA} vs ${mB})`);
// pause is shared; speed is shared
await A.page.click('#btnPause');
await until(() => B.page.evaluate(() => NW.app.ctrl.view.paused === true), 3000, 'guest sees pause');
await B.page.tap('#btnPause');
await until(() => A.page.evaluate(() => NW.app.ctrl.view.paused === false), 3000, 'host sees resume');
const rtt = await A.page.evaluate(() => NW.app.ctrl.rtt);
console.log('rtt ms', rtt);
// guest's connection drops: auto reconnect resumes the same seat
await B.page.evaluate(() => NW.app.ctrl.ws.close());
await until(() => B.page.evaluate(() => NW.app.ctrl.status === 'reconnecting'), 2000, 'guest shows reconnecting').catch(() => console.log('(reconnect was instant)'));
await until(() => B.page.evaluate(() => NW.app.ctrl.status === 'joined' && NW.app.ctrl.you.slot === 1), 8000, 'guest resumed seat');
const towersB = await B.page.evaluate(() => NW.app.ctrl.view.towers.length);
assert(towersB === 8, 'state restored after reconnect (' + towersB + ' towers)');
// host leaves -> guest becomes host
await A.page.evaluate(() => NW.app.ctrl.close());
await until(() => B.page.evaluate(() => NW.app.ctrl.players.length === 1 && NW.app.ctrl.you.host), 4000, 'guest promoted to host');
if (errors.length) throw new Error('console errors:\n' + errors.join('\n'));
console.log('no console errors');
};

View file

@ -0,0 +1,32 @@
const sleep = (ms) => new Promise(r => setTimeout(r, ms));
const sizes = [[320,568],[360,640],[375,667],[390,844],[414,896],[768,1024],[1024,768],[568,320],[667,375],[740,360],[844,390],[932,430],[1280,720],[1920,1080]];
module.exports = async function ({ browser, url: URL, out: OUT }) {
let bad = 0;
for (const [w, h] of sizes) {
const touch = Math.min(w, h) < 800;
const ctx = await browser.newContext({ viewport: { width: w, height: h }, deviceScaleFactor: 1, isMobile: touch, hasTouch: touch });
const page = await ctx.newPage();
await page.goto(URL); await sleep(250);
await page.click('#btnSolo'); await sleep(150); await page.click('#btnHelpClose'); await sleep(150);
await page.evaluate(() => { document.getElementById('netChip').hidden = false; document.getElementById('netRoom').textContent = 'ABCD'; document.getElementById('netPing').textContent = '123 ms'; });
await page.tap ? 0 : 0;
await page.click('.tbtn[data-type="ids"]'); await sleep(100);
const m = await page.evaluate(() => {
const r = (id) => document.getElementById(id).getBoundingClientRect();
const tb = document.getElementById('topbar'), st = r('stage'), side = r('side'), pal = r('palette');
const overflowX = document.documentElement.scrollWidth > innerWidth + 1;
const tbOver = tb.scrollWidth > tb.clientWidth + 1;
const kids = [...tb.children].filter(c => !c.hidden && getComputedStyle(c).display !== 'none').map(c => c.getBoundingClientRect());
const clipped = kids.some(k => k.right > innerWidth + 1);
const cell = NW.app.renderer.cellSizePx();
return { stage: [Math.round(st.width), Math.round(st.height)], topbarH: Math.round(tb.getBoundingClientRect().height), cell: +cell.toFixed(1), rot: NW.app.renderer.rot > 0, overflowX, tbOver, clipped, sideH: Math.round(side.height), palVisible: pal.bottom <= innerHeight && pal.height > 40 };
});
const flag = (m.overflowX || m.tbOver || m.clipped || !m.palVisible || m.cell < 12) ? ' <== CHECK' : '';
if (flag) bad++;
console.log(`${w}x${h}`.padEnd(10), JSON.stringify(m), flag);
if (flag) await page.screenshot({ path: `${OUT}matrix-${w}x${h}.png` });
await ctx.close();
}
if (bad) throw new Error(bad + ' layouts have problems');
console.log('all layouts ok');
};