-
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(api,admin): display error block on top of funding page when drop…
… out was declared less than 6 months ago
- Loading branch information
Showing
8 changed files
with
191 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
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,48 @@ | ||
import { stubQuery } from "../utils/graphql"; | ||
import { sub } from "date-fns"; | ||
|
||
function visitFunding({ dropOutCreationDate }: { dropOutCreationDate: Date }) { | ||
cy.fixture("candidacy-drop-out-funding.json").then((candidacyDroppedOut) => { | ||
candidacyDroppedOut.data.getCandidacyById.candidacyDropOut.createdAt = | ||
dropOutCreationDate; | ||
|
||
cy.intercept("POST", "/api/graphql", (req) => { | ||
stubQuery(req, "activeFeaturesForConnectedUser", "active-features.json"); | ||
stubQuery( | ||
req, | ||
"getOrganismForAAPVisibilityCheck", | ||
"visibility-check-admin.json", | ||
); | ||
stubQuery(req, "getAccountInfo", "account-admin.json"); | ||
|
||
stubQuery(req, "getCandidacyByIdFunding", candidacyDroppedOut); | ||
|
||
stubQuery( | ||
req, | ||
"getCandidacyMenuAndCandidateInfos", | ||
"candidacy-drop-out-menu.json", | ||
); | ||
}); | ||
}); | ||
|
||
cy.aap("/candidacies/46206f6b-0a59-4478-9338-45e3a8d968e4/funding"); | ||
} | ||
|
||
const sixMonthsAgo = sub(new Date(), { months: 6 }); | ||
const sixMonthsAgoMinusOneMinute = sub(new Date(), { months: 6, minutes: -1 }); | ||
|
||
context("Funding form", () => { | ||
it("display a 'not available' alert when dropped-out less than 6 month ago", function () { | ||
visitFunding({ dropOutCreationDate: sixMonthsAgoMinusOneMinute }); | ||
cy.wait("@getCandidacyByIdFunding"); | ||
cy.get('[data-test="funding-request-not-available"]').should("exist"); | ||
}); | ||
|
||
it("do not display any alert when dropped-out 6 month ago", function () { | ||
visitFunding({ dropOutCreationDate: sixMonthsAgo }); | ||
cy.wait("@getCandidacyByIdFunding"); | ||
// Make sure the form is ready before testing non-existence of the alert | ||
cy.get('[data-test="funding-form"]').should("exist"); | ||
cy.get('[data-test="funding-request-not-available"]').should("not.exist"); | ||
}); | ||
}); |
79 changes: 79 additions & 0 deletions
79
packages/reva-admin-react/cypress/fixtures/candidacy-drop-out-funding.json
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,79 @@ | ||
{ | ||
"data": { | ||
"getCandidacyById": { | ||
"financeModule": "unifvae", | ||
"candidacyStatuses": [ | ||
{ | ||
"status": "PROJET", | ||
"isActive": false | ||
}, | ||
{ | ||
"status": "VALIDATION", | ||
"isActive": false | ||
}, | ||
{ | ||
"status": "PRISE_EN_CHARGE", | ||
"isActive": false | ||
}, | ||
{ | ||
"status": "PARCOURS_ENVOYE", | ||
"isActive": false | ||
}, | ||
{ | ||
"status": "PARCOURS_CONFIRME", | ||
"isActive": false | ||
}, | ||
{ | ||
"status": "DOSSIER_FAISABILITE_ENVOYE", | ||
"isActive": false | ||
}, | ||
{ | ||
"status": "DOSSIER_FAISABILITE_INCOMPLET", | ||
"isActive": true | ||
} | ||
], | ||
"candidacyDropOut": { | ||
"createdAt": 1707305319452, | ||
"droppedOutAt": 0 | ||
}, | ||
"certificateSkills": "RNCP A", | ||
"otherTraining": "Texte B", | ||
"basicSkills": [ | ||
{ | ||
"id": "d2eac236-723b-4bb8-ae4c-5d16d320ec72", | ||
"label": "Usage et communication numérique" | ||
} | ||
], | ||
"mandatoryTrainings": [ | ||
{ | ||
"id": "2790458c-040f-417d-b081-1d74b715ff9b", | ||
"label": "Equipier de Première Intervention" | ||
}, | ||
{ | ||
"id": "16ffd197-b95c-431c-890b-77bf58c51c6b", | ||
"label": "Prévention et secours civiques de niveau 1 (PSC1)" | ||
}, | ||
{ | ||
"id": "378724fb-ba6c-4686-92d9-c48b92534374", | ||
"label": "Brevet national de sécurité et de sauvetage aquatique (BNSSA)" | ||
} | ||
], | ||
"organism": { | ||
"label": "Organism 1" | ||
}, | ||
"candidate": { | ||
"lastname": "Doe", | ||
"firstname": "Alice", | ||
"firstname2": null, | ||
"firstname3": null, | ||
"gender": null, | ||
"email": "[email protected]", | ||
"phone": "06000000" | ||
}, | ||
"certification": { | ||
"label": "CQP Technicien de la qualité" | ||
}, | ||
"fundingRequestUnifvae": null | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
packages/reva-admin-react/cypress/fixtures/candidacy-drop-out-menu.json
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,43 @@ | ||
{ | ||
"data": { | ||
"candidacyMenu_getCandidacyMenu": { | ||
"menuHeader": [ | ||
{ | ||
"label": "Résumé de la candidature", | ||
"url": "/admin2/candidacies/46206f6b-0a59-4478-9338-45e3a8d968e4/summary", | ||
"status": "ACTIVE_WITHOUT_HINT" | ||
} | ||
], | ||
"mainMenu": [ | ||
{ | ||
"label": "Abandon du candidat confirmé le 7 février 2024", | ||
"url": "/admin2/candidacies/46206f6b-0a59-4478-9338-45e3a8d968e4/drop-out", | ||
"status": "ACTIVE_WITHOUT_HINT" | ||
}, | ||
{ | ||
"label": "Demande de prise en charge", | ||
"url": "/admin2/candidacies/46206f6b-0a59-4478-9338-45e3a8d968e4/funding", | ||
"status": "ACTIVE_WITH_EDIT_HINT" | ||
}, | ||
{ | ||
"label": "Demande de paiement", | ||
"url": "/admin2/candidacies/46206f6b-0a59-4478-9338-45e3a8d968e4/payment/unifvae/invoice", | ||
"status": "INACTIVE" | ||
} | ||
], | ||
"menuFooter": [ | ||
{ | ||
"label": "Journal des actions", | ||
"url": "/admin2/candidacies/46206f6b-0a59-4478-9338-45e3a8d968e4/logs", | ||
"status": "ACTIVE_WITHOUT_HINT" | ||
} | ||
] | ||
}, | ||
"getCandidacyById": { | ||
"candidate": { | ||
"lastname": "Doe", | ||
"firstname": "Alice" | ||
} | ||
} | ||
} | ||
} |
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
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
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
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