feat: refs #8581 add data-cy attrs

This commit is contained in:
Jorge Penadés 2025-03-04 11:18:03 +01:00
parent d2a380e3bc
commit f932554af7
3 changed files with 18 additions and 2 deletions

View File

@ -115,6 +115,7 @@ const requiredFieldRule = (val) => val || t('globals.requiredField');
:option-label="col.optionLabel"
:disable="row.invoiceIn.isBooked"
:filter-options="['description']"
data-cy="invoiceInCorrective_type"
>
<template #option="{ opt, itemProps }">
<QItem v-bind="itemProps">
@ -137,6 +138,7 @@ const requiredFieldRule = (val) => val || t('globals.requiredField');
:rules="[requiredFieldRule]"
:filter-options="['code', 'description']"
:disable="row.invoiceIn.isBooked"
data-cy="invoiceInCorrective_class"
>
<template #option="{ opt, itemProps }">
<QItem v-bind="itemProps">
@ -161,6 +163,7 @@ const requiredFieldRule = (val) => val || t('globals.requiredField');
:option-label="col.optionLabel"
:rules="[requiredFieldRule]"
:disable="row.invoiceIn.isBooked"
data-cy="invoiceInCorrective_reason"
/>
</QTd>
</template>

View File

@ -271,6 +271,7 @@ onBeforeMount(async () => {
option-value="id"
option-label="code"
:required="true"
data-cy="invoiceInDescriptorMenu_class"
/>
</QItemSection>
<QItemSection>
@ -281,6 +282,7 @@ onBeforeMount(async () => {
option-value="id"
option-label="description"
:required="true"
data-cy="invoiceInDescriptorMenu_type"
>
<template #option="{ itemProps, opt }">
<QItem v-bind="itemProps">
@ -302,6 +304,7 @@ onBeforeMount(async () => {
option-value="id"
option-label="description"
:required="true"
data-cy="invoiceInDescriptorMenu_reason"
/>
</QItemSection>
</QItem>

View File

@ -92,8 +92,6 @@ describe('InvoiceInDescriptor', () => {
it('should create two correcting invoice', () => {
cy.visit(`/#/invoice-in/1/summary`);
corrective();
cy.get('tbody > tr:visible').should('have.length', 1);
corrective();
});
// it('should navigate to the corrected or correcting invoice page', () => {
// cy.visit('/#/invoice-in/1/summary');
@ -110,10 +108,22 @@ describe('InvoiceInDescriptor', () => {
function corrective() {
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
cy.selectDescriptorOption(4);
cy.selectOption('[data-cy="invoiceInDescriptorMenu_class"]', 'R5');
cy.selectOption('[data-cy="invoiceInDescriptorMenu_type"]', 'sustitución');
cy.selectOption('[data-cy="invoiceInDescriptorMenu_reason"]', 'VAT');
cy.dataCy('saveCorrectiveInvoice').click();
cy.wait('@corrective').then(({ response }) => {
const correctingId = response.body;
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
cy.dataCy('invoiceInCorrective_type')
.invoke('val')
.then((val) => expect(val).includes('sustitución'));
cy.dataCy('invoiceInCorrective_reason')
.invoke('val')
.then((val) => expect(val).includes('VAT'));
cy.dataCy('invoiceInCorrective_class')
.invoke('val')
.then((val) => expect(val).includes('R5'));
});
}