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

47 lines
1.6 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Client log path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'client')
.accessToSearchResult('DavidCharlesHaller')
.accessToSection('client.card.basicData');
});
it('should update the clients name', async() => {
let result = await nightmare
.clearInput(selectors.clientBasicData.nameInput)
.write(selectors.clientBasicData.nameInput, 'this is a test')
.waitToClick(selectors.clientBasicData.saveButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should navigate to the log section', async() => {
let url = await nightmare
.waitToClick(selectors.clientLog.logButton)
.waitForURL('log')
.parsedUrl();
expect(url.hash).toContain('log');
});
it('should check the previous value of the last logged change', async() => {
let lastModificationPreviousValue = await nightmare
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
});
it('should check the current value of the last logged change', async() => {
let lastModificationCurrentValue = await nightmare
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
expect(lastModificationCurrentValue).toContain('this is a test');
});
});