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

61 lines
2.4 KiB
JavaScript
Raw Normal View History

/// <reference types="cypress" />
2024-11-28 12:00:53 +00:00
describe('InvoiceOut list', () => {
2025-01-30 07:10:26 +00:00
const serial = 'Española rapida';
const columnCheckbox =
'.bg-header > :nth-child(1) > .q-checkbox > .q-checkbox__inner';
const firstRowDescriptor =
'tbody > :nth-child(1) > [data-col-field="clientFk"] > .no-padding > .link';
const firstRowCheckbox =
'tbody > :nth-child(1) > :nth-child(1) > .q-checkbox > .q-checkbox__inner ';
const summaryPopupIcon = '.header > :nth-child(2) > .q-btn__content > .q-icon';
const filterBtn = '.q-scrollarea__content > .q-btn--standard > .q-btn__content';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/list`);
2024-12-16 06:46:36 +00:00
cy.typeSearchbar('{enter}');
});
it('should download one pdf', () => {
cy.get(firstRowCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
it('should download all pdfs', () => {
cy.get(columnCheckbox).click();
cy.dataCy('InvoiceOutDownloadPdfBtn').click();
});
it('should open the client descriptor', () => {
cy.get(firstRowDescriptor).click();
cy.get(summaryPopupIcon).click();
});
it('should filter the results by client ID, then check the first result is correct', () => {
cy.dataCy('Customer ID_input').type('1103');
cy.get(filterBtn).click();
cy.get(firstRowDescriptor).click();
cy.get('.q-item > .q-item__label').should('include.text', '1103');
});
it('should give an error when manual invoicing a ticket that is already invoiced', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('InvoiceOutCreateTicketinput').type(1);
cy.selectOption('[data-cy="InvoiceOutCreateSerialSelect"]', serial);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('This ticket is already invoiced');
});
it('should create a manual invoice and enter to its summary, then delete that invoice', () => {
cy.dataCy('vnTableCreateBtn').click();
cy.dataCy('InvoiceOutCreateTicketinput').type(9);
cy.selectOption('[data-cy="InvoiceOutCreateSerialSelect"]', serial);
cy.dataCy('FormModelPopup_save').click();
cy.checkNotification('Data created');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
});
});