From 2c4ee50f46510b5e29c38298c569fc108c760f2e Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 14 Mar 2025 11:16:54 +0100 Subject: [PATCH] test: refs #6695 handle uncaught exceptions in logout.spec.js for better error management --- test/cypress/integration/outLogin/logout.spec.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/cypress/integration/outLogin/logout.spec.js b/test/cypress/integration/outLogin/logout.spec.js index 373f0cc93..b3583e4d3 100644 --- a/test/cypress/integration/outLogin/logout.spec.js +++ b/test/cypress/integration/outLogin/logout.spec.js @@ -24,12 +24,21 @@ describe('Logout', () => { }, }, statusMessage: 'AUTHORIZATION_REQUIRED', - }); + }).as('badRequest'); }); it('when token not exists', () => { + const exceptionHandler = (err) => { + if (err.code === 'AUTHORIZATION_REQUIRED') return; + }; + Cypress.on('uncaught:exception', exceptionHandler); + cy.get('.q-list').first().should('be.visible').click(); + cy.wait('@badRequest'); + cy.checkNotification('Authorization Required'); + + Cypress.off('uncaught:exception', exceptionHandler); }); }); });