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); await page.waitForState('client.card.credit.create'); }); 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 message = await page.waitForSnackbar(); expect(message.text).toContain('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'); }); });