Skip to content

Commit 44ed02d

Browse files
committed
feat(admin): added tests to check if admin can send certification to certification registry manager
1 parent eff065b commit 44ed02d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/reva-admin-react/cypress/e2e/certifications/update-certification-page/update-certification-page.cy.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ function interceptCertification({
55
withStructure,
66
withCertificationAuthoritiesOfCertification,
77
withCertificationRegistryManagerAssociatedToStructure,
8+
withStatusV2,
89
}: {
910
withStructure?: boolean;
1011
withCertificationAuthoritiesOfCertification?: boolean;
1112
withCertificationRegistryManagerAssociatedToStructure?: boolean;
13+
withStatusV2?: string;
1214
} = {}) {
1315
cy.intercept("POST", "/api/graphql", (req) => {
1416
stubQuery(
@@ -26,6 +28,9 @@ function interceptCertification({
2628
data: {
2729
getCertification: {
2830
...certificationBPBoucher.data.getCertification,
31+
statuV2:
32+
withStatusV2 ||
33+
certificationBPBoucher.data.getCertification.statusV2,
2934
certificationAuthorities: withCertificationAuthoritiesOfCertification
3035
? [
3136
{
@@ -273,5 +278,29 @@ context("when i access the update certification page ", () => {
273278
"http://localhost:3003/admin2/certifications-v2/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b/structure/",
274279
);
275280
});
281+
282+
it("let me check if button 'envoyer' is visible is statusV2 equal to 'BROUILLON'", function () {
283+
interceptCertification({ withStatusV2: "BROUILLON" });
284+
285+
cy.admin("/certifications-v2/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b");
286+
cy.wait("@activeFeaturesForConnectedUser");
287+
cy.wait("@getOrganismForAAPVisibilityCheck");
288+
cy.wait("@getMaisonMereCGUQuery");
289+
cy.wait("@getCertificationForUpdateCertificationPage");
290+
291+
cy.get('[data-test="button-send"]').should("exist");
292+
});
293+
294+
it("let me check if button 'envoyer' is no more visible if statusV2 different from 'BROUILLON'", function () {
295+
interceptCertification({ withStatusV2: "A_VALIDER_PAR_CERTIFICATEUR" });
296+
297+
cy.admin("/certifications-v2/bf78b4d6-f6ac-4c8f-9e6b-d6c6ae9e891b");
298+
cy.wait("@activeFeaturesForConnectedUser");
299+
cy.wait("@getOrganismForAAPVisibilityCheck");
300+
cy.wait("@getMaisonMereCGUQuery");
301+
cy.wait("@getCertificationForUpdateCertificationPage");
302+
303+
cy.get('[data-test="button-send"]').should("not.exist");
304+
});
276305
});
277306
});

packages/reva-admin-react/src/app/(admin)/certifications-v2/[certificationId]/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ const PageContent = ({
247247
pas encore des candidats.
248248
</p>
249249
<Button
250+
data-test="button-send"
250251
disabled={!certification.certificationAuthorityStructure}
251252
className="h-[40px] self-end"
252253
onClick={onClickSend}

0 commit comments

Comments
 (0)