From 7e74ab58da553e24a46586a6fe86fde41bd71f85 Mon Sep 17 00:00:00 2001 From: jtubau Date: Mon, 17 Mar 2025 12:03:26 +0100 Subject: [PATCH] fix: refs #8621 intermittent test --- src/pages/Route/Cmr/CmrList.vue | 2 +- .../integration/route/cmr/cmrList.spec.js | 66 +++++-------------- test/cypress/support/commands.js | 8 +++ 3 files changed, 24 insertions(+), 52 deletions(-) diff --git a/src/pages/Route/Cmr/CmrList.vue b/src/pages/Route/Cmr/CmrList.vue index d0683e481..170f73bc0 100644 --- a/src/pages/Route/Cmr/CmrList.vue +++ b/src/pages/Route/Cmr/CmrList.vue @@ -28,7 +28,6 @@ const userParams = { shipped: null, }; - const columns = computed(() => [ { align: 'left', @@ -175,6 +174,7 @@ function downloadPdfs() { :data-key url="Cmrs/filter" :columns="columns" + :order="['shipped DESC', 'cmrFk ASC']" :user-params="userParams" default-mode="table" v-model:selected="selectedRows" diff --git a/test/cypress/integration/route/cmr/cmrList.spec.js b/test/cypress/integration/route/cmr/cmrList.spec.js index 8d9299ce7..b3561708d 100644 --- a/test/cypress/integration/route/cmr/cmrList.spec.js +++ b/test/cypress/integration/route/cmr/cmrList.spec.js @@ -19,7 +19,7 @@ describe('Cmr list', () => { }; const data = { - ticket: '2', + ticket: '1', client: 'Bruce Wayne', }; @@ -52,76 +52,40 @@ describe('Cmr list', () => { describe('Ticket pop-ups', () => { it('Should redirect to the ticket summary from the ticket descriptor pop-up', () => { cy.get(selectors.ticket).click(); - cy.get(selectors.descriptorId) - .invoke('text') - .then((text) => { - expect(text).to.include(data.ticket); - }); + cy.containContent(selectors.descriptorId, data.ticket); cy.get(selectors.descriptorGoToSummaryBtn).click(); - cy.get(selectors.summaryTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.url().should('include', '/ticket/1/summary'); + cy.containContent(selectors.summaryTitle, data.client); }); it('Should redirect to the ticket summary from summary pop-up from the ticket descriptor pop-up', () => { cy.get(selectors.ticket).click(); - cy.get(selectors.descriptorId) - .invoke('text') - .then((text) => { - expect(text).to.include(data.ticket); - }); + cy.containContent(selectors.descriptorId, data.ticket); cy.get(selectors.descriptorOpenSummaryBtn).click(); - cy.get(selectors.summaryTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.containContent(selectors.summaryTitle, data.client); cy.get(selectors.summaryGoToSummaryBtn).click(); - cy.get(selectors.summaryTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.url().should('include', '/ticket/1/summary'); + cy.containContent(selectors.summaryTitle, data.client); }); }); describe('Client pop-ups', () => { it('Should redirect to the client summary from the client descriptor pop-up', () => { cy.get(selectors.client).click(); - cy.get(selectors.descriptorTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.containContent(selectors.descriptorTitle, data.client); cy.get(selectors.descriptorGoToSummaryBtn).click(); - cy.get(selectors.summaryTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.url().should('include', '/customer/1101/summary'); + cy.containContent(selectors.summaryTitle, data.client); }); it('Should redirect to the client summary from summary pop-up from the client descriptor pop-up', () => { cy.get(selectors.client).click(); - cy.get(selectors.descriptorTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.containContent(selectors.descriptorTitle, data.client); cy.get(selectors.descriptorOpenSummaryBtn).click(); - cy.get(selectors.summaryTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.containContent(selectors.summaryTitle, data.client); cy.get(selectors.summaryGoToSummaryBtn).click(); - cy.get(selectors.summaryTitle) - .invoke('text') - .then((text) => { - expect(text).to.include(data.client); - }); + cy.url().should('include', '/customer/1101/summary'); + cy.containContent(selectors.summaryTitle, data.client); }); }); }); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 105d021ad..7d9f76349 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -322,6 +322,14 @@ Cypress.Commands.add('validateContent', (selector, expectedValue) => { cy.get(selector).should('have.text', expectedValue); }); +Cypress.Commands.add('containContent', (selector, expectedValue) => { + cy.get(selector) + .invoke('text') + .then((text) => { + expect(text).to.include(expectedValue); + }); +}); + Cypress.Commands.add('openActionDescriptor', (opt) => { cy.openActionsDescriptor(); const listItem = '[role="menu"] .q-list .q-item';