2023-11-09 09:29:28 +00:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
describe('InvoiceInVat', () => {
|
|
|
|
const thirdRow = 'tbody > :nth-child(3)';
|
|
|
|
const firstLineVat = 'tbody > :nth-child(1) > :nth-child(4)';
|
|
|
|
const dialogInputs = '.q-dialog label input';
|
2024-09-02 14:47:54 +00:00
|
|
|
const addBtn = 'tbody tr:nth-child(1) td:nth-child(2) .--add-icon';
|
2023-11-09 09:29:28 +00:00
|
|
|
const randomInt = Math.floor(Math.random() * 100);
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.login('developer');
|
|
|
|
cy.visit(`/#/invoice-in/1/vat`);
|
2024-09-02 14:47:54 +00:00
|
|
|
cy.intercept('GET', '/api/InvoiceIns/1/getTotals').as('lastCall');
|
|
|
|
cy.wait('@lastCall');
|
2023-11-09 09:29:28 +00:00
|
|
|
});
|
|
|
|
|
2024-04-19 14:15:10 +00:00
|
|
|
it('should edit the sage iva', () => {
|
2023-11-09 09:29:28 +00:00
|
|
|
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
|
|
|
|
cy.saveCard();
|
2024-07-05 13:41:53 +00:00
|
|
|
cy.get(`${firstLineVat} span`).should('have.text', '8:H.P. IVA 21% CEE');
|
2023-11-09 09:29:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should add a new row', () => {
|
|
|
|
cy.addRow();
|
|
|
|
cy.fillRow(thirdRow, [true, 2000000001, 30, 'H.P. IVA 10']);
|
|
|
|
cy.saveCard();
|
|
|
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should remove the first line', () => {
|
2024-09-02 14:47:54 +00:00
|
|
|
cy.removeRow(1);
|
2023-11-09 09:29:28 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should correctly handle expense addition', () => {
|
2024-09-02 14:47:54 +00:00
|
|
|
cy.get(addBtn).click();
|
2023-11-09 09:29:28 +00:00
|
|
|
cy.get(dialogInputs).eq(0).type(randomInt);
|
|
|
|
cy.get(dialogInputs).eq(1).type('This is a dummy expense');
|
|
|
|
|
2024-09-02 14:47:54 +00:00
|
|
|
cy.get('button[type="submit"]').click();
|
|
|
|
cy.get('.q-notification__message').should('have.text', 'Data created');
|
2023-11-09 09:29:28 +00:00
|
|
|
});
|
|
|
|
});
|