From 7899f7903fe222e0e990b376397747a24d3b6629 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 14 Mar 2025 12:41:26 +0100 Subject: [PATCH 1/3] test: fix intermitent e2e --- test/cypress/integration/outLogin/logout.spec.js | 11 ++++++++++- test/cypress/support/index.js | 5 +++++ 2 files changed, 15 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); }); }); }); diff --git a/test/cypress/support/index.js b/test/cypress/support/index.js index 87e869b6d..b0f0fb3b1 100644 --- a/test/cypress/support/index.js +++ b/test/cypress/support/index.js @@ -40,6 +40,11 @@ style.innerHTML = ` `; document.head.appendChild(style); +// FIXME: https://redmine.verdnatura.es/issues/8771 +Cypress.on('uncaught:exception', (err) => { + if (err.code === 'ERR_CANCELED') return false; +}); + const waitForApiReady = (url, maxRetries = 20, delay = 1000) => { let retries = 0; From 9cfd70f252ed1728d90b9c43bfa76ab8604c42e9 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 14 Mar 2025 13:11:22 +0100 Subject: [PATCH 2/3] docs: update README with e2e parallel run instructions and report viewing --- README.md | 12 ++++++++++++ package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 262e12e58..d280e29ce 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,18 @@ pnpm run test:front pnpm run test:e2e ``` +### Run e2e parallel + +```bash +pnpm run test:e2e:parallel +``` + +### View e2e parallel report + +```bash +pnpm run test:e2e:summary +``` + ### Build the app for production ```bash diff --git a/package.json b/package.json index d315b6f29..076cbbb14 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "format": "prettier --write \"**/*.{js,vue,scss,html,md,json}\" --ignore-path .gitignore", "test:e2e": "cypress open", "test:e2e:ci": "npm run resetDatabase && cd ../salix-front && cypress run", - "test:e2e:parallel": "bash ./test/cypress/cypressParallel.sh", + "test:e2e:parallel": "bash ./test/cypress/run.sh", "test:e2e:summary": "bash ./test/cypress/summary.sh", "test": "echo \"See package.json => scripts for available tests.\" && exit 0", "test:front": "vitest", From 3a590d563925d28c654a7b7cbb76192bd99d0272 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 14 Mar 2025 13:24:06 +0100 Subject: [PATCH 3/3] test: update assertion to use contain.text for price validation --- test/cypress/integration/ticket/ticketSale.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/cypress/integration/ticket/ticketSale.spec.js b/test/cypress/integration/ticket/ticketSale.spec.js index 514c50281..6d84f214c 100644 --- a/test/cypress/integration/ticket/ticketSale.spec.js +++ b/test/cypress/integration/ticket/ticketSale.spec.js @@ -23,7 +23,7 @@ describe('TicketSale', () => { cy.get('[data-col-field="price"]') .find('.q-btn > .q-btn__content') - .should('have.text', `€${price}`); + .should('contain.text', `€${price}`); }); it('update discount', () => { const discount = Math.floor(Math.random() * 100) + 1;