This commit is contained in:
parent
81c7fff7e2
commit
3514c0ac81
|
@ -21,70 +21,99 @@ describe('Worker time control path', () => {
|
|||
const fourPm = '16:00';
|
||||
const hankPymId = 1107;
|
||||
|
||||
it(`should go to the next month, go to current month, go 1 month in the past, return error when insert 'out' of first entry, then insert 'in' monday, then insert 'out' monday, then check if Hank Pym worked 8:20 hours, remove first entry of monday, be the 'out' the first entry of monday and change week of month`, async() => {
|
||||
it('should go to the next month, go to current month and go 1 month in the past', async() => {
|
||||
let date = new Date();
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let month = date.toLocaleString('default', {month: 'long'});
|
||||
|
||||
await page.click(selectors.workerTimeControl.nextMonthButton);
|
||||
let result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.monthName, 'innerText')).toContain(month);
|
||||
expect(result).toContain(month);
|
||||
|
||||
date = new Date();
|
||||
month = date.toLocaleString('default', {month: 'long'});
|
||||
|
||||
await page.click(selectors.workerTimeControl.previousMonthButton);
|
||||
result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.monthName, 'innerText')).toContain(month);
|
||||
expect(result).toContain(month);
|
||||
|
||||
date = new Date();
|
||||
date.setMonth(date.getMonth() - 1);
|
||||
month = date.toLocaleString('default', {month: 'long'});
|
||||
const timestamp = Math.round(date.getTime() / 1000);
|
||||
month = date.toLocaleString('default', {month: 'long'});
|
||||
|
||||
await page.loginAndModule('salesBoss', 'worker');
|
||||
await page.goto(`http://localhost:5000/#!/worker/${hankPymId}/time-control?timestamp=${timestamp}`);
|
||||
await page.click(selectors.workerTimeControl.secondWeekDay);
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.monthName, 'innerText')).toContain(month);
|
||||
result = await page.getProperty(selectors.workerTimeControl.monthName, 'innerText');
|
||||
|
||||
await page.click(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
expect(result).toContain(month);
|
||||
});
|
||||
|
||||
it(`should return error when insert 'out' of first entry`, async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4707');
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
|
||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
||||
await page.respondToDialog('accept');
|
||||
let message = await page.waitForSnackbar();
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toBeDefined();
|
||||
});
|
||||
|
||||
await page.click(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
it(`should insert 'in' monday`, async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4707');
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
|
||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
||||
await page.respondToDialog('accept');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText')).toEqual(eightAm);
|
||||
expect(result).toEqual(eightAm);
|
||||
});
|
||||
|
||||
await page.click(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
it(`should insert 'out' monday`, async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4707');
|
||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm);
|
||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
||||
await page.respondToDialog('accept');
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText')).toEqual(fourPm);
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText')).toBe('08:20 h.');
|
||||
expect(await page.getProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText')).toBe('08:20 h.');
|
||||
expect(await page.getProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText')).toBe(eightAm);
|
||||
expect(await page.getProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText')).toBe(fourPm);
|
||||
await page.click(selectors.workerTimeControl.firstEntryOfMondayDelete);
|
||||
await page.respondToDialog('accept');
|
||||
message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Entry removed');
|
||||
|
||||
const result = await page.getProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(fourPm);
|
||||
});
|
||||
|
||||
it(`should check Hank Pym worked 8:20 hours`, async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4707');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.');
|
||||
});
|
||||
|
||||
it('should remove first entry of monday', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4707');
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm);
|
||||
await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm);
|
||||
await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete);
|
||||
await page.respondToDialog('accept');
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Entry removed');
|
||||
});
|
||||
|
||||
it(`should be the 'out' the first entry of monday`, async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/4707');
|
||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
||||
|
||||
expect(result).toEqual(fourPm);
|
||||
});
|
||||
|
||||
it('should change week of month', async() => {
|
||||
await page.click(selectors.workerTimeControl.thrirdWeekDay);
|
||||
const result = await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
||||
|
||||
expect(await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText')).toBe('00:00 h.');
|
||||
expect(result).toEqual('00:00 h.');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue