salix/e2e/paths/09-invoice-in/04_tax.spec.js

60 lines
2.6 KiB
JavaScript
Raw Normal View History

2021-08-12 15:27:39 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('InvoiceIn tax path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'invoiceIn');
await page.accessToSearchResult('2');
await page.accessToSection('invoiceIn.card.tax');
});
afterAll(async() => {
await browser.close();
});
2023-05-05 06:12:38 +00:00
it('should add a new tax and check it', async() => {
2021-08-12 15:27:39 +00:00
await page.waitToClick(selectors.invoiceInTax.addTaxButton);
2022-05-11 17:38:10 +00:00
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567');
2021-08-12 15:27:39 +00:00
await page.write(selectors.invoiceInTax.thirdTaxableBase, '100');
2023-05-05 06:12:38 +00:00
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, 'H.P. IVA');
2021-08-12 15:27:39 +00:00
await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas');
await page.waitToClick(selectors.invoiceInTax.saveButton);
const message = await page.waitForSnackbar();
await page.waitToClick(selectors.invoiceInDescriptor.summaryIcon);
await page.waitForState('invoiceIn.card.summary');
2023-05-05 06:12:38 +00:00
const total = await page.waitToGetProperty(selectors.invoiceInSummary.totalTaxableBase, 'innerText');
2021-08-12 15:27:39 +00:00
await page.accessToSection('invoiceIn.card.tax');
2023-05-05 06:12:38 +00:00
const thirdExpense = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value');
const thirdTaxableBase = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxableBase, 'value');
const thirdTaxType = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxType, 'value');
const thirdTransactionType = await page.waitToGetProperty(selectors.invoiceInTax.thirdTransactionType, 'value');
const thirdRate = await page.waitToGetProperty(selectors.invoiceInTax.thirdRate, 'value');
2021-08-12 15:27:39 +00:00
2023-05-05 06:12:38 +00:00
expect(message.text).toContain('Data saved!');
2021-08-12 15:27:39 +00:00
2023-05-05 06:12:38 +00:00
expect(total).toEqual('Taxable base €1,323.16');
2021-08-12 15:27:39 +00:00
2023-05-05 06:12:38 +00:00
expect(thirdExpense).toEqual('6210000567');
expect(thirdTaxableBase).toEqual('100');
expect(thirdTaxType).toEqual('H.P. IVA 4% CEE');
expect(thirdTransactionType).toEqual('Operaciones exentas');
expect(thirdRate).toEqual('€4.00');
2021-08-12 15:27:39 +00:00
});
it('should delete the added line', async() => {
await page.waitToClick(selectors.invoiceInTax.thirdDeleteButton);
await page.waitToClick(selectors.invoiceInTax.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
});