forked from verdnatura/salix-front
test: unit && e2e
This commit is contained in:
parent
83fa9a15b9
commit
57b38a8746
|
@ -0,0 +1,39 @@
|
|||
/// <reference types="cypress" />
|
||||
describe('Logout', () => {
|
||||
beforeEach(() => {
|
||||
cy.login('developer');
|
||||
cy.visit(`/#/dashboard`);
|
||||
cy.waitForElement('.q-page', 6000);
|
||||
});
|
||||
describe('by user', () => {
|
||||
it('should logout', () => {
|
||||
cy.get(
|
||||
'#user > .q-btn__content > .q-avatar > .q-avatar__content > .q-img > .q-img__container > .q-img__image'
|
||||
).click();
|
||||
cy.get('.block').click();
|
||||
});
|
||||
});
|
||||
describe('not user', () => {
|
||||
beforeEach(() => {
|
||||
cy.intercept('GET', '**/VnUsers/acl', {
|
||||
statusCode: 401,
|
||||
body: {
|
||||
error: {
|
||||
statusCode: 401,
|
||||
name: 'Error',
|
||||
message: 'Authorization Required',
|
||||
code: 'AUTHORIZATION_REQUIRED',
|
||||
},
|
||||
},
|
||||
statusMessage: 'AUTHORIZATION_REQUIRED',
|
||||
}).as('someRoute');
|
||||
});
|
||||
it('when token not exists', () => {
|
||||
cy.reload();
|
||||
cy.get('.q-notification__message').should(
|
||||
'have.text',
|
||||
'Authorization Required'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -55,6 +55,7 @@ describe('session', () => {
|
|||
expect(user.value).toEqual(previousUser);
|
||||
|
||||
vi.spyOn(axios, 'post').mockResolvedValue({ data: true });
|
||||
vi.spyOn(axios, 'get').mockResolvedValue({ data: true });
|
||||
await session.destroy();
|
||||
|
||||
user = state.getUser();
|
||||
|
|
Loading…
Reference in New Issue