From 185fedee81246be32853e9338835f662a2ad4a42 Mon Sep 17 00:00:00 2001 From: Alexandre Garbe Date: Wed, 11 Dec 2024 15:39:42 +0100 Subject: [PATCH] feat(admin): added an update certifification prerequisites update button on the registry manager certification update prerequisites summary card --- .../update-certification-page.cy.ts | 23 +++++++++++++++++++ .../certifications/[certificationId]/page.tsx | 8 +++++++ 2 files changed, 31 insertions(+) diff --git a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts index 0127fba4e..f0ac8062e 100644 --- a/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts +++ b/packages/reva-admin-react/cypress/e2e/responsable-certifications/certifications/update-certification-page/update-certification-page.cy.ts @@ -175,5 +175,28 @@ context("when i access the update certification page ", () => { '[data-test="prerequisites-summary-card"] [data-test="prerequisite-list"] > li', ).should("have.length", 2); }); + + it("let me click on the 'update' button of the prerequisites summary card and leads me to the correct page", function () { + interceptCertification({ withPrerequisites: true }); + + cy.admin( + "/responsable-certifications/certifications/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b", + ); + cy.wait("@activeFeaturesForConnectedUser"); + cy.wait("@getOrganismForAAPVisibilityCheck"); + cy.wait("@getMaisonMereCGUQuery"); + cy.wait( + "@getCertificationForCertificationRegistryManagerUpdateCertificationPage", + ); + + cy.get( + '[data-test="prerequisites-summary-card"] [data-test="action-button"]', + ).click(); + + cy.url().should( + "eq", + "http://localhost:3003/admin2/responsable-certifications/certifications/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b/prerequisites/", + ); + }); }); }); diff --git a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx index 66415c2bb..8c17cd2fe 100644 --- a/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx +++ b/packages/reva-admin-react/src/app/responsable-certifications/certifications/[certificationId]/page.tsx @@ -59,6 +59,14 @@ const PageContent = ({ data-test="prerequisites-summary-card" title="Prérequis obligatoires" titleIconClass="fr-icon-success-fill" + hasButton + buttonTitle="Modifier" + buttonPriority="secondary" + buttonOnClick={() => + router.push( + `/responsable-certifications/certifications/${certification.id}/prerequisites`, + ) + } > {certification.prerequisites.length ? (