update: loccalStorage persistance using externallibrary

This commit is contained in:
Jure Ursic
2020-07-08 15:41:05 +02:00
parent ff41638e2b
commit 9a6ea85bbb
13 changed files with 39 additions and 42 deletions

View File

@ -26,6 +26,8 @@
/* globals Cypress, cy, expect */
import 'cypress-localstorage-commands';
Cypress.Commands.add('login', () => {
cy.fixture('admin.json').then(admin => {
cy.get('#id_username').type(admin.username);
@ -33,20 +35,14 @@ Cypress.Commands.add('login', () => {
cy.get('#id_password').type(admin.password);
cy.get('#id_password').should('have.value', admin.password);
cy.get('.connection-btn').click();
cy.location('pathname').should('include', '/authorize');
cy.get('.accept-button').click();
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/');
cy.wrap(Cypress.localStorage.getItem('solid-auth-client')).as('currentUser');
cy.location().should(location => {
expect(location.pathname).to.eq('/');
});
});
});
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) => {