2019-06-04 05:57:01 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-06-04 05:57:01 +00:00
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
describe('Worker time control path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('salesBoss', 'worker');
|
|
|
|
await page.accessToSearchResult('HankPym');
|
|
|
|
await page.accessToSection('worker.card.timeControl');
|
|
|
|
});
|
2019-06-04 05:57:01 +00:00
|
|
|
|
2020-01-14 08:24:09 +00:00
|
|
|
afterAll(async() => {
|
2020-01-14 08:41:49 +00:00
|
|
|
await browser.close();
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
|
2020-01-14 08:24:09 +00:00
|
|
|
describe('as salesBoss', () => {
|
2019-06-04 05:57:01 +00:00
|
|
|
describe('on Monday', () => {
|
|
|
|
it('should scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '07:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should scan out Hank Pym for break`, async() => {
|
|
|
|
const scanTime = '10:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
2019-11-14 13:20:05 +00:00
|
|
|
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
|
|
|
|
const scanTime = '18:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
2019-11-14 13:20:05 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should delete the wrong entry for Hank Pym`, async() => {
|
|
|
|
const wrongScanTime = '18:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-11-14 13:20:05 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Entry removed');
|
2019-11-14 13:20:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should scan out Hank Pym to leave early`, async() => {
|
|
|
|
const scanTime = '14:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
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';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
2019-11-14 13:20:05 +00:00
|
|
|
expect(result).toEqual('14:00');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should the third entry be the scan in from break`, async() => {
|
|
|
|
const scanTime = '10:20';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
const result = await page
|
2019-06-04 05:57:01 +00:00
|
|
|
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
|
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
2020-10-28 08:44:33 +00:00
|
|
|
it(`should check Hank Pym worked 7 hours`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('on Tuesday', () => {
|
|
|
|
it('should happily scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '08:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should happily scan out Hank Pym for break`, async() => {
|
|
|
|
const scanTime = '10:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should happily scan in Hank Pym from the break`, async() => {
|
|
|
|
const scanTime = '10:20';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should happily scan out Hank Pym for the day`, async() => {
|
|
|
|
const scanTime = '16:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym worked 8 happy hours`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('on Wednesday', () => {
|
|
|
|
it('should cheerfully scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '09:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should cheerfully scan out Hank Pym for break`, async() => {
|
|
|
|
const scanTime = '10:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should cheerfully scan in Hank Pym from the break`, async() => {
|
|
|
|
const scanTime = '10:20';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should cheerfully scan out Hank Pym for the day`, async() => {
|
|
|
|
const scanTime = '17:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('on Thursday', () => {
|
|
|
|
it('should joyfully scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '09:59';
|
2020-01-14 08:24:09 +00:00
|
|
|
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should joyfully scan out Hank Pym for break`, async() => {
|
|
|
|
const scanTime = '10:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should joyfully scan in Hank Pym from the break`, async() => {
|
|
|
|
const scanTime = '10:20';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should joyfully scan out Hank Pym for the day`, async() => {
|
|
|
|
const scanTime = '17:59';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('on Friday', () => {
|
|
|
|
it('should smilingly scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '07:30';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should smilingly scan out Hank Pym for break`, async() => {
|
|
|
|
const scanTime = '10:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should smilingly scan in Hank Pym from the break`, async() => {
|
|
|
|
const scanTime = '10:20';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'intermediate');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should smilingly scan out Hank Pym for the day`, async() => {
|
|
|
|
const scanTime = '15:30';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2020-01-14 08:24:09 +00:00
|
|
|
describe('as HHRR', () => {
|
2019-06-04 05:57:01 +00:00
|
|
|
describe('on Saturday', () => {
|
2020-03-17 15:26:17 +00:00
|
|
|
it('should log in as hr and pick the worker module', async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.loginAndModule('hr', 'worker');
|
2020-03-17 15:26:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for a worker and access to its summary', async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.accessToSearchResult('HankPym');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('worker.card.summary');
|
2020-03-17 15:26:17 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should access to the time control section', async() => {
|
2020-03-17 10:00:16 +00:00
|
|
|
await page.accessToSection('worker.card.timeControl');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('worker.card.timeControl');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should lovingly scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '06:00';
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.waitForTimeout(1000); // without this timeout the dialog doesn't pop up
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
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';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym worked 8 hours with all his will`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('on Sunday', () => {
|
|
|
|
it('should gladly scan in Hank Pym', async() => {
|
|
|
|
const scanTime = '05:00';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
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';
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
|
2021-06-18 14:37:50 +00:00
|
|
|
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, scanTime);
|
|
|
|
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
2020-02-28 08:59:32 +00:00
|
|
|
await page.respondToDialog('accept');
|
2020-01-14 08:24:09 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
|
2019-06-04 05:57:01 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(scanTime);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym worked 8 glad hours`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
|
|
|
|
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
|
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check he didn't scan in this week yet`, async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
|
|
|
|
await page.accessToSearchResult('salesBoss');
|
2020-01-16 12:40:51 +00:00
|
|
|
await page.accessToSection('worker.card.timeControl');
|
|
|
|
|
2020-01-14 08:24:09 +00:00
|
|
|
const wholeWeekHours = await page
|
2019-06-04 05:57:01 +00:00
|
|
|
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
|
|
|
|
|
2019-10-23 16:39:44 +00:00
|
|
|
expect(wholeWeekHours).toEqual('00:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('after all this amazing week', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
it('should log in Hank', async() => {
|
|
|
|
await page.loginAndModule('HankPym', 'worker');
|
|
|
|
await page.accessToSearchResult('HankPym');
|
|
|
|
await page.accessToSection('worker.card.timeControl');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
|
2020-10-28 08:44:33 +00:00
|
|
|
it('should check his weekly hours are alright', async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.');
|
2019-06-04 05:57:01 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|