Skip to content

Commit d5941a2

Browse files
committed
test(candidacy): add e2e tests for Pending Contestation Caducite Banner
1 parent f34d1a7 commit d5941a2

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

packages/reva-candidate/cypress/e2e/candidacy-banner.cy.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,66 @@ context("Candidacy Banner Display Logic", () => {
2323
});
2424
});
2525

26+
describe("Pending Contestation Caducite Banner", () => {
27+
it("should display pending contestation banner and hide other banners when candidacy has pending contestation", () => {
28+
cy.fixture("candidate1.json").then((candidate) => {
29+
candidate.data.candidate_getCandidateWithCandidacy.candidacy.isCaduque = true;
30+
candidate.data.candidate_getCandidateWithCandidacy.candidacy.candidacyContestationsCaducite =
31+
[
32+
{
33+
certificationAuthorityContestationDecision: "DECISION_PENDING",
34+
contestationSentAt: new Date().getTime(),
35+
},
36+
];
37+
38+
cy.intercept("POST", "/api/graphql", (req) => {
39+
stubQuery(req, "candidate_getCandidateWithCandidacy", candidate);
40+
});
41+
});
42+
43+
cy.login();
44+
cy.wait("@candidate_login");
45+
cy.wait("@candidate_getCandidateWithCandidacy");
46+
cy.wait("@activeFeaturesForConnectedUser");
47+
48+
cy.get('[data-test="pending-contestation-caducite-banner"]').should(
49+
"exist",
50+
);
51+
cy.get('[data-test="caduque-banner"]').should("not.exist");
52+
cy.get('[data-test="actualisation-banner"]').should("not.exist");
53+
cy.get('[data-test="welcome-banner"]').should("not.exist");
54+
});
55+
56+
it("should display the correct contestation sent date", () => {
57+
const contestationDate = new Date(2023, 0, 15).getTime();
58+
59+
cy.fixture("candidate1.json").then((candidate) => {
60+
candidate.data.candidate_getCandidateWithCandidacy.candidacy.isCaduque = true;
61+
candidate.data.candidate_getCandidateWithCandidacy.candidacy.candidacyContestationsCaducite =
62+
[
63+
{
64+
certificationAuthorityContestationDecision: "DECISION_PENDING",
65+
contestationSentAt: contestationDate,
66+
},
67+
];
68+
69+
cy.intercept("POST", "/api/graphql", (req) => {
70+
stubQuery(req, "candidate_getCandidateWithCandidacy", candidate);
71+
});
72+
});
73+
74+
cy.login();
75+
cy.wait("@candidate_login");
76+
cy.wait("@candidate_getCandidateWithCandidacy");
77+
cy.wait("@activeFeaturesForConnectedUser");
78+
79+
cy.get('[data-test="pending-contestation-caducite-banner"]').should(
80+
"contain",
81+
"15/01/2023",
82+
);
83+
});
84+
});
85+
2686
describe("Caduque Banner", () => {
2787
VALID_STATUSES.forEach((status) => {
2888
it(`should display caduque banner and hide other banners when candidacy is caduque with ${status} status`, () => {

0 commit comments

Comments
 (0)