From 08e68e47b83e694b936d4ef3d7db998d6779184d Mon Sep 17 00:00:00 2001 From: jtubau Date: Thu, 6 Mar 2025 13:06:50 +0100 Subject: [PATCH] test: refs #8441 add e2e tests for vehicleInvoiceIn --- .../route/vehicle/vehicleInvoiceIn.spec.js | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 test/cypress/integration/route/vehicle/vehicleInvoiceIn.spec.js diff --git a/test/cypress/integration/route/vehicle/vehicleInvoiceIn.spec.js b/test/cypress/integration/route/vehicle/vehicleInvoiceIn.spec.js new file mode 100644 index 000000000..19fa9d581 --- /dev/null +++ b/test/cypress/integration/route/vehicle/vehicleInvoiceIn.spec.js @@ -0,0 +1,87 @@ +describe('Vehicle Invoice In', () => { + const selectors = { + firstRowSupplier: 'tr:first-child > .expand > .no-padding > .link', + firstRowInvoice: + ':nth-child(1) > [data-col-field="supplierRef"] > .no-padding > .link', + descriptorTitle: + '.q-menu > .descriptor > .body > .q-list > .q-item__label--header > .title > span', + descriptorPopupGoToSummaryBtn: + '.header > :nth-child(2) > .q-btn__content > .q-icon', + summaryTitle: '.summaryHeader > :nth-child(2)', + summaryPopUpGoToSummaryBtn: '.header > .q-icon', + unassignBtn: 'tableAction-0', + }; + + const supplier = 'PLANTS SL'; + const invoice = '1234'; + + beforeEach(() => { + cy.viewport(1920, 1080); + cy.login('deliveryAssistant'); + cy.visit(`/#/route/vehicle/1/invoice-in`); + }); + + it('Should show assigned tickets', () => { + cy.get('.q-table') + .children() + .should('be.visible') + .should('have.length.greaterThan', 0); + }); + + it('Should assign a new invoice', () => { + const data = { + 'Invoice nº': { val: '5', type: 'select' }, + 'Nº Plate': { val: '3333-BAT', type: 'select' }, + }; + cy.addBtnClick(); + cy.fillInForm(data); + cy.dataCy('FormModelPopup_save').click(); + cy.checkNotification('Data created'); + }); + + it('Should unassign an invoice', () => { + cy.dataCy(selectors.unassignBtn).last().click(); + cy.clickConfirm(); + cy.checkNotification('Data saved'); + }); + + describe('Supplier pop-ups', () => { + it('Should redirect to the supplier summary from the supplier descriptor pop-up', () => { + cy.get(selectors.firstRowSupplier).click(); + cy.get(selectors.descriptorTitle).should('contain', supplier); + cy.get( + '[href="#/supplier/1/summary"] > .q-btn > .q-btn__content > .q-icon', + ).click(); + cy.get(selectors.summaryTitle).should('contain', supplier); + }); + + it('Should redirect to the supplier summary from summary pop-up from the supplier descriptor pop-up', () => { + cy.get(selectors.firstRowSupplier).click(); + cy.get(selectors.descriptorTitle).should('contain', supplier); + cy.get(selectors.descriptorPopupGoToSummaryBtn).click(); + cy.get(selectors.summaryTitle).should('contain', supplier); + cy.get(selectors.summaryPopUpGoToSummaryBtn).click(); + cy.get(selectors.summaryTitle).should('contain', supplier); + }); + }); + + describe('Invoice pop-ups', () => { + it('Should redirect to the invoiceIn summary from the invoice descriptor pop-up', () => { + cy.get(selectors.firstRowInvoice).click(); + cy.get(selectors.descriptorTitle).should('have.text', invoice); + cy.get( + '[href="#/invoice-in/1/summary"] > .q-btn > .q-btn__content > .q-icon', + ).click(); + cy.get(selectors.summaryTitle).should('contain', supplier); + }); + + it('Should redirect to the invoiceIn summary from summary pop-up from the invoice descriptor pop-up', () => { + cy.get(selectors.firstRowInvoice).click(); + cy.get(selectors.descriptorTitle).should('have.text', invoice); + cy.get(selectors.descriptorPopupGoToSummaryBtn).click(); + cy.get(selectors.summaryTitle).should('contain', supplier); + cy.get(selectors.summaryPopUpGoToSummaryBtn).click(); + cy.get(selectors.summaryTitle).should('contain', supplier); + }); + }); +});