salix/e2e/paths/02-client-module/13_log.spec.js

52 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-10-30 09:22:47 +00:00
import selectors from '../../helpers/selectors.js';
2019-12-12 07:37:35 +00:00
import openPage from '../../helpers/puppeteer';
2018-10-30 09:22:47 +00:00
describe('Client log path', () => {
const nightmare = createNightmare();
beforeAll(() => {
2018-11-20 13:22:00 +00:00
nightmare
.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
.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
.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
});
});