update: background user token persistance

This commit is contained in:
Jure Ursic 2020-07-08 14:03:44 +02:00
parent 2da9de5414
commit ff41638e2b
9 changed files with 15 additions and 4 deletions

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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());

View File

@ -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', () => {