feat: refs #8581 update InvoiceInDescriptorMenu and tests for improved dialog handling and form submission
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-03-11 11:15:25 +01:00
parent 4ce9254af0
commit f783aa43de
3 changed files with 14 additions and 6 deletions

View File

@ -247,7 +247,7 @@ onBeforeMount(async () => {
<QItemSection>{{ t('components.smartCard.downloadFile') }}</QItemSection>
</QItem>
<QDialog ref="correctionDialogRef">
<QCard>
<QCard data-cy="correctiveInvoiceDialog">
<QCardSection>
<QItem class="q-px-none">
<span class="text-primary text-h6 full-width">

View File

@ -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 }) => {

View File

@ -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);
});