#1185 cambiar e2e client log
This commit is contained in:
parent
acbe9b8488
commit
ea3328756b
|
@ -151,6 +151,7 @@ export default {
|
||||||
},
|
},
|
||||||
clientLog: {
|
clientLog: {
|
||||||
logButton: `vn-left-menu a[ui-sref="client.card.log"]`,
|
logButton: `vn-left-menu a[ui-sref="client.card.log"]`,
|
||||||
|
lastModificationDate: 'vn-client-log > vn-log vn-table vn-tbody > vn-tr > vn-td:nth-child(1)',
|
||||||
lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before',
|
lastModificationPreviousValue: 'vn-client-log vn-table vn-td.before',
|
||||||
lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after'
|
lastModificationCurrentValue: 'vn-client-log vn-table vn-td.after'
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import createNightmare from '../../helpers/nightmare';
|
||||||
describe('Client log path', () => {
|
describe('Client log path', () => {
|
||||||
const nightmare = createNightmare();
|
const nightmare = createNightmare();
|
||||||
|
|
||||||
|
let date;
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
nightmare
|
nightmare
|
||||||
.loginAndModule('employee', 'client')
|
.loginAndModule('employee', 'client')
|
||||||
|
@ -17,6 +19,7 @@ describe('Client log path', () => {
|
||||||
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
.write(selectors.clientBasicData.nameInput, 'this is a test')
|
||||||
.waitToClick(selectors.clientBasicData.saveButton)
|
.waitToClick(selectors.clientBasicData.saveButton)
|
||||||
.waitForLastSnackbar();
|
.waitForLastSnackbar();
|
||||||
|
date = new Date();
|
||||||
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
});
|
});
|
||||||
|
@ -38,9 +41,33 @@ describe('Client log path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the current value of the last logged change', async() => {
|
it('should check the current value of the last logged change', async() => {
|
||||||
|
let lastModificationDate = await nightmare
|
||||||
|
.waitToGetProperty(selectors.clientLog.lastModificationDate, 'innerText');
|
||||||
|
|
||||||
|
let lastModificationPreviousValue = await nightmare
|
||||||
|
.waitToGetProperty(selectors.clientLog.lastModificationPreviousValue, 'innerText');
|
||||||
|
|
||||||
let lastModificationCurrentValue = await nightmare
|
let lastModificationCurrentValue = await nightmare
|
||||||
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
.waitToGetProperty(selectors.clientLog.lastModificationCurrentValue, 'innerText');
|
||||||
|
|
||||||
expect(lastModificationCurrentValue).toContain('this is a test');
|
let month = date.getMonth() + 1;
|
||||||
|
let day = date.getDate();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let hours = date.getHours();
|
||||||
|
let minutes = date.getMinutes();
|
||||||
|
|
||||||
|
if (month.toString().length < 2) month = '0' + month;
|
||||||
|
if (day.toString().length < 2) day = `0${day}`;
|
||||||
|
if (hours.toString().length < 2) month = '0' + hours;
|
||||||
|
if (minutes.toString().length < 2) day = `0${minutes}`;
|
||||||
|
|
||||||
|
let today = [day, month, year].join('/');
|
||||||
|
let time = [hours, minutes].join(':');
|
||||||
|
|
||||||
|
let now = [today, time].join(' ');
|
||||||
|
|
||||||
|
expect(lastModificationDate).toContain(now);
|
||||||
|
expect(lastModificationPreviousValue).toEqual('name: DavidCharlesHaller');
|
||||||
|
expect(lastModificationCurrentValue).toEqual('name: this is a test');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue