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); await page.autocompleteSearch(selectors.invoiceInTax.thirdExpence, '6210000567'); 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'); }); it('should navigate back to the tax section and check the reciently added line contains the expected expense', async() => { await page.accessToSection('invoiceIn.card.tax'); const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpence, 'value'); 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!'); }); });