2020-01-14 08:20:14 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-01-08 07:12:39 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
describe('Client Add credit path', () => {
|
2020-01-14 08:20:14 +00:00
|
|
|
let browser;
|
2019-12-31 11:00:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:20:14 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.loginAndModule('salesAssistant', 'client');
|
|
|
|
await page.accessToSearchResult('Hank Pym');
|
|
|
|
await page.accessToSection('client.card.credit.index');
|
|
|
|
});
|
2018-01-08 07:12:39 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:40:50 +00:00
|
|
|
await browser.close();
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
2018-01-08 07:12:39 +00:00
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it(`should click on the add credit button`, async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientCredit.addCreditFloatButton);
|
2020-02-04 15:21:10 +00:00
|
|
|
let url = await page.expectURL('/credit/create');
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2020-02-04 15:21:10 +00:00
|
|
|
expect(url).toBe(true);
|
2018-11-20 13:22:00 +00:00
|
|
|
});
|
2018-01-08 07:12:39 +00:00
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it(`should edit the credit`, async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientCredit.credit);
|
|
|
|
await page.write(selectors.clientCredit.credit, '999');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientCredit.saveButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
2018-01-08 07:12:39 +00:00
|
|
|
|
2019-01-16 14:02:50 +00:00
|
|
|
it('should confirm the credit was updated', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientCredit.firstCreditText, 'innerText');
|
2018-10-30 07:51:18 +00:00
|
|
|
|
2018-11-20 13:22:00 +00:00
|
|
|
expect(result).toContain(999);
|
|
|
|
expect(result).toContain('salesAssistant');
|
2018-01-08 07:12:39 +00:00
|
|
|
});
|
|
|
|
});
|