refactor: refs #7939 streamline logout tests and improve session expiration error handling
gitea/salix-front/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-04-25 13:28:32 +02:00
parent 8dd67efeb9
commit 3ceabd5831
1 changed files with 20 additions and 25 deletions

View File

@ -5,14 +5,13 @@ describe('Logout', () => {
cy.visit(`/#/dashboard`);
cy.waitForElement('.q-page', 6000);
});
describe('by user', () => {
it('should logout', () => {
cy.get('#user').click();
cy.get('#logout').click();
});
});
describe('not user', () => {
beforeEach(() => {
it('should throw session expired error if token has expired or is not valid during navigation', () => {
cy.intercept('GET', '**StarredModules**', {
statusCode: 401,
body: {
@ -25,13 +24,9 @@ describe('Logout', () => {
},
statusMessage: 'AUTHORIZATION_REQUIRED',
}).as('badRequest');
});
it('when token not exists', () => {
cy.get('.q-list').should('be.visible').first().should('be.visible').click();
cy.wait('@badRequest');
cy.checkNotification('Authorization Required');
});
cy.checkNotification('Your session has expired. Please log in again');
});
});