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

50 lines
1.8 KiB
JavaScript

import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer';
describe('Client log path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'client');
await page.accessToSearchResult('DavidCharlesHaller');
await page.accessToSection('client.card.basicData');
});
afterAll(async() => {
await browser.close();
});
it('should update the clients name', async() => {
await page.clearInput(selectors.clientBasicData.name);
await page.write(selectors.clientBasicData.name, 'this is a test');
await page.waitToClick(selectors.clientBasicData.saveButton);
const message = await page.waitForSnackbar();
expect(message.type).toBe('success');
});
it('should navigate to the log section', async() => {
await page.accessToSection('client.card.log');
});
it('should check the previous value of the last logged change', async() => {
let lastModificationPreviousValue = await page
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
expect(lastModificationPreviousValue).toContain('DavidCharlesHaller');
});
it('should check the current value of the last logged change', async() => {
let lastModificationPreviousValue = await page
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
let lastModificationCurrentValue = await page.
waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
expect(lastModificationCurrentValue).toEqual('name: this is a test');
});
});