From ed097d7091f465e44755ed4518a70b836f932582 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 21 Feb 2025 17:38:08 +0100 Subject: [PATCH] feat: refs #8581 add tests for creating and filtering invoices in InvoiceInList --- .../invoiceIn/invoiceInList.spec.js | 47 +++++++++++++++++-- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js index 4e2b8f9cc..d9972f0f1 100644 --- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js @@ -1,9 +1,17 @@ /// + describe('InvoiceInList', () => { const firstRow = 'tbody.q-virtual-scroll__content tr:nth-child(1)'; const firstId = `${firstRow} > td:nth-child(2) span`; const firstDetailBtn = `${firstRow} .q-btn:nth-child(1)`; const summaryHeaders = '.summaryBody .header-link'; + const mockInvoiceRef = `createMockInvoice${Math.floor(Math.random() * 100)}`; + const mock = { + vnSupplierSelect: { val: 'farmer king', type: 'select' }, + 'Invoice nÂș_input': mockInvoiceRef, + Company_select: { val: 'orn', type: 'select' }, + 'Expedition date_inputDate': '16-11-2001', + }; beforeEach(() => { cy.viewport(1920, 1080); @@ -12,7 +20,7 @@ describe('InvoiceInList', () => { cy.get('#searchbar input').should('be.visible').type('{enter}'); }); - it('should redirect on clicking a invoice', () => { + it.skip('should redirect on clicking a invoice', () => { cy.get(firstId) .invoke('text') .then((content) => { @@ -21,10 +29,43 @@ describe('InvoiceInList', () => { cy.url().should('include', `/invoice-in/${id}/summary`); }); }); - // https://redmine.verdnatura.es/issues/8420 - it('should open the details', () => { + + it.skip('should open the details', () => { cy.get(firstDetailBtn).click(); cy.get(summaryHeaders).eq(1).contains('Basic data'); cy.get(summaryHeaders).eq(4).contains('Vat'); }); + + it.skip('should create a new Invoice', () => { + cy.dataCy('vnTableCreateBtn').click(); + cy.fillInForm(mock, { attr: 'data-cy' }); + cy.dataCy('FormModelPopup_save').click(); + cy.intercept('GET', /\/api\/InvoiceIns\/\d+\/getTotals$/).as('invoice'); + cy.wait('@invoice').then(() => + cy.validateDescriptor({ + title: mockInvoiceRef, + listBox: { + 0: '11/16/2001', + 3: 'The farmer', + }, + }), + ); + cy.get('[data-cy="vnLvCompany"]').should('contain.text', 'ORN'); + }); + + describe('right-panel', () => { + it('should filter by From param', () => { + cy.dataCy('From_inputDate').type('31/12/2000{enter}'); + cy.validateVnTableRows({ + cols: [ + { + name: 'issued', + type: 'date', + val: '31/12/2000', + operation: 'after', + }, + ], + }); + }); + }); });