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

87 lines
3.4 KiB
JavaScript

/// <reference types="cypress" />
describe('InvoiceOut summary', () => {
const transferInvoice = {
Client: { val: 'employee', type: 'select' },
Type: { val: 'Error in customer data', type: 'select' },
};
const firstTicketRowDescriptor = 'tbody > :nth-child(1) > :nth-child(1) > .q-btn';
const firstClientRowDescriptor =
'tbody > :nth-child(1) > :nth-child(2) > .q-btn > .q-btn__content';
const toCustomerSummary = '[href="#/customer/1101"]';
const toTicketList = '[href="#/ticket/list?table={%22refFk%22:%22T1111111%22}"]';
beforeEach(() => {
cy.viewport(1920, 1080);
cy.login('developer');
cy.visit(`/#/invoice-out/1/summary`);
});
it('open the descriptors', () => {
cy.get(firstTicketRowDescriptor).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1');
cy.get(firstClientRowDescriptor).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the client summary and the ticket list', () => {
cy.get(toCustomerSummary).click();
cy.get('.descriptor').should('be.visible');
cy.get('.q-item > .q-item__label').should('include.text', '1101');
});
it('should open the ticket list', () => {
cy.get(toTicketList).click();
cy.get('.descriptor').should('be.visible');
cy.get('[data-cy="vnFilterPanelChip"]').should('include.text', 'T1111111');
});
it('should transfer the invoice ', () => {
cy.typeSearchbar('T1111111{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(1)').click();
cy.fillInForm(transferInvoice);
cy.get('.q-mt-lg > .q-btn').click();
cy.checkNotification('Transferred invoice');
});
it('should send the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(3)').click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(1)').click();
cy.get('.q-btn--unelevated').click();
cy.checkNotification('Notification sent');
});
it('should delete an invoice ', () => {
cy.typeSearchbar('T2222222{enter}');
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(4)').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut deleted');
});
it('shpuld book the invoice', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(5)').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('InvoiceOut booked');
});
it('should generate the invoice PDF', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(6)').click();
cy.dataCy('VnConfirm_confirm').click();
cy.checkNotification('The invoice PDF document has been regenerated');
});
it('should refund the invoice ', () => {
cy.dataCy('descriptor-more-opts').click();
cy.get('.q-menu > .q-list > :nth-child(7)').click();
cy.get('#q-portal--menu--3 > .q-menu > .q-list > :nth-child(2)').click();
cy.checkNotification('The following refund ticket have been created');
});
});