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() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.clearInput(selectors.clientBasicData.nameInput);
|
|
|
|
await page.write(selectors.clientBasicData.nameInput, 'this is a test');
|
|
|
|
await page.waitToClick(selectors.clientBasicData.saveButton);
|
|
|
|
let result = await page.waitForLastSnackbar();
|
2018-10-30 09:22:47 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should navigate to the log section', async() => {
|
2019-12-31 11:00:16 +00:00
|
|
|
await page.waitToClick(selectors.clientLog.logButton);
|
|
|
|
await page.waitForURL('log');
|
|
|
|
let url = await page.parsedUrl();
|
2018-10-30 09:22:47 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('log');
|
|
|
|
});
|
|
|
|
|
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
|
|
|
|
2019-03-01 12:56:17 +00:00
|
|
|
|
|
|
|
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
|
|
|
expect(lastModificationCurrentValue).toEqual('name: this is a test');
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
});
|