2020-01-14 08:20:14 +00:00
|
|
|
import selectors from '../../helpers/selectors';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-10-30 09:22:47 +00:00
|
|
|
|
2020-01-30 10:23:13 +00:00
|
|
|
describe('Client log 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('employee', 'client');
|
|
|
|
await page.accessToSearchResult('DavidCharlesHaller');
|
|
|
|
await page.accessToSection('client.card.basicData');
|
|
|
|
});
|
2018-10-30 09:22:47 +00:00
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:40:50 +00:00
|
|
|
await browser.close();
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should update the clients name', async() => {
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.clearInput(selectors.clientBasicData.name);
|
|
|
|
await page.write(selectors.clientBasicData.name, 'this is a test');
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientBasicData.saveButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-10-30 09:22:47 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should navigate to the log section', async() => {
|
2020-04-02 16:55:07 +00:00
|
|
|
await page.accessToSection('client.card.log');
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should check the previous value of the last logged change', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
let lastModificationPreviousValue = await page
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
2018-10-30 09:22:47 +00:00
|
|
|
|
|
|
|
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
|
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should check the current value of the last logged change', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
let lastModificationPreviousValue = await page
|
2019-03-01 12:56:17 +00:00
|
|
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
|
|
|
|
2019-12-31 11:00:16 +00:00
|
|
|
let lastModificationCurrentValue = await page.
|
|
|
|
waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
2018-10-30 09:22:47 +00:00
|
|
|
|
2021-05-19 12:14:04 +00:00
|
|
|
expect(lastModificationPreviousValue).toEqual('name DavidCharlesHaller');
|
|
|
|
expect(lastModificationCurrentValue).toEqual('name this is a test');
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
});
|