-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(candidate): added some tests to candidate drop out decision page
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
packages/reva-candidate/cypress/e2e/candidacy-dropout/candidacy-dropout-decision.cy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { stubMutation, stubQuery } from "../../utils/graphql"; | ||
import candidateDropOut from "./fixtures/candidate-dropped-out.json"; | ||
|
||
function interceptCandidacy() { | ||
cy.intercept("POST", "/api/graphql", (req) => { | ||
stubMutation(req, "candidate_login", "candidate_login.json"); | ||
stubMutation( | ||
req, | ||
"updateCandidateCandidacyDropoutDecision", | ||
candidateDropOut, | ||
); | ||
stubQuery(req, "candidate_getCandidateWithCandidacy", { | ||
data: { | ||
candidate_getCandidateWithCandidacy: { | ||
...candidateDropOut.data.candidate_getCandidateWithCandidacy, | ||
candidacy: { | ||
...candidateDropOut.data.candidate_getCandidateWithCandidacy | ||
.candidacy, | ||
candidacyDropOut: { | ||
createdAt: "2021-09-01T00:00:00Z", | ||
dropOutConfirmedByCandidate: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
stubQuery(req, "getCandidacyForDropOutDecisionPage", { | ||
data: { | ||
candidate_getCandidateWithCandidacy: { | ||
candidacy: { | ||
id: "c1", | ||
}, | ||
}, | ||
}, | ||
}); | ||
stubQuery(req, "activeFeaturesForConnectedUser", "features.json"); | ||
}); | ||
} | ||
|
||
context("Candidacy dropout decision page", () => { | ||
it("should let me access the page", function () { | ||
interceptCandidacy(); | ||
cy.login(); | ||
cy.wait("@candidate_login"); | ||
cy.wait("@candidate_getCandidateWithCandidacy"); | ||
cy.wait("@activeFeaturesForConnectedUser"); | ||
cy.visit("/candidacy-dropout-decision/"); | ||
cy.wait("@getCandidacyForDropOutDecisionPage"); | ||
cy.get('[data-test="candidacy-dropout-decision-page"]').should("exist"); | ||
cy.get("h1").should("contain.text", "Abandon du parcours VAE"); | ||
}); | ||
it("should let me validate my drop out", function () { | ||
interceptCandidacy(); | ||
cy.login(); | ||
cy.wait("@candidate_login"); | ||
cy.wait("@candidate_getCandidateWithCandidacy"); | ||
cy.wait("@activeFeaturesForConnectedUser"); | ||
cy.visit("/candidacy-dropout-decision/"); | ||
cy.wait("@getCandidacyForDropOutDecisionPage"); | ||
cy.get(".drop-out-confirmation-radio-button~label").click(); | ||
cy.get("button[type=submit]").click(); | ||
cy.wait("@updateCandidateCandidacyDropoutDecision"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters