2024-03-07 14:46:38 +00:00
|
|
|
describe('InvoiceInDescriptor', () => {
|
2025-03-05 13:33:01 +00:00
|
|
|
beforeEach(() => cy.login('administrative'));
|
2025-02-27 08:47:26 +00:00
|
|
|
|
2025-03-05 13:33:01 +00:00
|
|
|
describe('more options', () => {
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should booking and unbooking the invoice properly', () => {
|
2025-02-28 08:25:51 +00:00
|
|
|
const checkbox = '[data-cy="vnLvIs booked"] > .q-checkbox';
|
2025-03-07 10:19:52 +00:00
|
|
|
cy.visit('/#/invoice-in/2/summary');
|
2025-02-25 14:27:12 +00:00
|
|
|
cy.selectDescriptorOption();
|
2025-02-25 09:11:33 +00:00
|
|
|
cy.dataCy('VnConfirm_confirm').click();
|
2025-02-25 14:27:12 +00:00
|
|
|
cy.validateCheckbox(checkbox);
|
|
|
|
cy.selectDescriptorOption();
|
2025-02-25 09:11:33 +00:00
|
|
|
cy.dataCy('VnConfirm_confirm').click();
|
2025-02-25 14:27:12 +00:00
|
|
|
cy.validateCheckbox(checkbox, false);
|
2025-02-25 09:11:33 +00:00
|
|
|
});
|
2025-02-26 13:18:19 +00:00
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should delete the invoice properly', () => {
|
2025-02-27 08:47:26 +00:00
|
|
|
cy.visit('/#/invoice-in/2/summary');
|
|
|
|
cy.selectDescriptorOption(2);
|
|
|
|
cy.clickConfirm();
|
|
|
|
cy.checkNotification('invoice deleted');
|
|
|
|
});
|
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should clone the invoice properly', () => {
|
2025-02-27 08:47:26 +00:00
|
|
|
cy.visit('/#/invoice-in/3/summary');
|
|
|
|
cy.selectDescriptorOption(3);
|
|
|
|
cy.clickConfirm();
|
|
|
|
cy.checkNotification('Invoice cloned');
|
|
|
|
});
|
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should show the agricultural PDF properly', () => {
|
2025-02-28 08:25:51 +00:00
|
|
|
cy.visit('/#/invoice-in/6/summary');
|
|
|
|
cy.validatePdfDownload(
|
|
|
|
/api\/InvoiceIns\/6\/invoice-in-pdf\?access_token=.*/,
|
|
|
|
() => cy.selectDescriptorOption(4),
|
|
|
|
);
|
2025-02-27 08:47:26 +00:00
|
|
|
});
|
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should send the agricultural PDF properly', () => {
|
2025-02-27 11:42:51 +00:00
|
|
|
cy.intercept('POST', 'api/InvoiceIns/6/invoice-in-email').as('sendEmail');
|
|
|
|
cy.visit('/#/invoice-in/6/summary');
|
|
|
|
cy.selectDescriptorOption(5);
|
2025-02-27 08:47:26 +00:00
|
|
|
|
2025-03-06 14:03:32 +00:00
|
|
|
cy.dataCy('SendEmailNotifiactionDialogInput_input').type(
|
2025-02-27 11:42:51 +00:00
|
|
|
'{selectall}jorgito@gmail.mx',
|
|
|
|
);
|
|
|
|
cy.clickConfirm();
|
|
|
|
cy.checkNotification('Notification sent');
|
|
|
|
cy.wait('@sendEmail').then(({ request, response }) => {
|
|
|
|
expect(request.body).to.deep.equal({
|
|
|
|
recipientId: 2,
|
|
|
|
recipient: 'jorgito@gmail.mx',
|
|
|
|
});
|
|
|
|
expect(response.statusCode).to.equal(200);
|
|
|
|
});
|
|
|
|
});
|
2025-03-13 12:17:57 +00:00
|
|
|
// https://redmine.verdnatura.es/issues/8767
|
|
|
|
it.skip('should download the file properly', () => {
|
2025-02-28 08:25:51 +00:00
|
|
|
cy.visit('/#/invoice-in/1/summary');
|
2025-03-10 15:19:56 +00:00
|
|
|
cy.validateDownload(() => cy.selectDescriptorOption(5));
|
2025-02-27 11:42:51 +00:00
|
|
|
});
|
2025-02-28 08:25:51 +00:00
|
|
|
});
|
2025-02-27 11:42:51 +00:00
|
|
|
|
2025-02-28 08:25:51 +00:00
|
|
|
describe('buttons', () => {
|
2025-03-05 13:33:01 +00:00
|
|
|
beforeEach(() => cy.visit('/#/invoice-in/1/summary'));
|
2025-02-28 08:25:51 +00:00
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should navigate to the supplier summary', () => {
|
2025-02-28 08:25:51 +00:00
|
|
|
cy.clicDescriptorAction(1);
|
|
|
|
cy.url().should('to.match', /supplier\/\d+\/summary/);
|
|
|
|
});
|
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should navigate to the entry summary', () => {
|
2025-02-28 08:25:51 +00:00
|
|
|
cy.clicDescriptorAction(2);
|
|
|
|
cy.url().should('to.match', /entry\/\d+\/summary/);
|
|
|
|
});
|
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should navigate to the invoiceIn list', () => {
|
2025-03-05 11:34:45 +00:00
|
|
|
cy.clicDescriptorAction(3);
|
2025-02-28 08:25:51 +00:00
|
|
|
cy.url().should('to.match', /invoice-in\/list\?table=\{.*supplierFk.+\}/);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2025-03-05 11:28:43 +00:00
|
|
|
describe('corrective', () => {
|
2025-03-14 10:10:17 +00:00
|
|
|
const originalId = 4;
|
2025-03-05 11:28:43 +00:00
|
|
|
|
2025-03-05 13:33:01 +00:00
|
|
|
beforeEach(() => cy.visit(`/#/invoice-in/${originalId}/summary`));
|
2025-03-05 11:28:43 +00:00
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
it('should create a correcting invoice and redirect to original invoice', () => {
|
2025-03-11 11:52:02 +00:00
|
|
|
createCorrective();
|
2025-03-05 07:47:54 +00:00
|
|
|
redirect(originalId);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create a correcting invoice and navigate to list filtered by corrective', () => {
|
2025-03-11 11:52:02 +00:00
|
|
|
createCorrective();
|
2025-03-05 07:47:54 +00:00
|
|
|
redirect(originalId);
|
2025-03-05 11:28:43 +00:00
|
|
|
|
2025-03-05 07:47:54 +00:00
|
|
|
cy.clicDescriptorAction(4);
|
|
|
|
cy.validateVnTableRows({
|
|
|
|
cols: [
|
|
|
|
{
|
|
|
|
name: 'supplierRef',
|
2025-03-14 10:10:17 +00:00
|
|
|
val: '1237',
|
2025-03-05 07:47:54 +00:00
|
|
|
operation: 'include',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
2025-02-28 08:25:51 +00:00
|
|
|
});
|
2025-02-27 08:47:26 +00:00
|
|
|
});
|
2025-03-05 13:33:01 +00:00
|
|
|
|
|
|
|
describe('link', () => {
|
|
|
|
it('should open the supplier descriptor popup', () => {
|
|
|
|
cy.visit('/#/invoice-in/1/summary');
|
|
|
|
cy.intercept('GET', /Suppliers\/\d+/).as('getSupplier');
|
|
|
|
|
|
|
|
cy.dataCy('invoiceInDescriptor_supplier').then(($el) => {
|
|
|
|
const alias = $el.text().trim();
|
|
|
|
$el.click();
|
|
|
|
cy.wait('@getSupplier').then(() =>
|
|
|
|
cy.validateDescriptor({ listbox: { 1: alias }, popup: true }),
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2024-03-07 14:46:38 +00:00
|
|
|
});
|
2025-02-28 08:25:51 +00:00
|
|
|
|
2025-03-11 11:52:02 +00:00
|
|
|
function createCorrective() {
|
2025-03-05 11:28:43 +00:00
|
|
|
cy.intercept('POST', '/api/InvoiceIns/corrective').as('corrective');
|
|
|
|
|
2025-02-28 08:25:51 +00:00
|
|
|
cy.selectDescriptorOption(4);
|
|
|
|
cy.dataCy('saveCorrectiveInvoice').click();
|
2025-03-05 11:28:43 +00:00
|
|
|
|
|
|
|
cy.wait('@corrective').then(({ response }) => {
|
|
|
|
const correctingId = response.body;
|
|
|
|
cy.url().should('include', `/invoice-in/${correctingId}/summary`);
|
|
|
|
cy.visit(`/#/invoice-in/${correctingId}/corrective`);
|
2025-03-11 11:52:02 +00:00
|
|
|
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');
|
2025-03-05 11:28:43 +00:00
|
|
|
});
|
2025-03-05 07:47:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function redirect(subtitle) {
|
2025-03-05 13:33:01 +00:00
|
|
|
const regex = new RegExp(`InvoiceIns/${subtitle}\\?filter=.*`);
|
|
|
|
cy.intercept('GET', regex).as('getOriginal');
|
2025-03-05 07:47:54 +00:00
|
|
|
cy.clicDescriptorAction(4);
|
|
|
|
cy.wait('@getOriginal');
|
|
|
|
cy.validateDescriptor({ subtitle });
|
2025-02-28 08:25:51 +00:00
|
|
|
}
|