import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; describe('Client Add credit path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('salesAssistant', 'client'); await page.accessToSearchResult('Hank Pym'); await page.accessToSection('client.card.credit.index'); }); afterAll(async() => { await browser.close(); }); it(`should click on the add credit button`, async() => { await page.waitToClick(selectors.clientCredit.addCreditFloatButton); let url = await page.expectURL('/credit/create'); expect(url).toBe(true); }); it(`should edit the credit`, async() => { await page.clearInput(selectors.clientCredit.credit); await page.write(selectors.clientCredit.credit, '999'); await page.waitToClick(selectors.clientCredit.saveButton); const result = await page.waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it('should confirm the credit was updated', async() => { const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText'); expect(result).toContain(999); expect(result).toContain('salesAssistant'); }); });