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

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