Run the production E2E against the Node server and its CSP

Vite Preview sends none of the headers of server.mjs, so the production E2E
passed while the CSP blocked the calculator formulas in production. The build
is now served by server.mjs with Sokko TCG disabled, and a new spec saves and
updates a calculator result there, failing on any CSP violation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-07 20:24:18 +01:00
parent 00c9c3dbc1
commit 4b4181818a
4 changed files with 46 additions and 7 deletions

View file

@ -317,8 +317,10 @@ environnement non public avant l'activation.
`npm run build` produit l'application dans `website/dist`. `npm start` sert ce
répertoire avec `server.mjs` et, lorsque la fonctionnalité est activée, expose
l'API `/api/cards`. Les tests de Vite Preview couvrent le comportement du build
dans le navigateur, mais ni les en-têtes HTTP ni l'API de ce serveur Node.
l'API `/api/cards`. Les tests E2E de production servent le build avec ce même
serveur, Sokko TCG désactivé : ils couvrent le comportement du build dans le
navigateur sous la CSP de `server.mjs`, mais pas l'API `/api/cards`, que
`npm run test:e2e:cards` valide.
La politique de cache du serveur est la suivante :

View file

@ -32,6 +32,7 @@ not bugs, missing scenarios or a percentage of work remaining.
| Planner: editing, quantities, partial-progress resets, prerequisites, subtree reorder, drawer and cross-page persistence | `e2e/task-planner.spec.js`; `tests/task-planner-quantities.test.mjs` and v2 import tests |
| Representative visual states and responsive layouts | `e2e/style-layouts.spec.js`, `tool-style-states.spec.js`, `card-surfaces.spec.js`, `nds-controls.spec.js`, `nds-patterns.spec.js` |
| Production onboarding | `e2e/production/onboarding.spec.js` |
| Formula tools under the production CSP | `e2e/production/content-security-policy.spec.js`; `tests/server-cache.test.mjs` forbids string evaluation in client code |
These suites cover selected risks, not every permutation of every tool.
Public formats, product vocabulary, editorial validation, security restrictions
@ -68,9 +69,10 @@ change affects persisted data, imports, user interaction or delivery.
`StrictMode`; it validates interactive behavior against source modules.
`npm run check:full` lui réserve le port 4181 pour ne pas réutiliser une
instance personnelle éventuellement ouverte sur 5173.
- `npm run test:e2e:production` rebuilds the client and exercises the Vite
Preview result. It catches build-only behavior and stale-bundle recovery, but
does not run the Node static server or the production proxy.
- `npm run test:e2e:production` rebuilds the client and serves it with
`server.mjs`, Sokko TCG disabled. It catches build-only behavior, stale-bundle
recovery and anything the Node server's CSP blocks, such as `eval` in a tool.
It does not exercise headers added by the production proxy.
- `npm run test:e2e:cards` construit l'application puis lance `server.mjs` avec
une base SQLite temporaire, la connexion de test et Sokko TCG activé. Il
valide la reprise d'ouverture, l'album, l'administration et le layout à