- household.cy.ts scindé en preferences.cy.ts (régime/allergies) et household-settings.cy.ts (nom, créer/rejoindre/membres/suppression/ quitter, avec et sans droits admin) - onboarding.cy.ts réordonné (régime → foyer → allergènes), avec les cas skip / créer / rejoindre à l'étape foyer - account.cy.ts: identité, suppression de compte (erreur de mot de passe, succès, annulation) - sidebar.cy.ts: menu Paramètres (3 liens) et menu compte (Mon compte, déconnexion), redirection /foyer → /parametres/foyer - auth.cy.ts/home-planning.cy.ts: adaptés au nouveau menu compte et au premier écran d'onboarding (régime, plus foyer)
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
// Mocks the API via cy.intercept — see auth.cy.ts for the rationale.
|
|
|
|
const authenticatedProfile = {
|
|
id: 1,
|
|
firstName: "Alice",
|
|
lastName: "Martin",
|
|
email: "alice@example.com",
|
|
tokenVersion: 0,
|
|
houseId: null,
|
|
dietId: null,
|
|
};
|
|
|
|
describe("Sidebar — settings menu and account menu", () => {
|
|
beforeEach(() => {
|
|
cy.intercept("GET", "**/auth/me", { statusCode: 200, body: authenticatedProfile });
|
|
cy.intercept("GET", "**/planning/current", { statusCode: 200, body: null });
|
|
});
|
|
|
|
it("no longer lists Foyer in the main nav", () => {
|
|
cy.visit("/");
|
|
cy.get(".app-sidebar__nav a").should("not.contain", "Foyer");
|
|
});
|
|
|
|
it("reveals the three settings pages behind the Paramètres toggle", () => {
|
|
cy.visit("/");
|
|
|
|
cy.contains("a", "Compte").should("not.exist");
|
|
cy.contains("button", "Paramètres").click();
|
|
|
|
cy.contains("a", "Compte").should("have.attr", "href", "/parametres/compte");
|
|
cy.contains("a", "Préférences").should("have.attr", "href", "/parametres/preferences");
|
|
cy.contains("a", "Foyer").should("have.attr", "href", "/parametres/foyer");
|
|
});
|
|
|
|
it("opens the account menu from the greeting and links to Mon compte", () => {
|
|
cy.visit("/");
|
|
|
|
cy.contains("a", "Mon compte").should("not.exist");
|
|
cy.contains("button", "Bonjour Alice").click();
|
|
cy.contains("a", "Mon compte").click();
|
|
|
|
cy.url().should("include", "/parametres/compte");
|
|
});
|
|
|
|
it("redirects the old /foyer path to /parametres/foyer", () => {
|
|
cy.intercept("GET", "**/house/current", { statusCode: 200, body: null });
|
|
cy.visit("/foyer");
|
|
cy.url().should("include", "/parametres/foyer");
|
|
});
|
|
});
|