Nouvelle app Vite/React independante (workspace apps/*), calquee sur apps/web : port 5174, sa propre image Docker (nginx statique), son propre domaine/deploiement. - AdminApiClient (VITE_ADMIN_API_URL, credentials: include) + ApiError. - AdminAuthContext / RequireAdmin : restaure la session admin via GET /admin/auth/me, garde de route (miroir de AuthContext/RequireAuth). - LoginPage (/login) : validation cliente via adminLoginSchema partage, erreurs traduites via ErrorMessageService. - AdminLayout : sidebar (Tableau de bord / Monitoring / Corrections) + deconnexion, rendu une fois autour du groupe RequireAdmin. - Pages Dashboard / Monitoring / Corrections en placeholder (remplies aux PR 3-5). - i18n fr (bloc admin.* + sous-ensemble errors.*), tokens _theme.scss copies de apps/web (extraction en package partage : suivi separe). - Dockerfile multi-stage (node build -> nginx:alpine) + nginx.conf (SPA fallback). Service admin-web dans docker-compose.yml (port ADMIN_WEB_PORT, VITE_ADMIN_API_URL en build arg). - Cypress : login.feature (KO -> message, OK -> dashboard) + admin-layout .cy.ts (redirection /login sans session, nav entre sections, logout). Job "Run admin-web E2E tests" ajoute a ci.yml. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
24 lines
866 B
TypeScript
24 lines
866 B
TypeScript
import { Given } from "@badeball/cypress-cucumber-preprocessor";
|
|
|
|
const adminBody = {
|
|
id: 1,
|
|
email: "ops@example.com",
|
|
name: "Ops",
|
|
createdAt: "2026-08-01T00:00:00.000Z",
|
|
lastLoginAt: "2026-08-28T09:00:00.000Z",
|
|
};
|
|
|
|
Given("admin login fails with invalid credentials", () => {
|
|
cy.intercept("POST", "**/admin/auth/login", {
|
|
statusCode: 401,
|
|
body: { code: 4010, message: "Invalid email or password" },
|
|
});
|
|
});
|
|
|
|
Given("admin login succeeds as {string}", (name: string) => {
|
|
const body = { ...adminBody, name, email: `${name.toLowerCase()}@example.com` };
|
|
cy.intercept("POST", "**/admin/auth/login", { statusCode: 200, body });
|
|
// After navigate("/"), RequireAdmin re-checks the session — from now on it
|
|
// must report authenticated (last matching intercept wins).
|
|
cy.intercept("GET", "**/admin/auth/me", { statusCode: 200, body });
|
|
});
|