396 lines
19 KiB
JavaScript
396 lines
19 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
describe('Worker time control path', () => {
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
|
nightmare
|
|
.loginAndModule('hr', 'worker')
|
|
.accessToSearchResult('HankPym')
|
|
.accessToSection('worker.card.timeControl');
|
|
});
|
|
|
|
describe('as HHRR', () => {
|
|
describe('on Monday', () => {
|
|
it('should scan in Hank Pym', async() => {
|
|
const scanTime = '07:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should scan out Hank Pym for break`, async() => {
|
|
const scanTime = '10:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should scan out Hank Pym and forget to scan in from the break`, async() => {
|
|
const scanTime = '15:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
|
|
const scanTime = '10:20';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
|
|
|
expect(result).toEqual('15:00');
|
|
});
|
|
|
|
it(`should the third entry be the scan in from break`, async() => {
|
|
const scanTime = '10:20';
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 hours`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
});
|
|
|
|
describe('on Tuesday', () => {
|
|
it('should happily scan in Hank Pym', async() => {
|
|
const scanTime = '08:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should happily scan out Hank Pym for break`, async() => {
|
|
const scanTime = '10:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should happily scan in Hank Pym from the break`, async() => {
|
|
const scanTime = '10:20';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should happily scan out Hank Pym for the day`, async() => {
|
|
const scanTime = '16:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
});
|
|
|
|
describe('on Wednesday', () => {
|
|
it('should cheerfully scan in Hank Pym', async() => {
|
|
const scanTime = '09:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
|
const scanTime = '10:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
|
const scanTime = '10:20';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
|
const scanTime = '17:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
});
|
|
|
|
describe('on Thursday', () => {
|
|
it('should joyfully scan in Hank Pym', async() => {
|
|
const scanTime = '09:59';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should joyfully scan out Hank Pym for break`, async() => {
|
|
const scanTime = '10:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
|
const scanTime = '10:20';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
|
const scanTime = '17:59';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
});
|
|
|
|
describe('on Friday', () => {
|
|
it('should smilingly scan in Hank Pym', async() => {
|
|
const scanTime = '07:30';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should smilingly scan out Hank Pym for break`, async() => {
|
|
const scanTime = '10:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
|
const scanTime = '10:20';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
|
const scanTime = '15:30';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('as salesBoss', () => {
|
|
describe('on Saturday', () => {
|
|
beforeAll(() => {
|
|
nightmare
|
|
.loginAndModule('salesBoss', 'worker')
|
|
.accessToSearchResult('HankPym')
|
|
.accessToSection('worker.card.timeControl');
|
|
});
|
|
|
|
it('should lovingly scan in Hank Pym', async() => {
|
|
const scanTime = '06:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should lovingly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
|
const scanTime = '13:40';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
});
|
|
|
|
describe('on Sunday', () => {
|
|
it('should gladly scan in Hank Pym', async() => {
|
|
const scanTime = '05:00';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should gladly scan out Hank Pym for the day with no break to leave a bit early`, async() => {
|
|
const scanTime = '12:40';
|
|
const result = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
|
|
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
|
|
.waitToClick(selectors.workerTimeControl.confirmButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
|
|
|
expect(result).toEqual(scanTime);
|
|
});
|
|
|
|
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
|
const result = await nightmare
|
|
.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
|
|
|
|
expect(result).toEqual('08:00 h.');
|
|
});
|
|
|
|
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
|
const wholeWeekHours = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
|
.waitToClick(selectors.workerTimeControl.nextMonthButton)
|
|
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
|
|
|
expect(wholeWeekHours).toEqual('00:00 Hours');
|
|
});
|
|
|
|
it(`should check he didn't scan in this week yet`, async() => {
|
|
const wholeWeekHours = await nightmare
|
|
.waitToClick(selectors.workerTimeControl.navigateBackToIndex)
|
|
.accessToSearchResult('salesBoss')
|
|
.accessToSection('worker.card.timeControl')
|
|
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
|
|
|
expect(wholeWeekHours).toEqual('00:00 Hours');
|
|
});
|
|
});
|
|
});
|
|
|
|
describe('after all this amazing week', () => {
|
|
beforeAll(() => {
|
|
nightmare
|
|
.loginAndModule('HankPym', 'worker')
|
|
.accessToSearchResult('HankPym')
|
|
.accessToSection('worker.card.timeControl');
|
|
});
|
|
|
|
it('should Hank Pym check his hours are alright', async() => {
|
|
const wholeWeekHours = await nightmare
|
|
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '56:00 Hours')
|
|
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
|
|
|
expect(wholeWeekHours).toEqual('56:00 Hours');
|
|
});
|
|
});
|
|
});
|