From f80c4c151c47b4a1a665f5104daa094f0e771058 Mon Sep 17 00:00:00 2001 From: Alexandre Garbe Date: Wed, 11 Sep 2024 13:16:38 +0200 Subject: [PATCH] chore(candidate): fixed candidacy submission cypress tests --- ...ission.cy.js.disabled => submission.cy.js} | 24 ++-- .../fixtures/candidate2-submitted.json | 117 ++++++++--------- .../fixtures/candidate2-taken-over.json | 123 +++++++++--------- 3 files changed, 129 insertions(+), 135 deletions(-) rename packages/reva-candidate/cypress/e2e/{submission.cy.js.disabled => submission.cy.js} (61%) diff --git a/packages/reva-candidate/cypress/e2e/submission.cy.js.disabled b/packages/reva-candidate/cypress/e2e/submission.cy.js similarity index 61% rename from packages/reva-candidate/cypress/e2e/submission.cy.js.disabled rename to packages/reva-candidate/cypress/e2e/submission.cy.js index 2af73cf41..a918c67e8 100644 --- a/packages/reva-candidate/cypress/e2e/submission.cy.js.disabled +++ b/packages/reva-candidate/cypress/e2e/submission.cy.js @@ -3,14 +3,18 @@ import { stubMutation, stubQuery } from "../utils/graphql"; context("Submission", () => { it("log on a submitted project", function () { cy.intercept("POST", "/api/graphql", (req) => { - stubQuery(req, "getDepartments", "departments.json"); - stubMutation(req, "candidate_login", "candidate2-submitted.json"); - stubQuery(req, "getReferential", "referential.json"); + stubMutation(req, "candidate_login", "candidate_login.json"); + stubQuery( + req, + "candidate_getCandidateWithCandidacy", + "candidate2-submitted.json", + ); + stubQuery(req, "activeFeaturesForConnectedUser", "features.json"); }); cy.login(); cy.wait("@candidate_login"); - cy.wait("@getReferential"); + cy.wait("@candidate_getCandidateWithCandidacy"); cy.wait("@activeFeaturesForConnectedUser"); cy.get('[data-test="project-submitted-label"'); @@ -18,14 +22,18 @@ context("Submission", () => { it("log on a project taken over", function () { cy.intercept("POST", "/api/graphql", (req) => { - stubQuery(req, "getDepartments", "departments.json"); - stubMutation(req, "candidate_login", "candidate2-taken-over.json"); - stubQuery(req, "getReferential", "referential.json"); + stubMutation(req, "candidate_login", "candidate_login.json"); + stubQuery( + req, + "candidate_getCandidateWithCandidacy", + "candidate2-taken-over", + ); + stubQuery(req, "activeFeaturesForConnectedUser", "features.json"); }); cy.login(); cy.wait("@candidate_login"); - cy.wait("@getReferential"); + cy.wait("@candidate_getCandidateWithCandidacy"); cy.wait("@activeFeaturesForConnectedUser"); cy.get('[data-test="project-submitted-label"'); diff --git a/packages/reva-candidate/cypress/fixtures/candidate2-submitted.json b/packages/reva-candidate/cypress/fixtures/candidate2-submitted.json index 66e26613a..52a859704 100644 --- a/packages/reva-candidate/cypress/fixtures/candidate2-submitted.json +++ b/packages/reva-candidate/cypress/fixtures/candidate2-submitted.json @@ -1,68 +1,61 @@ { "data": { - "candidateLogged": { - "tokens": { - "accessToken": "abc", - "refreshToken": "def", - "idToken": "ghi" - }, - "candidate": { - "firstname": "John", - "lastname": "Doe", - "email": "email@example.com", - "phone": "06-01-02-03-04", - "candidacy": { - "id": "c2", - "organism": { - "id": "o1", - "label": "Accompagnateur 1", - "address": "1 rue de l'exemple", - "zip": "75000", - "city": "Paris", - "contactAdministrativeEmail": "contact@example.com" - }, - "createdAt": 1664376421912, - "certification": { - "id": "c1", - "label": "Titre 1", - "summary": "résumé 1", - "codeRncp": "34691", - "status": "AVAILABLE" - }, + "candidate_getCandidateWithCandidacy": { + "firstname": "John", + "lastname": "Doe", + "email": "email@example.com", + "phone": "06-01-02-03-04", + "candidacy": { + "id": "c2", + "organism": { + "id": "o1", + "label": "Accompagnateur 1", + "address": "1 rue de l'exemple", + "zip": "75000", + "city": "Paris", + "contactAdministrativeEmail": "contact@example.com" + }, + "createdAt": 1664376421912, + "certification": { + "id": "c1", + "label": "Titre 1", + "summary": "résumé 1", + "codeRncp": "34691", + "status": "AVAILABLE" + }, - "experiences": [ - { - "id": "e1", - "title": "Experience 1", - "startedAt": 1580428800000, - "duration": "unknown", - "description": "description 1" - } - ], - "goals": [ - { - "id": "goal1" - } - ], - "candidacyStatuses": [ - { - "status": "PROJET", - "isActive": false - }, - { - "status": "VALIDATION", - "isActive": true - } - ], - "appointmentCount": 0, - "certificateSkills": "Blocs de compétences métier", - "otherTraining": null, - "individualHourCount": null, - "collectiveHourCount": null, - "additionalHourCount": null, - "basicSkills": [], - "mandatoryTrainings": [] - } + "experiences": [ + { + "id": "e1", + "title": "Experience 1", + "startedAt": 1580428800000, + "duration": "unknown", + "description": "description 1" + } + ], + "goals": [ + { + "id": "goal1" + } + ], + "candidacyStatuses": [ + { + "status": "PROJET", + "isActive": false + }, + { + "status": "VALIDATION", + "isActive": true + } + ], + "appointmentCount": 0, + "certificateSkills": "Blocs de compétences métier", + "otherTraining": null, + "individualHourCount": null, + "collectiveHourCount": null, + "additionalHourCount": null, + "basicSkills": [], + "mandatoryTrainings": [] } } } diff --git a/packages/reva-candidate/cypress/fixtures/candidate2-taken-over.json b/packages/reva-candidate/cypress/fixtures/candidate2-taken-over.json index 4cf7c8e63..f089786bf 100644 --- a/packages/reva-candidate/cypress/fixtures/candidate2-taken-over.json +++ b/packages/reva-candidate/cypress/fixtures/candidate2-taken-over.json @@ -1,72 +1,65 @@ { "data": { - "candidateLogged": { - "tokens": { - "accessToken": "abc", - "refreshToken": "def", - "idToken": "ghi" - }, - "candidate": { - "firstname": "John", - "lastname": "Doe", - "email": "email@example.com", - "phone": "06-01-02-03-04", - "candidacy": { - "id": "c2", - "organism": { - "id": "o1", - "label": "Accompagnateur 1", - "address": "1 rue de l'exemple", - "zip": "75000", - "city": "Paris", - "contactAdministrativeEmail": "contact@example.com" + "candidate_getCandidateWithCandidacy": { + "firstname": "John", + "lastname": "Doe", + "email": "email@example.com", + "phone": "06-01-02-03-04", + "candidacy": { + "id": "c2", + "organism": { + "id": "o1", + "label": "Accompagnateur 1", + "address": "1 rue de l'exemple", + "zip": "75000", + "city": "Paris", + "contactAdministrativeEmail": "contact@example.com" + }, + "createdAt": 1664376421912, + "certification": { + "id": "c1", + "label": "Titre 1", + "summary": "résumé 1", + "codeRncp": "34691", + "status": "AVAILABLE" + }, + + "experiences": [ + { + "id": "e1", + "title": "Experience 1", + "startedAt": 1580428800000, + "duration": "unknown", + "description": "description 1" + } + ], + "goals": [ + { + "id": "goal1" + } + ], + "candidacyStatuses": [ + { + "status": "PROJET", + "isActive": false }, - "createdAt": 1664376421912, - "certification": { - "id": "c1", - "label": "Titre 1", - "summary": "résumé 1", - "codeRncp": "34691", - "status": "AVAILABLE" + { + "status": "VALIDATION", + "isActive": false }, - - "experiences": [ - { - "id": "e1", - "title": "Experience 1", - "startedAt": 1580428800000, - "duration": "unknown", - "description": "description 1" - } - ], - "goals": [ - { - "id": "goal1" - } - ], - "candidacyStatuses": [ - { - "status": "PROJET", - "isActive": false - }, - { - "status": "VALIDATION", - "isActive": false - }, - { - "status": "PRISE_EN_CHARGE", - "isActive": true - } - ], - "appointmentCount": 0, - "certificateSkills": "Blocs de compétences métier", - "otherTraining": null, - "individualHourCount": null, - "collectiveHourCount": null, - "additionalHourCount": null, - "basicSkills": [], - "mandatoryTrainings": [] - } + { + "status": "PRISE_EN_CHARGE", + "isActive": true + } + ], + "appointmentCount": 0, + "certificateSkills": "Blocs de compétences métier", + "otherTraining": null, + "individualHourCount": null, + "collectiveHourCount": null, + "additionalHourCount": null, + "basicSkills": [], + "mandatoryTrainings": [] } } }