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

79 lines
3.2 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();
});
it('should add a new tax', async() => {
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');
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, '6');
await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas');
await page.waitToClick(selectors.invoiceInTax.saveButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Data saved!');
});
it('should navigate to the summary and check the taxable base sum is correct', async() => {
await page.waitToClick(selectors.invoiceInDescriptor.summaryIcon);
await page.waitForState('invoiceIn.card.summary');
const result = await page.waitToGetProperty(selectors.invoiceInSummary.totalTaxableBase, 'innerText');
expect(result).toEqual('Taxable base €1,323.16');
});
2022-05-11 17:38:10 +00:00
it('should navigate back to tax section, check the reciently added line contains the expected expense', async() => {
2021-08-12 15:27:39 +00:00
await page.accessToSection('invoiceIn.card.tax');
2022-05-11 17:38:10 +00:00
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value');
2021-08-12 15:27:39 +00:00
expect(result).toEqual('6210000567: Alquiler VNH');
});
it('should check the reciently added line contains the expected taxable base', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxableBase, 'value');
expect(result).toEqual('100');
});
it('should check the reciently added line contains the expected tax type', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdTaxType, 'value');
expect(result).toEqual('6: H.P. IVA 4% CEE');
});
it('should check the reciently added line contains the expected transaction type', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdTransactionType, 'value');
expect(result).toEqual('37: Operaciones exentas');
});
it('should check the reciently added line contains the expected rate', async() => {
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdRate, 'value');
expect(result).toEqual('€4.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!');
});
});