From 886c811b7986527af18e16d995443c7f6358c4b8 Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 27 Dec 2024 09:49:54 +0100 Subject: [PATCH] refactor: refs #8219 use checkNotification command --- test/cypress/integration/invoiceOut/invoiceOutList.spec.js | 5 ++--- .../integration/invoiceOut/invoiceOutMakeInvoice.spec.js | 4 +--- test/cypress/integration/worker/workerCreate.spec.js | 7 +++---- test/cypress/integration/zone/zoneBasicData.spec.js | 5 ++--- test/cypress/integration/zone/zoneCreate.spec.js | 6 ++---- 5 files changed, 10 insertions(+), 17 deletions(-) diff --git a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js index 7de481e66..d4e5df684 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutList.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutList.spec.js @@ -1,6 +1,5 @@ /// describe('InvoiceOut list', () => { - const notification = '.q-notification__message'; const invoice = { Ticket: { val: '8' }, Serial: { val: 'EspaƱola rapida', type: 'select' }, @@ -35,13 +34,13 @@ describe('InvoiceOut list', () => { cy.dataCy('vnTableCreateBtn').click(); cy.fillInForm(invoiceError); cy.dataCy('FormModelPopup_save').click(); - cy.get(notification).should('contains.text', 'This ticket is already invoiced'); + cy.checkNotification('This ticket is already invoiced'); }); it('should create a manual invoice and enter to its summary', () => { cy.dataCy('vnTableCreateBtn').click(); cy.fillInForm(invoice); cy.dataCy('FormModelPopup_save').click(); - cy.get(notification).should('contains.text', 'Data created'); + cy.checkNotification('Data created'); }); }); diff --git a/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js b/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js index 1a170bef0..145f492a1 100644 --- a/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js +++ b/test/cypress/integration/invoiceOut/invoiceOutMakeInvoice.spec.js @@ -1,7 +1,5 @@ /// describe('InvoiceOut manual invoice', () => { - const notification = '.q-notification__message'; - beforeEach(() => { cy.viewport(1920, 1080); cy.login('developer'); @@ -15,7 +13,7 @@ describe('InvoiceOut manual invoice', () => { '[data-q-vs-anchor=""] > :nth-child(1) > .q-checkbox > .q-checkbox__inner' ).click(); cy.dataCy('ticketListMakeInvoiceBtn').click(); - cy.get(notification).should('contains.text', 'Data saved'); + cy.checkNotification('Data saved'); cy.get('.q-virtual-scroll__content > :nth-child(1) > :nth-child(3)').click(); cy.get(':nth-child(8) > .value > .link').click(); cy.get('.header > :nth-child(3) > .q-btn__content').click(); diff --git a/test/cypress/integration/worker/workerCreate.spec.js b/test/cypress/integration/worker/workerCreate.spec.js index 50afe1892..7f2810395 100644 --- a/test/cypress/integration/worker/workerCreate.spec.js +++ b/test/cypress/integration/worker/workerCreate.spec.js @@ -1,6 +1,5 @@ describe('WorkerCreate', () => { const externalRadio = '.q-radio:nth-child(2)'; - const notification = '.q-notification__message'; const developerBossId = 120; const payMethodCross = '.grid-create .full-width > :nth-child(9) .q-select .q-field__append:not(.q-anchor--skip)'; @@ -41,7 +40,7 @@ describe('WorkerCreate', () => { cy.fillInForm(internal); cy.get(payMethodCross).click(); cy.get(saveBtn).click(); - cy.get(notification).should('contains.text', 'Payment method is required'); + cy.checkNotification('Payment method is required'); }); it('should create an internal', () => { @@ -50,13 +49,13 @@ describe('WorkerCreate', () => { 'Pay method': { val: 'PayMethod one', type: 'select' }, }); cy.get(saveBtn).click(); - cy.get(notification).should('contains.text', 'Data created'); + cy.checkNotification('Data created'); }); it('should create an external', () => { cy.get(externalRadio).click(); cy.fillInForm(external); cy.get(saveBtn).click(); - cy.get(notification).should('contains.text', 'Data created'); + cy.checkNotification('Data created'); }); }); diff --git a/test/cypress/integration/zone/zoneBasicData.spec.js b/test/cypress/integration/zone/zoneBasicData.spec.js index 6229039b7..95a075fb3 100644 --- a/test/cypress/integration/zone/zoneBasicData.spec.js +++ b/test/cypress/integration/zone/zoneBasicData.spec.js @@ -1,5 +1,4 @@ describe('ZoneBasicData', () => { - const notification = '.q-notification__message'; const priceBasicData = '[data-cy="Price_input"]'; beforeEach(() => { @@ -11,13 +10,13 @@ describe('ZoneBasicData', () => { it('should throw an error if the name is empty', () => { cy.get('[data-cy="zone-basic-data-name"] input').type('{selectall}{backspace}'); cy.get('.q-btn-group > .q-btn--standard').click(); - cy.get(notification).should('contains.text', "can't be blank"); + cy.checkNotification("can't be blank"); }); it('should throw an error if the price is empty', () => { cy.get(priceBasicData).clear(); cy.get('.q-btn-group > .q-btn--standard').click(); - cy.get(notification).should('contains.text', 'cannot be blank'); + cy.checkNotification('cannot be blank'); }); it("should edit the basicData's zone", () => { diff --git a/test/cypress/integration/zone/zoneCreate.spec.js b/test/cypress/integration/zone/zoneCreate.spec.js index cc5de8c6c..0f630db5d 100644 --- a/test/cypress/integration/zone/zoneCreate.spec.js +++ b/test/cypress/integration/zone/zoneCreate.spec.js @@ -1,6 +1,4 @@ describe('ZoneCreate', () => { - const notification = '.q-notification__message'; - const data = { Name: { val: 'Zone pickup D' }, Price: { val: '3' }, @@ -24,7 +22,7 @@ describe('ZoneCreate', () => { cy.get('input[aria-label="Close"]').type('10:00'); cy.get('body').click(); cy.get('.q-mt-lg > .q-btn--standard').click(); - cy.get(notification).should('contains.text', 'Agency cannot be blank'); + cy.checkNotification('Agency cannot be blank'); }); it('should create a zone', () => { @@ -35,6 +33,6 @@ describe('ZoneCreate', () => { cy.get('input[aria-label="Close"]').type('10:00'); cy.get('body').click(); cy.get('.q-mt-lg > .q-btn--standard').click(); - cy.get(notification).should('contains.text', 'Data created'); + cy.checkNotification('Data created'); }); });