54 lines
2.0 KiB
JavaScript
54 lines
2.0 KiB
JavaScript
/// <reference types="cypress" />
|
|
describe('InvoiceInVat', () => {
|
|
const dialogInputs = '.q-dialog label input';
|
|
const randomInt = Math.floor(Math.random() * 100);
|
|
const firstTaxType = 'td[data-col-field="taxTypeSageFk"][data-row-index="0"]';
|
|
const firstExpense = 'td[data-col-field="expenseFk"][data-row-index="0"]';
|
|
const firstDeductible = 'td[data-col-field="isDeductible"][data-row-index="0"]';
|
|
const taxType = 'H.P. IVA 21% CEE';
|
|
|
|
before(() => {
|
|
cy.login('administrative');
|
|
cy.visit(`/#/invoice-in/1/vat`);
|
|
});
|
|
|
|
it('should edit the sage iva', () => {
|
|
cy.get(firstTaxType).click().type(`{selectall}{backspace}${taxType}{enter}`);
|
|
cy.saveCard();
|
|
cy.get(firstTaxType).should('have.text', `8: ${taxType}`);
|
|
});
|
|
|
|
it('should mark the line as deductible VAT', () => {
|
|
cy.get(firstDeductible).click().click();
|
|
cy.saveCard();
|
|
cy.get('.q-notification__message').should('have.text', 'Data saved');
|
|
});
|
|
|
|
it('should add a new row', () => {
|
|
cy.dataCy('vnTableCreateBtn').click();
|
|
cy.fillInForm(
|
|
{
|
|
Expense_select: { val: '2000000001', type: 'select' },
|
|
'Taxable base_input': '30',
|
|
'vat-sageiva': { val: 'H.P. IVA 10', type: 'select' },
|
|
},
|
|
{ attr: 'data-cy' },
|
|
);
|
|
cy.dataCy('FormModelPopup_save').click();
|
|
cy.get('.q-notification__message').should('have.text', 'Data created');
|
|
});
|
|
|
|
it('should remove the first line', () => {
|
|
cy.removeRow(1);
|
|
});
|
|
|
|
it('should correctly handle expense addition', () => {
|
|
cy.get(firstExpense).click();
|
|
cy.get('.--add-icon').click();
|
|
cy.get(dialogInputs).eq(0).type(randomInt);
|
|
cy.get(dialogInputs).eq(1).type('This is a dummy expense');
|
|
cy.get('[data-cy="FormModelPopup_save"]').click();
|
|
cy.get('.q-notification__message').should('have.text', 'Data created');
|
|
});
|
|
});
|