51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
/// <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';
|
|
const dialogBtns = '.q-dialog button';
|
|
const acrossInput =
|
|
':nth-child(1) > .q-td.q-table--col-auto-width > .q-field > .q-field__inner > .q-field__control > :nth-child(2) > .default-icon';
|
|
const randomInt = Math.floor(Math.random() * 100);
|
|
|
|
beforeEach(() => {
|
|
cy.login('developer');
|
|
cy.visit(`/#/invoice-in/1/vat`);
|
|
});
|
|
|
|
it('should edit the sage iva', () => {
|
|
cy.selectOption(firstLineVat, 'H.P. IVA 21% CEE');
|
|
cy.saveCard();
|
|
cy.visit(`/#/invoice-in/1/vat`);
|
|
|
|
cy.getValue(firstLineVat).should('equal', '8');
|
|
});
|
|
|
|
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', () => {
|
|
cy.removeRow(2);
|
|
});
|
|
|
|
it('should throw an error if there are fields undefined', () => {
|
|
cy.get(acrossInput).click();
|
|
cy.get(dialogBtns).eq(2).click();
|
|
cy.get('.q-notification__message').should('have.text', "The code can't be empty");
|
|
});
|
|
|
|
it('should correctly handle expense addition', () => {
|
|
cy.get(acrossInput).click();
|
|
cy.get(dialogInputs).eq(0).type(randomInt);
|
|
cy.get(dialogInputs).eq(1).click();
|
|
cy.get(dialogInputs).eq(1).type('This is a dummy expense');
|
|
|
|
cy.get(dialogBtns).eq(2).click();
|
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
});
|
|
});
|