import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('InvoiceOut manual invoice path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('administrative', 'invoiceOut'); }); afterAll(async() => { await browser.close(); }); it('should create an invoice from a ticket', async() => { await page.waitToClick(selectors.invoiceOutIndex.createInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTicket, '15'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national'); await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); const message = await page.waitForSnackbar(); await page.waitForState('invoiceOut.card.summary'); expect(message.text).toContain('Data saved!'); }); it(`should create another invoice from a client`, async() => { await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.waitForSelector(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); await page.waitForSelector(selectors.invoiceOutIndex.topbarSearch); await page.waitForState('invoiceOut.index'); await page.waitToClick(selectors.invoiceOutIndex.createInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceClient, 'Petter Parker'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceSerial, 'Global nacional'); await page.autocompleteSearch(selectors.invoiceOutIndex.manualInvoiceTaxArea, 'national'); await page.waitToClick(selectors.invoiceOutIndex.saveInvoice); const message = await page.waitForSnackbar(); await page.waitForState('invoiceOut.card.summary'); expect(message.text).toContain('Data saved!'); }); });