Stage 1: `deflateToBase64url`/`inflateFromBase64url` (CompressionStream deflate-raw,
offline, file://); `SNIP.compressJs` cu helpers inflate (doubled backslashes).
Stage 2: `campaignShell({tplJson,masterExpr,titleExpr,nStyles,bootMode})` refactor;
gameCampaign = wrapper subțire; bootMode='inline' (nop) | 'hash' (player).
Stage 3: `playerHTML()` — toate 5 motoare inline; boot async cu `(async function(){})()`
(fix: lipsea `function`, eroare Unexpected token '{' în Chromium); MASTER din
location.hash deflate-raw; orchestrator în <script type="text/plain" id="run">.
Stage 4: Encoder QR vanilla JS — GF(256), Reed-Solomon ECC L, byte mode, versiuni 1-22,
8 măști + penalty, BCH format/version. `makeQrSvg(text, opts)` → SVG.
Stage 5: UI builder — fieldset distribuie, #btnShare/#btnCopyLink/#btnDownloadPlayer/
#btnPrintQr, #qrBox, #qrCard (print A4). baseUrl în state, deleted din cleanState().
Tests: 41/41 (6 noi @share). Fix test player: necesită __ow.enterDoor(0) după btn-start
(overworld first, then enter room). Demo files: restaurate din git (configs hardcodate în @regresie).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
44 lines
2.1 KiB
Markdown
44 lines
2.1 KiB
Markdown
# tests/ — Harness Playwright
|
|
|
|
## Purpose
|
|
Smoke + regresie + campanie E2E pentru jocurile generate. Verifică faptic: fiecare stil se rezolvă
|
|
până la ecranul final, fără erori de consolă.
|
|
|
|
## Ownership
|
|
- `tests/smoke.mjs` — unicul fișier de teste (~41 teste).
|
|
- `playwright.config.mjs` (la root, **gitignored**) — config dev.
|
|
|
|
## Local Contracts
|
|
- **NU commita `package.json` / `package-lock.json` / `playwright.config.mjs`** — produsul rămâne
|
|
zero-dependențe. Instalarea dev e o singură dată: `npm i -D @playwright/test && npx playwright install chromium`.
|
|
- **Fără npm scripts** — se rulează direct cu `npx`.
|
|
- **Teste pe `file://`** — helper-ul `fileURL(name)` mapează cale relativă la `file://`; campania scrie
|
|
HTML temp generat via builder (`gameHTML`) și-l încarcă de pe `file://`. Testele `@share` scriu
|
|
player HTML temp în `tests/.tmp-player*.html` (deleted în `finally`).
|
|
- **Zero erori consolă = invariant.** `trackErrors(page)` colectează `console.error` + `pageerror`;
|
|
fiecare test asertează `errors.length === 0` la final.
|
|
- **Tag-uri:** `@regresie` (16), `@campanie` (21), `@share` (6 — Iterația 3):
|
|
- `@share compresie round-trip` — deflate/inflate builder
|
|
- `@share QR structural` — makeQrSvg SVG valid
|
|
- `@share playerHTML()` — structura HTML player
|
|
- `@share player porneste din hash` — campanie 1 cameră din URL hash; folosește `__ow.enterDoor(0)`
|
|
- `@share player fara hash` — mesaj „Niciun joc"
|
|
- `@share share UI` — butoane disabled fără CompressionStream
|
|
- **Status țintă: 41/41 PASS.**
|
|
|
|
## Work Guidance
|
|
- După modificări la motoare (`escape-builder.html`): rulează suita completă; extinde `@regresie` dacă
|
|
adaugi/schimbi un stil, `@campanie` pentru contractul de montare, `@share` pentru Iterația 3.
|
|
- Nu testa pe screenshot-uri de pixeli — asertează stare/text/erori.
|
|
|
|
## Verification
|
|
```bash
|
|
npx playwright test tests/smoke.mjs # 41/41
|
|
npx playwright test tests/smoke.mjs --grep @regresie # 16
|
|
npx playwright test tests/smoke.mjs --grep @campanie # 21
|
|
npx playwright test tests/smoke.mjs --grep @share # 6
|
|
```
|
|
|
|
## Child DOX Index
|
|
(none — leaf)
|