fix(web): corrige l'e2e onboarding cassé par l'étape sources
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>
This commit is contained in:
parent
766d48eaa5
commit
30fffd59ad
3 changed files with 20 additions and 4 deletions
|
|
@ -6,11 +6,12 @@ Feature: Onboarding wizard
|
||||||
Background:
|
Background:
|
||||||
Given the planning request returns nothing
|
Given the planning request returns nothing
|
||||||
|
|
||||||
Scenario: Walks through all three steps, creating a household on the way, and lands on the home page
|
Scenario: Walks through the wizard, creating a household on the way (which surfaces the sources step), and lands on the home page
|
||||||
Given the diets reference list has options
|
Given the diets reference list has options
|
||||||
And selecting the diet will succeed
|
And selecting the diet will succeed
|
||||||
And the household request returns no household
|
And the household request returns no household
|
||||||
And creating a household will succeed
|
And creating a household will succeed
|
||||||
|
And the sources reference list is empty
|
||||||
And the allergies reference list has options
|
And the allergies reference list has options
|
||||||
And updating allergies will succeed
|
And updating allergies will succeed
|
||||||
And I have signed up
|
And I have signed up
|
||||||
|
|
@ -25,7 +26,7 @@ Feature: Onboarding wizard
|
||||||
And I click the button "Créer"
|
And I click the button "Créer"
|
||||||
Then the household creation request should have been made with name "Chez Alice"
|
Then the household creation request should have been made with name "Chez Alice"
|
||||||
And the URL should include "/onboarding/allergenes"
|
And the URL should include "/onboarding/allergenes"
|
||||||
And I should see "Étape 3 sur 3"
|
And I should see "Étape 4 sur 4"
|
||||||
And I should see the section "Allergies"
|
And I should see the section "Allergies"
|
||||||
And I should see the section "Intolérances"
|
And I should see the section "Intolérances"
|
||||||
When I check the checkbox "Arachides"
|
When I check the checkbox "Arachides"
|
||||||
|
|
@ -56,6 +57,7 @@ Feature: Onboarding wizard
|
||||||
And selecting the diet will succeed
|
And selecting the diet will succeed
|
||||||
And the household request returns no household
|
And the household request returns no household
|
||||||
And joining a household will succeed
|
And joining a household will succeed
|
||||||
|
And the sources reference list is empty
|
||||||
And the allergies reference list is empty
|
And the allergies reference list is empty
|
||||||
And updating allergies will succeed
|
And updating allergies will succeed
|
||||||
And I have signed up
|
And I have signed up
|
||||||
|
|
|
||||||
|
|
@ -31,3 +31,13 @@ Given("the allergies reference list has options", () => {
|
||||||
Given("the allergies reference list is empty", () => {
|
Given("the allergies reference list is empty", () => {
|
||||||
cy.intercept("GET", "**/reference/allergies", { statusCode: 200, body: [] });
|
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: [] });
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -44,9 +44,13 @@ export function OnboardingSourcesPage() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSources(result);
|
setSources(result);
|
||||||
|
setIsLoading(false);
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.catch(() => {
|
||||||
if (!cancelled) setIsLoading(false);
|
// Nothing to configure sources for if we can't even list them — the
|
||||||
|
// wizard shouldn't strand the visitor here over a transient failure
|
||||||
|
// fetching an optional step's own data.
|
||||||
|
if (!cancelled) navigate("/onboarding/allergenes", { replace: true });
|
||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue