60 lines
2.6 KiB
JavaScript
60 lines
2.6 KiB
JavaScript
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 and check it', async() => {
|
|
await page.waitToClick(selectors.invoiceInTax.addTaxButton);
|
|
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567');
|
|
await page.write(selectors.invoiceInTax.thirdTaxableBase, '100');
|
|
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, 'H.P. IVA');
|
|
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');
|
|
const total = await page.waitToGetProperty(selectors.invoiceInSummary.totalTaxableBase, 'innerText');
|
|
|
|
await page.accessToSection('invoiceIn.card.tax');
|
|
|
|
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');
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
|
|
expect(total).toEqual('Taxable base €1,323.16');
|
|
|
|
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');
|
|
});
|
|
|
|
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!');
|
|
});
|
|
});
|