refactor: refs #8581 simplify createCorrective function and update assertions for invoice creation
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
gitea/salix-front/pipeline/pr-dev This commit is unstable
Details
This commit is contained in:
parent
aeab837348
commit
2c134f9935
|
@ -85,12 +85,12 @@ describe('InvoiceInDescriptor', () => {
|
|||
beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`));
|
||||
|
||||
it('should create a correcting invoice and redirect to original invoice', () => {
|
||||
createCorrective({ class: 'R5', type: 'sustitución', reason: 'VAT' });
|
||||
createCorrective();
|
||||
redirect(originalId);
|
||||
});
|
||||
|
||||
it('should create a correcting invoice and navigate to list filtered by corrective', () => {
|
||||
createCorrective({ class: 'R3', type: 'diferencias', reason: 'customer' });
|
||||
createCorrective();
|
||||
redirect(originalId);
|
||||
|
||||
cy.clicDescriptorAction(4);
|
||||
|
@ -123,28 +123,19 @@ describe('InvoiceInDescriptor', () => {
|
|||
});
|
||||
});
|
||||
|
||||
function createCorrective(opts = {}) {
|
||||
function createCorrective() {
|
||||
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
||||
const { type, reason, class: classVal } = opts;
|
||||
|
||||
cy.selectDescriptorOption(4);
|
||||
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 }) => {
|
||||
const correctingId = response.body;
|
||||
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
||||
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
||||
cy.dataCy('invoiceInCorrective_class').should('contain.value', classVal);
|
||||
cy.dataCy('invoiceInCorrective_type').should('contain.value', type);
|
||||
cy.dataCy('invoiceInCorrective_reason').should('contain.value', reason);
|
||||
cy.dataCy('invoiceInCorrective_class').should('contain.value', 'R2');
|
||||
cy.dataCy('invoiceInCorrective_type').should('contain.value', 'diferencias');
|
||||
cy.dataCy('invoiceInCorrective_reason').should('contain.value', 'sales details');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue