diff --git a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue index 6244d94c4..9b2266b4b 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue @@ -27,6 +27,7 @@ const columns = computed(() => [ 'data-cy': 'intrastat-code', sortBy: 'id', fields: ['id', 'description'], + filterOptions: ['id', 'description'] }, format: (row, dashIfEmpty) => dashIfEmpty(getCode(row)), create: true, diff --git a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js index 6a1c18785..97235b729 100644 --- a/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInIntrastat.spec.js @@ -1,36 +1,38 @@ /// describe('InvoiceInIntrastat', () => { - const firstRow = 'tbody > :nth-child(1)'; - const thirdRow = 'tbody > :nth-child(3)'; - const codes = `[data-cy="intrastat-code"]`; - const firstRowAmount = `${firstRow} > :nth-child(3)`; - + const firstInstrastat = 'td[data-col-field="intrastatFk"][data-row-index="0"]'; + const firstAmount = 'td[data-col-field="amount"][data-row-index="0"]'; + const intrastat = 'Plantas vivas: Esqueje/injerto, Vid'; + beforeEach(() => { cy.login('administrative'); cy.visit(`/#/invoice-in/1/intrastat`); }); it('should edit the first line', () => { - cy.selectOption(`${firstRow} ${codes}`, 'Plantas vivas: Esqueje/injerto, Vid'); - cy.get(firstRowAmount).clear(); + cy.get(firstInstrastat).click().type(`{selectall}{backspace}${intrastat}{enter}`); + cy.get(firstAmount).click().type('10{selectall}{backspace}20{enter}'); cy.saveCard(); - cy.get(codes) - .eq(0) - .should('have.value', '6021010: Plantas vivas: Esqueje/injerto, Vid'); + cy.get(firstInstrastat).should('have.text', `6021010: ${intrastat}`); }); it('should add a new row', () => { - cy.addRow(); - cy.fillRow(thirdRow, [ - false, - 'Plantas vivas: Esqueje/injerto, Vid', - 30, - 10, - 5, - 'FR', - ]); - cy.saveCard(); - cy.get('.q-notification__message').should('have.text', 'Data saved'); + cy.dataCy('vnTableCreateBtn').click(); + cy.fillInForm( + { + 'intrastat-code': { + val: 'Plantas vivas: Esqueje/injerto, Vid', + type: 'select', + }, + Amount_input: '30', + Net_input: '10', + Stems_input: '5', + Country_select: { val: 'FR', type: 'select' }, + }, + { attr: 'data-cy' }, + ); + cy.dataCy('FormModelPopup_save').click(); + cy.get('.q-notification__message').should('have.text', 'Data created'); }); it('should remove the first line', () => {