130 lines
4.9 KiB
JavaScript
130 lines
4.9 KiB
JavaScript
describe('InvoiceInDescriptor', () => {
|
|
describe('more options', () => {
|
|
beforeEach(() => cy.login('administrative'));
|
|
|
|
it.skip('should booking and unbooking the invoice properly', () => {
|
|
const checkbox = '[data-cy="vnLvIs booked"] > .q-checkbox';
|
|
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.skip('should delete the invoice properly', () => {
|
|
cy.visit('/#/invoice-in/2/summary');
|
|
cy.selectDescriptorOption(2);
|
|
cy.clickConfirm();
|
|
cy.checkNotification('invoice deleted');
|
|
});
|
|
|
|
it.skip('should clone the invoice properly', () => {
|
|
cy.visit('/#/invoice-in/3/summary');
|
|
cy.selectDescriptorOption(3);
|
|
cy.clickConfirm();
|
|
cy.checkNotification('Invoice cloned');
|
|
});
|
|
|
|
it.skip('should show the agricultural PDF properly', () => {
|
|
cy.visit('/#/invoice-in/6/summary');
|
|
cy.validatePdfDownload(
|
|
/api\/InvoiceIns\/6\/invoice-in-pdf\?access_token=.*/,
|
|
() => cy.selectDescriptorOption(4),
|
|
);
|
|
});
|
|
|
|
it.skip('should send the agricultural PDF properly', () => {
|
|
cy.intercept('POST', 'api/InvoiceIns/6/invoice-in-email').as('sendEmail');
|
|
cy.visit('/#/invoice-in/6/summary');
|
|
cy.selectDescriptorOption(5);
|
|
|
|
cy.get('input[data-cy="sendEmailDialog_address"]').type(
|
|
'{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);
|
|
});
|
|
});
|
|
|
|
it.skip('should download the file properly', () => {
|
|
cy.visit('/#/invoice-in/1/summary');
|
|
cy.validateDownload(() => cy.selectDescriptorOption(5));
|
|
});
|
|
});
|
|
|
|
describe('buttons', () => {
|
|
beforeEach(() => {
|
|
cy.login('administrative');
|
|
cy.visit('/#/invoice-in/1/summary');
|
|
});
|
|
|
|
it.skip('should navigate to the supplier summary', () => {
|
|
cy.clicDescriptorAction(1);
|
|
cy.url().should('to.match', /supplier\/\d+\/summary/);
|
|
});
|
|
|
|
it.skip('should navigate to the entry summary', () => {
|
|
cy.clicDescriptorAction(2);
|
|
cy.url().should('to.match', /entry\/\d+\/summary/);
|
|
});
|
|
|
|
it.skip('should navigate to the invoiceIn list', () => {
|
|
cy.intercept('GET', /api\/InvoiceIns\/1/).as('getCard');
|
|
cy.clicDescriptorAction(3);
|
|
cy.wait('@getCard');
|
|
cy.url().should('to.match', /invoice-in\/list\?table=\{.*supplierFk.+\}/);
|
|
});
|
|
});
|
|
|
|
describe('corrective', () => {
|
|
beforeEach(() => {
|
|
cy.login('administrative');
|
|
cy.visit('/#/invoice-in/1/summary');
|
|
});
|
|
it('should create two correcting invoice', () => {
|
|
cy.visit(`/#/invoice-in/1/summary`);
|
|
corrective();
|
|
});
|
|
// it('should navigate to the corrected or correcting invoice page', () => {
|
|
// cy.visit('/#/invoice-in/1/summary');
|
|
// cy.clicDescriptorAction(4);
|
|
// cy.url().should('include', '/invoice-in');
|
|
// });
|
|
|
|
// it('should navigate to invoice-in list filtered by the corrected invoice', () => {
|
|
// cy.visit('')
|
|
// });
|
|
});
|
|
});
|
|
|
|
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'));
|
|
});
|
|
}
|