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>
23 lines
908 B
JavaScript
23 lines
908 B
JavaScript
// Rôle : vérifie le build de production servi par server.mjs, sans réutiliser une instance Vite de développement.
|
|
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
export default defineConfig({
|
|
testDir: "./e2e/production",
|
|
workers: 1,
|
|
outputDir: "test-results/production",
|
|
reporter: [["list"], ["html", { open: "never", outputFolder: "playwright-report/production" }]],
|
|
use: {
|
|
baseURL: "http://127.0.0.1:4173",
|
|
trace: "retain-on-failure",
|
|
screenshot: "only-on-failure"
|
|
},
|
|
webServer: {
|
|
// Le serveur Node livré, et non Vite Preview : il porte la CSP et les en-têtes de production.
|
|
command: "node server.mjs",
|
|
env: { HOST: "127.0.0.1", PORT: "4173", CARDS_ENABLED: "false" },
|
|
url: "http://127.0.0.1:4173",
|
|
reuseExistingServer: false,
|
|
timeout: 120000
|
|
},
|
|
projects: [{ name: "chromium-production", use: { ...devices["Desktop Chrome"] } }]
|
|
});
|