Test: fix auth.cy.ts signup test — stale post-onboarding-wizard assertions
Retour de CI (job e2e, PR #10) : "creates a profile and lands on the home page" échouait avec une exception non gérée ("Failed to fetch") depuis OnboardingHouseholdPage's GET /house/current — jamais mocké dans ce test. Cause : ce test n'avait jamais été mis à jour quand le signup a commencé à rediriger vers /onboarding/foyer au lieu de "/" directement (fait dans le commit du wizard d'inscription, plus tôt sur cette PR) — seul le texte "Bonjour Alice Martin" -> "Bonjour Alice" avait été corrigé à l'époque, pas la destination réelle de la redirection. Invisible localement : je n'ai pas pu faire tourner Cypress dans ce sandbox (crash GPU headless, confirmé pré-existant), donc ce test n'avait jamais réellement été exécuté après ce changement — seulement typechecké. Fix : le test vérifie maintenant qu'il atterrit sur /onboarding/foyer (pas la home) avec le nom du foyer préaffiché, et mocke GET /house/current comme le fait déjà onboarding.cy.ts pour ce même écran. Vérifié via tsc --noEmit (Cypress toujours injouable localement ici) — CI à re-checker après push.
This commit is contained in:
parent
8f25e53f11
commit
189621c306
1 changed files with 12 additions and 4 deletions
|
|
@ -6,9 +6,14 @@ import { ErrorCode } from "@batch-cooking/shared";
|
||||||
// suites against a real database.
|
// suites against a real database.
|
||||||
|
|
||||||
describe("Signup", () => {
|
describe("Signup", () => {
|
||||||
it("creates a profile and lands on the home page", () => {
|
it("creates a profile and starts the onboarding wizard (household/regime/allergens)", () => {
|
||||||
cy.intercept("GET", "**/auth/me", { statusCode: 401 });
|
cy.intercept("GET", "**/auth/me", { statusCode: 401 });
|
||||||
cy.intercept("GET", "**/planning/current", { statusCode: 200, body: null });
|
// The onboarding wizard's first step (see onboarding.cy.ts for the full
|
||||||
|
// walkthrough) reads the household right away to prefill its name field.
|
||||||
|
cy.intercept("GET", "**/house/current", {
|
||||||
|
statusCode: 200,
|
||||||
|
body: { id: 1, name: "Foyer de Alice" },
|
||||||
|
});
|
||||||
cy.intercept("POST", "**/auth/signup", {
|
cy.intercept("POST", "**/auth/signup", {
|
||||||
statusCode: 201,
|
statusCode: 201,
|
||||||
body: {
|
body: {
|
||||||
|
|
@ -30,8 +35,11 @@ describe("Signup", () => {
|
||||||
cy.contains("button", "Créer mon profil").click();
|
cy.contains("button", "Créer mon profil").click();
|
||||||
|
|
||||||
cy.wait("@signup");
|
cy.wait("@signup");
|
||||||
cy.url().should("not.include", "/signup");
|
// Not the home page directly — signup hands off to the onboarding
|
||||||
cy.contains("Bonjour Alice").should("be.visible");
|
// wizard first (RedirectIfAuthenticated no longer applies here, it's a
|
||||||
|
// RequireAuth-gated route of its own, see App.tsx).
|
||||||
|
cy.url().should("include", "/onboarding/foyer");
|
||||||
|
cy.get("#houseName").should("have.value", "Foyer de Alice");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("shows a client-side validation error without calling the API", () => {
|
it("shows a client-side validation error without calling the API", () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue