From f4cf55f5410008ab87ffcaa54fd4e650a9926bb5 Mon Sep 17 00:00:00 2001 From: Alexandre Garbe Date: Wed, 11 Sep 2024 13:06:33 +0200 Subject: [PATCH] chore(candidate): fixed candidacy project status cypress tests --- .../{project.cy.js.disabled => project.cy.js} | 15 +-- .../cypress/fixtures/candidate2.json | 109 ++++++++---------- 2 files changed, 57 insertions(+), 67 deletions(-) rename packages/reva-candidate/cypress/e2e/{project.cy.js.disabled => project.cy.js} (67%) diff --git a/packages/reva-candidate/cypress/e2e/project.cy.js.disabled b/packages/reva-candidate/cypress/e2e/project.cy.js similarity index 67% rename from packages/reva-candidate/cypress/e2e/project.cy.js.disabled rename to packages/reva-candidate/cypress/e2e/project.cy.js index 59f48eda6..d17432d0c 100644 --- a/packages/reva-candidate/cypress/e2e/project.cy.js.disabled +++ b/packages/reva-candidate/cypress/e2e/project.cy.js @@ -3,14 +3,13 @@ import { stubMutation, stubQuery } from "../utils/graphql"; context("Project", () => { it("attempt to validate project", function () { cy.intercept("POST", "/api/graphql", (req) => { - stubQuery(req, "getDepartments", "departments.json"); - stubMutation(req, "candidate_login", "candidate1.json"); - stubQuery(req, "getReferential", "referential.json"); + stubMutation(req, "candidate_login", "candidate_login.json"); + stubQuery(req, "candidate_getCandidateWithCandidacy", "candidate1.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-home-validate"]').should("be.disabled"); @@ -18,16 +17,14 @@ context("Project", () => { it("confirm registration", function () { cy.intercept("POST", "/api/graphql", (req) => { - stubQuery(req, "getDepartments", "departments.json"); - stubMutation(req, "candidate_login", "candidate2.json"); - stubQuery(req, "getReferential", "referential.json"); + stubMutation(req, "candidate_login", "candidate_login.json"); + stubQuery(req, "candidate_getCandidateWithCandidacy", "candidate2.json"); stubQuery(req, "submit_candidacy", "submitted-candidacy.json"); stubQuery(req, "activeFeaturesForConnectedUser", "features.json"); }); cy.login(); - cy.get('[data-test="project-home-loading"]'); cy.wait("@candidate_login"); - cy.wait("@getReferential"); + cy.wait("@candidate_getCandidateWithCandidacy"); cy.wait("@activeFeaturesForConnectedUser"); cy.wait(500); diff --git a/packages/reva-candidate/cypress/fixtures/candidate2.json b/packages/reva-candidate/cypress/fixtures/candidate2.json index 6f6df642b..420157fe9 100644 --- a/packages/reva-candidate/cypress/fixtures/candidate2.json +++ b/packages/reva-candidate/cypress/fixtures/candidate2.json @@ -1,63 +1,56 @@ { "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" - }, - "experiences": [ - { - "id": "e1", - "title": "Experience 1", - "startedAt": 1580428800000, - "duration": "unknown", - "description": "description 1" - } - ], - "goals": [ - { - "id": "goal1" - } - ], - "candidacyStatuses": [ - { - "status": "PROJET", - "isActive": true - } - ], - "appointmentCount": 0, - "certificateSkills": null, - "otherTraining": null, - "individualHourCount": null, - "collectiveHourCount": null, - "additionalHourCount": null, - "basicSkills": [], - "mandatoryTrainings": [] - } + "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": true + } + ], + "appointmentCount": 0, + "certificateSkills": null, + "otherTraining": null, + "individualHourCount": null, + "collectiveHourCount": null, + "additionalHourCount": null, + "basicSkills": [], + "mandatoryTrainings": [] } } }