2022-01-25 13:27:30 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
|
|
|
describe('Client defaulter path', () => {
|
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('insurance', 'client');
|
2022-02-25 09:34:17 +00:00
|
|
|
await page.accessToSection('client.defaulter');
|
2022-01-25 13:27:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should count the amount of clients in the turns section', async() => {
|
|
|
|
const result = await page.countElement(selectors.clientDefaulter.anyClient);
|
|
|
|
|
|
|
|
expect(result).toEqual(5);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check contain expected client', async() => {
|
|
|
|
const clientName =
|
|
|
|
await page.waitToGetProperty(selectors.clientDefaulter.firstClientName, 'innerText');
|
|
|
|
const salesPersonName =
|
|
|
|
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
|
|
|
|
2022-05-12 12:18:16 +00:00
|
|
|
expect(clientName).toEqual('Bruce Banner');
|
|
|
|
expect(salesPersonName).toEqual('developer');
|
2022-01-25 13:27:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should first observation not changed', async() => {
|
2022-05-12 12:18:16 +00:00
|
|
|
const expectedObservation = 'Meeting with Black Widow 21st 9am';
|
2022-01-25 13:27:30 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
|
|
|
|
|
2022-01-31 07:17:15 +00:00
|
|
|
expect(result).toContain(expectedObservation);
|
2022-01-25 13:27:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should not add empty observation', async() => {
|
|
|
|
await page.waitToClick(selectors.clientDefaulter.allDefaulterCheckbox);
|
|
|
|
|
|
|
|
await page.waitToClick(selectors.clientDefaulter.addObservationButton);
|
|
|
|
await page.write(selectors.clientDefaulter.observation, '');
|
|
|
|
await page.waitToClick(selectors.clientDefaulter.saveButton);
|
|
|
|
const message = await page.waitForSnackbar();
|
|
|
|
|
|
|
|
expect(message.text).toContain(`The message can't be empty`);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('shoul checked all defaulters', async() => {
|
|
|
|
await page.loginAndModule('insurance', 'client');
|
2022-02-25 09:34:17 +00:00
|
|
|
await page.accessToSection('client.defaulter');
|
2022-01-25 13:27:30 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.clientDefaulter.allDefaulterCheckbox);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should add observation for all clients', async() => {
|
|
|
|
await page.waitToClick(selectors.clientDefaulter.addObservationButton);
|
|
|
|
await page.write(selectors.clientDefaulter.observation, 'My new observation');
|
|
|
|
await page.waitToClick(selectors.clientDefaulter.saveButton);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should first observation changed', async() => {
|
|
|
|
const message = await page.waitForSnackbar();
|
2022-02-22 07:58:22 +00:00
|
|
|
await page.waitForSelector(selectors.clientDefaulter.firstObservation);
|
2022-02-01 07:49:56 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
|
2022-01-25 13:27:30 +00:00
|
|
|
|
|
|
|
expect(message.text).toContain('Observation saved!');
|
2022-01-31 07:17:15 +00:00
|
|
|
expect(result).toContain('My new observation');
|
2022-01-25 13:27:30 +00:00
|
|
|
});
|
|
|
|
});
|