diff --git a/cypress/integration/create-channel.spec.js b/cypress/integration/create-channel.spec.js index 8a89d97d127f6eb5fab68cc3b00865d736f76ec8..ba1eaaf4e238ae4706f1d9d9ee17f24f75f79c2c 100644 --- a/cypress/integration/create-channel.spec.js +++ b/cypress/integration/create-channel.spec.js @@ -12,6 +12,7 @@ context('Create Channel Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Channel Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/create-job-offer.spec.js b/cypress/integration/create-job-offer.spec.js index f9681546e7960e62de2ea77615fb7e4b0cc2031a..1c5b225c179c67faebe37d831d586e36662a55cd 100644 --- a/cypress/integration/create-job-offer.spec.js +++ b/cypress/integration/create-job-offer.spec.js @@ -16,6 +16,7 @@ context('Create Job Offer Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Job Offer Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/create-project.spec.js b/cypress/integration/create-project.spec.js index 65af225f3a6badccc506ba78090bd8fce40dd445..77652c614d9c22eccd77373459afb5795a03ecc8 100644 --- a/cypress/integration/create-project.spec.js +++ b/cypress/integration/create-project.spec.js @@ -14,6 +14,7 @@ context('Create Project Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Project Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/create-user.spec.js b/cypress/integration/create-user.spec.js index b6dc3221346579d359e0b5c8a40e693e70eb32a4..f2d94169a658f819c8deb8ef6f68e40fa8c12feb 100644 --- a/cypress/integration/create-user.spec.js +++ b/cypress/integration/create-user.spec.js @@ -16,6 +16,7 @@ context('Create User Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('User Creation process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-channel.spec.js b/cypress/integration/edit-channel.spec.js index 32a702a9044095a51fbf15675f19033bc65ff050..03f3fc5d45e607619d483803b7dc2238a4f97949 100644 --- a/cypress/integration/edit-channel.spec.js +++ b/cypress/integration/edit-channel.spec.js @@ -17,6 +17,7 @@ context('Edit Channel Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Channel Edition process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-job-offer.spec.js b/cypress/integration/edit-job-offer.spec.js index 10a7b27026bb7a1971f6c3b53b53d7bb50521d7f..649a469baf86314a4663ec73fbca6353b3a4cdd8 100644 --- a/cypress/integration/edit-job-offer.spec.js +++ b/cypress/integration/edit-job-offer.spec.js @@ -20,6 +20,7 @@ context('Edit Job Offer Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Job Offer Edition process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/edit-project.spec.js b/cypress/integration/edit-project.spec.js index e7a532d7195c7e1817747036f0644328b9ffdedf..31482bbfc35d2291053fe11a1fd0234cb7234300 100644 --- a/cypress/integration/edit-project.spec.js +++ b/cypress/integration/edit-project.spec.js @@ -19,6 +19,7 @@ context('Edit Project Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screen', () => cy.userLogin()); describe('Project Edition process', () => { it('should login', () => cy.login()); diff --git a/cypress/integration/retire-project.spec.js b/cypress/integration/retire-project.spec.js index 36daa5d5a4459b8e30b2b0510ffe0913a1af28dc..102f0a5d300e0d4339bf69fee909b599f8875616 100644 --- a/cypress/integration/retire-project.spec.js +++ b/cypress/integration/retire-project.spec.js @@ -11,6 +11,7 @@ context('Retire Project Browser Testing', () => { cy.clearLocalStorage({ domain: null }); cy.clearCookies({ domain: null }); }); + beforeEach(() => cy.setToken()); it('should visit user login screend', () => cy.userLogin()); describe('Project Retirement process', () => { it('should login', () => cy.login()); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 1450915cadf39d12464f639b48d4a979ffbfa83d..6700e645bf818e24cb3308a9d1b73265c225cfff 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -36,19 +36,22 @@ Cypress.Commands.add('login', () => { cy.get('.accept-button').click(); cy.location().should((loc) => { expect(loc.pathname).to.eq('/'); + cy.wrap(Cypress.localStorage.getItem('solid-auth-client')).as('currentUser'); }); }); }); +Cypress.Commands.add('setToken', () => { + if ( this.currentUser ) { + Cypress.localStorage.setItem('solid-auth-client', this.currentUser); + } +}); + Cypress.Commands.add('naviagte', route => { cy.visit(route); cy.location().should((loc) => { expect(loc.pathname).to.eq(route); }); - // Workaround - seems to be a bug when accessing the route directly - cy.get('.accept-button').click(); - cy.wait(2000); - // End workaround }); Cypress.Commands.add('userLogin', () => {