Skip to content
Snippets Groups Projects
Commit ff41638e authored by Jure's avatar Jure
Browse files

update: background user token persistance

parent 2da9de54
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ context('Create Channel Browser Testing', () => { ...@@ -12,6 +12,7 @@ context('Create Channel Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Channel Creation process', () => { describe('Channel Creation process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -16,6 +16,7 @@ context('Create Job Offer Browser Testing', () => { ...@@ -16,6 +16,7 @@ context('Create Job Offer Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Job Offer Creation process', () => { describe('Job Offer Creation process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -14,6 +14,7 @@ context('Create Project Browser Testing', () => { ...@@ -14,6 +14,7 @@ context('Create Project Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Project Creation process', () => { describe('Project Creation process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -16,6 +16,7 @@ context('Create User Browser Testing', () => { ...@@ -16,6 +16,7 @@ context('Create User Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('User Creation process', () => { describe('User Creation process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -17,6 +17,7 @@ context('Edit Channel Browser Testing', () => { ...@@ -17,6 +17,7 @@ context('Edit Channel Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Channel Edition process', () => { describe('Channel Edition process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -20,6 +20,7 @@ context('Edit Job Offer Browser Testing', () => { ...@@ -20,6 +20,7 @@ context('Edit Job Offer Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Job Offer Edition process', () => { describe('Job Offer Edition process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -19,6 +19,7 @@ context('Edit Project Browser Testing', () => { ...@@ -19,6 +19,7 @@ context('Edit Project Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screen', () => cy.userLogin()); it('should visit user login screen', () => cy.userLogin());
describe('Project Edition process', () => { describe('Project Edition process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -11,6 +11,7 @@ context('Retire Project Browser Testing', () => { ...@@ -11,6 +11,7 @@ context('Retire Project Browser Testing', () => {
cy.clearLocalStorage({ domain: null }); cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null }); cy.clearCookies({ domain: null });
}); });
beforeEach(() => cy.setToken());
it('should visit user login screend', () => cy.userLogin()); it('should visit user login screend', () => cy.userLogin());
describe('Project Retirement process', () => { describe('Project Retirement process', () => {
it('should login', () => cy.login()); it('should login', () => cy.login());
......
...@@ -36,19 +36,22 @@ Cypress.Commands.add('login', () => { ...@@ -36,19 +36,22 @@ Cypress.Commands.add('login', () => {
cy.get('.accept-button').click(); cy.get('.accept-button').click();
cy.location().should((loc) => { cy.location().should((loc) => {
expect(loc.pathname).to.eq('/'); 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 => { Cypress.Commands.add('naviagte', route => {
cy.visit(route); cy.visit(route);
cy.location().should((loc) => { cy.location().should((loc) => {
expect(loc.pathname).to.eq(route); 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', () => { Cypress.Commands.add('userLogin', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment