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-11-23 07:05:57 +00:00
|
|
|
.loginAndModule('employee', 'client');
|
2018-10-30 09:22:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the user David Charles Haller', async () => {
|
|
|
|
let resultCount = await nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.clientsIndex.searchClientInput)
|
2018-10-30 09:22:47 +00:00
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'DavidCharlesHaller')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.clientsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result to access to the client's fiscal data`, async () => {
|
|
|
|
let url = await nightmare
|
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'DavidCharlesHaller')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.waitForURL('basic-data')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('basic-data');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should update the clients name', async () => {
|
|
|
|
let result = await nightmare
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.clearInput(selectors.clientBasicData.nameInput)
|
|
|
|
.type(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
|
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');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the current value of the last logged change', async () => {
|
|
|
|
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
|
|
|
|
|
|
|
expect(lastModificationCurrentValue).toContain('this is a test');
|
|
|
|
});
|
|
|
|
});
|