From 78f1189cc04c3c6cadc3b77c04ffcf6b5e3bd915 Mon Sep 17 00:00:00 2001 From: PaulEntourage Date: Tue, 5 Dec 2023 16:40:24 +0100 Subject: [PATCH] correction on path permissions --- cypress/e2e/candidat.cy.js | 30 +++++++++++++++---------- src/hooks/authentication/permissions.ts | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/cypress/e2e/candidat.cy.js b/cypress/e2e/candidat.cy.js index 9bcd2cab6..59ff668cb 100644 --- a/cypress/e2e/candidat.cy.js +++ b/cypress/e2e/candidat.cy.js @@ -1,7 +1,7 @@ /* eslint-disable no-undef */ describe('Candidat', () => { beforeEach(() => { - cy.intercept('GET', '/cv/shares', { total: 184222 }).as('cvShares'); + cy.intercept('GET', '/cv/shares', { total: 184221 }).as('cvShares'); cy.intercept('GET', '/auth/current', { fixture: 'auth-current-candidat-res', @@ -78,15 +78,18 @@ describe('Candidat', () => { cy.intercept('PUT', '/user/changePwd', {}).as('changePwd'); }); it('should open backoffice public offers', () => { - cy.visit('/backoffice/candidat/offres/public', { - onBeforeLoad: function async(window) { - window.localStorage.setItem('access-token', '1234'); - window.localStorage.setItem('release-version', 'v100'); - }, + cy.fixture('auth-current-candidat-res').then((user) => { + cy.visit(`/backoffice/candidat/offres/public`, { + onBeforeLoad: function async(window) { + window.localStorage.setItem('access-token', '1234'); + window.localStorage.setItem('release-version', 'v100'); + }, + }); + cy.url().should('include', user.id); }); // check if list is complete - cy.get('[data-testid="candidat-offer-list-container"]') + cy.get('[data-testid="candidat-offer-list-container"]', { timeout: 20000 }) .find('> div') .should('have.length', 16); @@ -115,11 +118,14 @@ describe('Candidat', () => { }); it('should open backoffice private offers and add new opportunity', () => { - cy.visit('/backoffice/candidat/offres/private', { - onBeforeLoad: function async(window) { - window.localStorage.setItem('access-token', '1234'); - window.localStorage.setItem('release-version', 'v100'); - }, + cy.fixture('auth-current-candidat-res').then((user) => { + cy.visit(`/backoffice/candidat/offres/private`, { + onBeforeLoad: function async(window) { + window.localStorage.setItem('access-token', '1234'); + window.localStorage.setItem('release-version', 'v100'); + }, + }); + cy.url().should('include', user.id); }); // check if the right opportunity is open cy.fixture('user-opportunity-all-res').then((offersList) => { diff --git a/src/hooks/authentication/permissions.ts b/src/hooks/authentication/permissions.ts index 7119068ab..34a26ad63 100644 --- a/src/hooks/authentication/permissions.ts +++ b/src/hooks/authentication/permissions.ts @@ -9,6 +9,7 @@ export const authenticatedPermissions = [ paths: [ '/backoffice/candidat/cv', '/backoffice/candidat/[candidateId]/offres', + '/backoffice/candidat/offres', '/backoffice/candidat/[candidateId]/suivi', '/backoffice/candidat/[candidateId]/cv', ],