From 5b81836ab24e92ea22768332ae69b43c2f5e927d Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 6 Mar 2025 15:03:32 +0100 Subject: [PATCH] fix: refs #8581 update data-cy attributes and improve test assertions in InvoiceIn components --- src/pages/InvoiceIn/Card/InvoiceInVat.vue | 3 +++ .../integration/invoiceIn/invoiceInDescriptor.spec.js | 2 +- .../integration/invoiceIn/invoiceInList.spec.js | 11 +++++++++-- .../integration/invoiceIn/invoiceInSummary.spec.js | 3 --- .../integration/invoiceIn/invoiceInVat.spec.js | 2 +- test/cypress/support/commands.js | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue index eae255120..e37cf5b7e 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue @@ -202,6 +202,9 @@ function setCursor(ref) { :option-label="col.optionLabel" :filter-options="['id', 'name']" :tooltip="t('Create a new expense')" + :acls="[ + { model: 'Expense', props: '*', accessType: 'WRITE' }, + ]" @keydown.tab.prevent=" autocompleteExpense( $event, diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js index ed42676e5..0bc70447b 100644 --- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js @@ -40,7 +40,7 @@ describe('InvoiceInDescriptor', () => { cy.visit('/#/invoice-in/6/summary'); cy.selectDescriptorOption(5); - cy.get('input[data-cy="SendEmailNotifiactionDialogInput"]').type( + cy.dataCy('SendEmailNotifiactionDialogInput_input').type( '{selectall}jorgito@gmail.mx', ); cy.clickConfirm(); diff --git a/test/cypress/integration/invoiceIn/invoiceInList.spec.js b/test/cypress/integration/invoiceIn/invoiceInList.spec.js index 7f8b45ad0..8ccccdcad 100644 --- a/test/cypress/integration/invoiceIn/invoiceInList.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInList.spec.js @@ -161,14 +161,21 @@ describe('InvoiceInList', () => { }); it('should filter by correctingFk param', () => { + let correctiveCount; + let noCorrectiveCount; + cy.dataCy('vnCheckboxRectificative').click(); cy.get('[data-cy="vnTable"] .q-virtual-scroll__content') .children() - .should('have.length', 0); + .its('length') + .then((len) => (correctiveCount = len)); cy.dataCy('vnCheckboxRectificative').click(); cy.get('[data-cy="vnTable"] .q-virtual-scroll__content') .children() - .should('have.length.gt', 0); + .its('length') + .then((len) => (noCorrectiveCount = len)); + + expect(correctiveCount).to.not.equal(noCorrectiveCount); }); }); }); diff --git a/test/cypress/integration/invoiceIn/invoiceInSummary.spec.js b/test/cypress/integration/invoiceIn/invoiceInSummary.spec.js index fea5e42b5..feccacbfb 100644 --- a/test/cypress/integration/invoiceIn/invoiceInSummary.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInSummary.spec.js @@ -12,10 +12,7 @@ describe('InvoiceInSummary', () => { }); it('should open the supplier descriptor popup', () => { - cy.intercept('GET', /InvoiceIns\/4.*/).as('getInvoice'); cy.intercept('GET', /Suppliers\/\d+/).as('getSupplier'); - cy.wait('@getInvoice'); - cy.dataCy('invoiceInSummary_supplier').then(($el) => { const description = $el.text().trim(); $el.click(); diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js index e9412244f..5d3b09877 100644 --- a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js @@ -18,7 +18,7 @@ describe('InvoiceInVat', () => { cy.get(vats).eq(0).should('have.value', '8: H.P. IVA 21% CEE'); }); - it('should add a new row', () => { + it.only('should add a new row', () => { cy.addRow(); cy.fillRow(thirdRow, [true, 2000000001, 30, 'H.P. IVA 10']); cy.saveCard(); diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index c3dd9d8ce..f3cef5b70 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -121,7 +121,7 @@ function selectItem(selector, option, ariaControl, hasWrite = true) { getItems(ariaControl).then((items) => { const matchingItem = items .toArray() - .find((item) => item.innerText.toLowerCase().includes(option.toLowerCase())); + .find((item) => item.innerText.toLowerCase().includes(option?.toLowerCase())); if (matchingItem) return cy.wrap(matchingItem).click(); if (hasWrite) cy.get(selector).clear().type(option);