import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('InvoiceIn basic data path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('administrative', 'invoiceIn'); await page.accessToSearchResult('1'); await page.accessToSection('invoiceIn.card.basicData'); }); afterAll(async() => { await browser.close(); }); it(`should edit the invoiceIn basic data`, async() => { const now = new Date(); await page.pickDate(selectors.invoiceInBasicData.issued, now); await page.pickDate(selectors.invoiceInBasicData.operated, now); await page.autocompleteSearch(selectors.invoiceInBasicData.supplier, 'Verdnatura'); await page.clearInput(selectors.invoiceInBasicData.supplierRef); await page.write(selectors.invoiceInBasicData.supplierRef, '9999'); await page.pickDate(selectors.invoiceInBasicData.bookEntried, now); await page.pickDate(selectors.invoiceInBasicData.booked, now); await page.autocompleteSearch(selectors.invoiceInBasicData.currency, 'USD'); await page.autocompleteSearch(selectors.invoiceInBasicData.company, 'ORN'); await page.waitToClick(selectors.invoiceInBasicData.save); const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); }); it(`should confirm the invoiceIn supplier was edited`, async() => { await page.reloadSection('invoiceIn.card.basicData'); const result = await page.waitToGetProperty(selectors.invoiceInBasicData.supplier, 'value'); expect(result).toContain('Verdnatura'); }); it(`should confirm the invoiceIn supplierRef was edited`, async() => { const result = await page .waitToGetProperty(selectors.invoiceInBasicData.supplierRef, 'value'); expect(result).toEqual('9999'); }); it(`should confirm the invoiceIn currency was edited`, async() => { const result = await page .waitToGetProperty(selectors.invoiceInBasicData.currency, 'value'); expect(result).toEqual('USD'); }); it(`should confirm the invoiceIn company was edited`, async() => { const result = await page .waitToGetProperty(selectors.invoiceInBasicData.company, 'value'); expect(result).toEqual('ORN'); }); });