GET /reference/sources n'était intercepté par aucun scénario Cypress menant à la création/jonction d'un foyer — la requête réelle restait en attente indéfiniment, laissant OnboardingSourcesPage bloqué sur /onboarding/sources au lieu de s'auto-sauter vers /onboarding/allergenes. - Ajout du Given "the sources reference list is empty" (même pattern que les intercepts diets/allergies existants), câblé dans les deux scénarios qui créent/rejoignent un foyer. - Mise à jour de l'assertion "Étape 3 sur 3" → "Étape 4 sur 4" : un foyer étant créé dans ce scénario, l'étape allergènes affiche désormais le total dynamique (4 étapes) comme prévu. - OnboardingSourcesPage.tsx : redirige aussi vers /onboarding/allergenes en cas d'échec réseau sur getSources(), pas seulement quand la liste est vide — le wizard ne doit pas bloquer l'utilisateur sur une étape optionnelle à cause d'un problème transitoire. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
import { Given } from "@badeball/cypress-cucumber-preprocessor";
|
|
|
|
// Shared across auth.feature (signup) and onboarding.feature (wizard) — both
|
|
// need the diets/allergies reference lists mocked before reaching a step
|
|
// that reads them, in either their "has options" or "is empty" shape.
|
|
|
|
Given("the diets reference list has options", () => {
|
|
cy.intercept("GET", "**/reference/diets", {
|
|
statusCode: 200,
|
|
body: [
|
|
{ id: 1, key: "omnivore" },
|
|
{ id: 2, key: "vegetarian" },
|
|
],
|
|
});
|
|
});
|
|
|
|
Given("the diets reference list is empty", () => {
|
|
cy.intercept("GET", "**/reference/diets", { statusCode: 200, body: [] });
|
|
});
|
|
|
|
Given("the allergies reference list has options", () => {
|
|
cy.intercept("GET", "**/reference/allergies", {
|
|
statusCode: 200,
|
|
body: [
|
|
{ id: 1, key: "peanuts", kind: "ALLERGY" },
|
|
{ id: 2, key: "gluten", kind: "INTOLERANCE" },
|
|
],
|
|
});
|
|
});
|
|
|
|
Given("the allergies reference list is empty", () => {
|
|
cy.intercept("GET", "**/reference/allergies", { statusCode: 200, body: [] });
|
|
});
|
|
|
|
// Every onboarding scenario that reaches the household step also reaches
|
|
// `/onboarding/sources` right after (when a household got created/joined —
|
|
// see `OnboardingHouseholdPage`'s `goToNextStep`), which reads this before
|
|
// self-skipping to `/onboarding/allergenes`. No "has options" counterpart
|
|
// yet — no source is implemented in the app itself, so there's nothing
|
|
// real to mock a populated catalog with.
|
|
Given("the sources reference list is empty", () => {
|
|
cy.intercept("GET", "**/reference/sources", { statusCode: 200, body: [] });
|
|
});
|