refactor(game): split game.js into sfx, pages, online and workshop modules (P4-5)

Modules are classic-script factories RC.Game<Part>(G); G gives live access to the shared state.
Guarded by new browser tests for every moved page and workshop tool (tests/e2e/screens.spec.js).
This commit is contained in:
Benjamin Oezcan
2026-11-19 09:58:53 +01:00
parent fade816169
commit 4535ac7d8a
11 changed files with 975 additions and 711 deletions

View File

@@ -3,6 +3,7 @@
const { test, expect } = require('@playwright/test');
const path = require('path');
const { pathToFileURL } = require('url');
const { credits } = require('./helpers');
const file = pathToFileURL(path.join(__dirname, '..', '..', 'game', 'index.html')).href;
@@ -19,7 +20,7 @@ test('campaign runs from file:// : training fight with the AI pilot, layout chec
test('campaign workshop: buying a part works offline', async ({ page }) => {
await page.goto(file + '?play');
await expect(page.locator('body')).toHaveAttribute('data-mode', 'garage');
const money = async () => Number((await page.locator('#hMoney').textContent()).replace(/[^\d]/g, ''));
const money = () => credits(page);
const before = await money();
await page.locator('.tab[data-slot="armour"]').click();
await page.locator('#cards .item:not(:has(.badge)):not(:has(.pr.no))').first().click();