2018-10-30 09:22:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
|
|
|
describe('Client log path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
2018-11-20 13:22:00 +00:00
|
|
|
nightmare
|
2018-12-02 23:45:34 +00:00
|
|
|
.loginAndModule('employee', 'client')
|
|
|
|
.accessToSearchResult('DavidCharlesHaller')
|
|
|
|
.accessToSection('client.card.basicData');
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should update the clients name', async() => {
|
2018-10-30 09:22:47 +00:00
|
|
|
let result = await nightmare
|
|
|
|
.clearInput(selectors.clientBasicData.nameInput)
|
2019-01-23 14:33:25 +00:00
|
|
|
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
2018-10-30 09:22:47 +00:00
|
|
|
.waitToClick(selectors.clientBasicData.saveButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-11 11:41:07 +00:00
|
|
|
it('should navigate to the log section', async() => {
|
2018-10-30 09:22:47 +00:00
|
|
|
let url = await nightmare
|
|
|
|
.waitToClick(selectors.clientLog.logButton)
|
|
|
|
.waitForURL('log')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
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() => {
|
2018-10-30 09:22:47 +00:00
|
|
|
let lastModificationPreviousValue = await nightmare
|
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-03-01 12:56:17 +00:00
|
|
|
let lastModificationPreviousValue = await nightmare
|
|
|
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
|
|
|
|
2018-10-30 09:22:47 +00:00
|
|
|
let lastModificationCurrentValue = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.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
|
|
|
});
|
|
|
|
});
|