From 65a7ca1848f31bbb9ac003e7ccbfe9a439cfde38 Mon Sep 17 00:00:00 2001 From: jorgep Date: Thu, 6 Mar 2025 16:01:17 +0100 Subject: [PATCH] fix: refs #8581 update test case to remove 'only' and enhance item selection logic --- test/cypress/integration/invoiceIn/invoiceInVat.spec.js | 2 +- test/cypress/support/commands.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/cypress/integration/invoiceIn/invoiceInVat.spec.js b/test/cypress/integration/invoiceIn/invoiceInVat.spec.js index 5d3b09877..e9412244f 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.only('should add a new row', () => { + it('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 f3cef5b70..e3b6d7aaa 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -119,9 +119,10 @@ function selectItem(selector, option, ariaControl, hasWrite = true) { if (!hasWrite) cy.wait(100); getItems(ariaControl).then((items) => { - const matchingItem = items - .toArray() - .find((item) => item.innerText.toLowerCase().includes(option?.toLowerCase())); + const matchingItem = items.toArray().find((item) => { + const val = typeof option == 'string' ? option.toLowerCase() : option; + return item.innerText.toLowerCase().includes(val); + }); if (matchingItem) return cy.wrap(matchingItem).click(); if (hasWrite) cy.get(selector).clear().type(option);