From f783aa43def9141956e0f60a9a8dd161d285f597 Mon Sep 17 00:00:00 2001 From: jorgep Date: Tue, 11 Mar 2025 11:15:25 +0100 Subject: [PATCH] feat: refs #8581 update InvoiceInDescriptorMenu and tests for improved dialog handling and form submission --- src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue | 2 +- .../integration/invoiceIn/invoiceInDescriptor.spec.js | 11 ++++++++--- test/cypress/support/commands.js | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue b/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue index 227741373..058f17d31 100644 --- a/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue +++ b/src/pages/InvoiceIn/Card/InvoiceInDescriptorMenu.vue @@ -247,7 +247,7 @@ onBeforeMount(async () => { {{ t('components.smartCard.downloadFile') }} - + diff --git a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js index 18320f880..44b44d271 100644 --- a/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js +++ b/test/cypress/integration/invoiceIn/invoiceInDescriptor.spec.js @@ -128,9 +128,14 @@ function createCorrective(opts = {}) { const { type, reason, class: classVal } = opts; cy.selectDescriptorOption(4); - cy.selectOption('[data-cy="invoiceInDescriptorMenu_class"]', classVal); - cy.selectOption('[data-cy="invoiceInDescriptorMenu_type"]', type); - cy.selectOption('[data-cy="invoiceInDescriptorMenu_reason"]', reason); + cy.fillInForm( + { + invoiceInDescriptorMenu_class: { val: classVal, type: 'select' }, + invoiceInDescriptorMenu_type: { val: type, type: 'select' }, + invoiceInDescriptorMenu_reason: { val: reason, type: 'select' }, + }, + { form: '[data-cy="correctiveInvoiceDialog"]', attr: 'data-cy' }, + ); cy.dataCy('saveCorrectiveInvoice').click(); cy.wait('@corrective').then(({ response }) => { diff --git a/test/cypress/support/commands.js b/test/cypress/support/commands.js index 137b61c4f..6f0798134 100755 --- a/test/cypress/support/commands.js +++ b/test/cypress/support/commands.js @@ -123,8 +123,11 @@ function selectItem(selector, option, ariaControl, hasWrite = true) { const val = typeof option == 'string' ? option.toLowerCase() : option; return item.innerText.toLowerCase().includes(val); }); - if (matchingItem) return cy.wrap(matchingItem).click(); - + if (matchingItem) { + cy.wrap(matchingItem).click(); + cy.get('#' + ariaControl).should('not.exist'); + return; + } if (hasWrite) cy.get(selector).clear().type(option); return selectItem(selector, option, ariaControl, false); });