test: refs #8581 update invoiceInDescriptor tests for improved coverage and clarity
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2025-02-27 09:47:26 +01:00
parent 24cd4caa96
commit a63cc17142
1 changed files with 61 additions and 9 deletions

View File

@ -2,22 +2,74 @@ describe('InvoiceInDescriptor', () => {
const checkbox = '[data-cy="vnLvIs booked"] > .q-checkbox';
describe('more options', () => {
it('should booking and unbooking the invoice properly', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.login('developer');
cy.visit('/#/invoice-in/1/summary');
cy.openActionsDescriptor();
cy.selectDescriptorOption();
cy.login('administrative');
});
it('should booking and unbooking the invoice properly', () => {
cy.visit('/#/invoice-in/1/summary');
cy.selectDescriptorOption();
cy.dataCy('VnConfirm_confirm').click();
cy.validateCheckbox(checkbox);
cy.selectDescriptorOption();
cy.dataCy('VnConfirm_confirm').click();
cy.validateCheckbox(checkbox, false);
});
});
// it('should delete the invoice properly', () => {
// });
it('should delete the invoice properly', () => {
cy.visit('/#/invoice-in/2/summary');
cy.selectDescriptorOption(2);
cy.clickConfirm();
cy.checkNotification('invoice deleted');
});
it('should clone the invoice properly', () => {
cy.visit('/#/invoice-in/3/summary');
cy.selectDescriptorOption(3);
cy.clickConfirm();
cy.checkNotification('Invoice cloned');
});
it('should show the agricultural PDF properly', () => {
cy.visit('/#/invoice-in/6/summary', {
onBeforeLoad(win) {
cy.stub(win, 'open').as('win');
},
});
cy.selectDescriptorOption(4);
cy.get('@win')
.should('be.calledOnce')
.then((stub) => {
const [url] = stub.getCall(0).args;
const regex = /api\/InvoiceIns\/6\/invoice-in-pdf\?access_token=.*/;
expect(url).to.match(regex);
cy.request(url).then((response) =>
expect(response.headers['content-type']).to.include(
'application/pdf',
),
);
});
});
// it('should send the agricultural PDF properly', () => {
// cy.visit('/#/invoice-in/6/summary');
// cy.selectDescriptorOption(5);
// cy.checkNotification('Email sent');
// });
// it('should create a corrective invoice properly', () => {
// cy.visit('/#/invoice-in/2/summary');
// cy.selectDescriptorOption(6);
// cy.dataCy('createCorrectiveItem').click();
// cy.checkNotification('Corrective invoice created');
// });
// it('should download the file properly', () => {
// cy.visit('/#/invoice-in/2/summary');
// cy.selectDescriptorOption(7);
// cy.checkNotification('File downloaded');
// });
});
});