update: loccalStorage persistance using externallibrary
This commit is contained in:
@ -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) => {
|
||||
|
Reference in New Issue
Block a user