import selectors from '../../helpers/selectors.js'; import openPage from '../../helpers/puppeteer'; describe('Client Add credit path', () => { let page; beforeAll(async() => { page = await openPage(); await page.loginAndModule('salesAssistant', 'client'); await page.accessToSearchResult('Hank Pym'); await page.accessToSection('client.card.credit.index'); }); afterAll(async() => { page.close(); }); it(`should click on the add credit button`, async() => { await page.waitToClick(selectors.clientCredit.addCreditFloatButton); await page.waitForURL('/credit/create'); const url = await page.parsedUrl(); expect(url.hash).toContain('/credit/create'); }); it(`should edit the credit`, async() => { await page.clearInput(selectors.clientCredit.creditInput); await page.write(selectors.clientCredit.creditInput, '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'); }); });