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

68 lines
2.5 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');
});
it('should search for the user David Charles Haller', async () => {
let resultCount = await nightmare
.wait(selectors.clientsIndex.searchClientInput)
.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
.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');
});
});