From 6f02cc0922b409772a6f0c3ab21f4c0348c57e73 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 18 Aug 2026 14:11:29 +0200 Subject: [PATCH] fix(e2e): mock GET /reference/ingredients et /profile/disliked-ingredients MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit preferences.cy.ts échouait en CI (3/4 tests) sur des assertions sans rapport apparent avec le contenu changé cette session (#diet introuvable, 'Arachides' introuvable) : PreferencesPage.tsx charge aussi ces deux endpoints dans le même Promise.all que diets/allergies (pour DislikedIngredientsField), mais le test ne les mockait pas — la requête réseau réelle échoue en CI (pas de backend), le Promise.all rejette, la page entière rend son état d'erreur au lieu du formulaire, ce qui fait disparaître #diet et les cases à cocher d'allergies avec. Co-Authored-By: Claude Sonnet 5 --- apps/web/cypress/e2e/preferences.cy.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/web/cypress/e2e/preferences.cy.ts b/apps/web/cypress/e2e/preferences.cy.ts index 698a219..fcaaa64 100644 --- a/apps/web/cypress/e2e/preferences.cy.ts +++ b/apps/web/cypress/e2e/preferences.cy.ts @@ -28,6 +28,14 @@ describe("Dietary preferences (/parametres/preferences) — hot saving", () => { ], }); cy.intercept("GET", "**/profile/allergies", { statusCode: 200, body: [2] }); + // The page also loads the reference ingredient list + the profile's + // disliked-ingredients selection for `DislikedIngredientsField` — added + // alongside `getDiets`/`getAllergies` in the same `Promise.all` (see + // PreferencesPage.tsx), so both need mocking here too or that `Promise.all` + // rejects and the whole page renders its error state instead of the form, + // taking `#diet`/the allergy checkboxes down with it. + cy.intercept("GET", "**/reference/ingredients", { statusCode: 200, body: [] }); + cy.intercept("GET", "**/profile/disliked-ingredients", { statusCode: 200, body: [] }); }); it("loads the current regime, and shows allergies/intolerances as two groups", () => {