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');
|
|
|
|
await page.accessToSection('client.defaulter.index');
|
|
|
|
});
|
|
|
|
|
|
|
|
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');
|
|
|
|
|
|
|
|
expect(clientName).toEqual('Ororo Munroe');
|
2022-02-22 07:58:22 +00:00
|
|
|
expect(salesPersonName).toEqual('salesPersonNick');
|
2022-01-25 13:27:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should first observation not changed', async() => {
|
|
|
|
const expectedObservation = 'Madness, as you know, is like gravity, all it takes is a little push';
|
|
|
|
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');
|
|
|
|
await page.accessToSection('client.defaulter.index');
|
|
|
|
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|