salix-front/test/cypress/integration/invoiceOut/invoiceOutList.spec.js

52 lines
2.2 KiB
JavaScript
Raw Normal View History

/// <reference types="cypress" />
describe('InvoiceOut manual invoice path', () => {
const notification = '.q-notification__message';
const invoice = {
Ticket: { val: '8' },
Serial: { val: 'Española rápida', type: 'select' },
};
const invoiceError = {
Ticket: { val: '1' },
Serial: { val: 'T - Española rapida', type: 'select' },
};
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
cy.dataCy('vnSearchBar').find('input').type('{enter}');
});
it('should search and filter an invoice and enter to the summary', () => {
cy.dataCy('vnSearchBar').find('input').type('1{enter}');
cy.get('.q-virtual-scroll__content > :nth-child(2) > :nth-child(7)').click();
cy.get('.header > a.q-btn > .q-btn__content').click();
cy.dataCy('vnSearchBar').find('input').type('{enter}');
cy.dataCy('InvoiceOutFilterAmountBtn').find('input').type('8.88{enter}');
});
it('should download a pdf with one and all invoices', () => {
cy.get(
':nth-child(6) > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
cy.get(
':nth-child(6) > :nth-child(1) > .q-checkbox > .q-checkbox__inner'
).click();
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
cy.get('.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner').click();
});
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.fillInForm(invoiceError);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get(notification).should('contains.text', 'This ticket is already invoiced');
});
it('should create a manual invoice and enter to its summary', () => {
cy.get('[data-cy="vnTableCreateBtn"]').click();
cy.fillInForm(invoice);
cy.get('[data-cy="FormModelPopup_save"]').click();
cy.get(notification).should('contains.text', 'Data created');
});
});