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:
parent
1c2071e6db
commit
faf0cfa603
27 changed files with 3383 additions and 28 deletions
47
e2e/scenarios/01-smoke.js
Normal file
47
e2e/scenarios/01-smoke.js
Normal 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');
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue