From 7fce2e233c216942a29e7d35d1e64ead86211837 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Tue, 4 Jun 2019 07:57:01 +0200 Subject: [PATCH] #1455 e2e worker.timeControl --- e2e/helpers/selectors.js | 59 ++- .../03-worker-module/02_time_control.spec.js | 393 ++++++++++++++++++ package-lock.json | 112 +++-- 3 files changed, 514 insertions(+), 50 deletions(-) create mode 100644 e2e/paths/03-worker-module/02_time_control.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 9f7767a968..820e5b0174 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -555,11 +555,6 @@ export default { confirmOrder: 'vn-order-line > vn-vertical > vn-button-bar > vn-button > button', confirmButton: 'vn-order-line > vn-confirm button[response="ACCEPT"]', }, - workerPbx: { - extensionInput: 'vn-worker-pbx vn-input-number[model="$ctrl.worker.sip.extension"] input', - passwordInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.secret"] input', - saveButton: 'vn-worker-pbx vn-submit[label="Save"] input' - }, routeIndex: { addNewRouteButton: 'vn-route-index > a[ui-sref="route.create"]' }, @@ -594,5 +589,59 @@ export default { buscamanButton: 'vn-route-tickets vn-button[icon="icon-buscaman"]', firstTicketDeleteButton: 'vn-route-tickets vn-tr:nth-child(1) vn-icon[icon="delete"]', confirmButton: 'vn-route-tickets > vn-confirm button[response="ACCEPT"]' + }, + workerPbx: { + extensionInput: 'vn-worker-pbx vn-input-number[model="$ctrl.worker.sip.extension"] input', + passwordInput: 'vn-worker-pbx vn-textfield[model="$ctrl.worker.sip.secret"] input', + saveButton: 'vn-worker-pbx vn-submit[label="Save"] input' + }, + workerTimeControl: { + timeDialogInput: 'vn-worker-time-control > vn-dialog input', + mondayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(1) > vn-icon-button > button > vn-icon', + tuesdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(2) > vn-icon-button > button > vn-icon', + wednesdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(3) > vn-icon-button > button > vn-icon', + thursdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-icon-button > button > vn-icon', + fridayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(5) > vn-icon-button > button > vn-icon', + saturdayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(6) > vn-icon-button > button > vn-icon', + sundayAddTimeButton: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(7) > vn-icon-button > button > vn-icon', + confirmButton: 'vn-worker-time-control > vn-dialog > div > form > div.buttons > tpl-buttons > button', + firstEntryOfMonday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > span', + firstEntryOfTuesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(1) > span', + firstEntryOfWednesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(1) > span', + firstEntryOfThursday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(1) > span', + firstEntryOfFriday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(1) > span', + firstEntryOfSaturday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(1) > span', + firstEntryOfSunday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(1) > span', + secondEntryOfMonday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(2) > span', + secondEntryOfTuesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(2) > span', + secondEntryOfWednesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(2) > span', + secondEntryOfThursday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(2) > span', + secondEntryOfFriday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(2) > span', + secondEntryOfSaturday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(2) > span', + secondEntryOfSunday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(2) > span', + thirdEntryOfMonday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(3) > span', + thirdEntryOfTuesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(3) > span', + thirdEntryOfWednesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(3) > span', + thirdEntryOfThursday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(3) > span', + thirdEntryOfFriday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(3) > span', + thirdEntryOfSaturday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(3) > span', + thirdEntryOfSunday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(3) > span', + fourthEntryOfMonday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(4) > span', + fourthEntryOfTuesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(4) > span', + fourthEntryOfWednesday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(4) > span', + fourthEntryOfThursday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(4) > section:nth-child(4) > span', + fourthEntryOfFriday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(5) > section:nth-child(4) > span', + fourthEntryOfSaturday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(6) > section:nth-child(4) > span', + fourthEntryOfSunday: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(7) > section:nth-child(4) > span', + mondayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(1)', + tuesdayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(2)', + wednesdayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(3)', + thursdayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(4)', + fridayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(5)', + saturdayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(6)', + sundayWorkedHours: 'vn-worker-time-control > div > vn-card > div > vn-horizontal > vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(7)', + weekWorkedHours: 'vn-worker-time-control > div > vn-side-menu > div > vn-vertical > vn-vertical > vn-label-value > section > span', + nextMonthButton: 'vn-worker-time-control > div > vn-side-menu > div > vn-calendar > div > vn-horizontal > vn-auto:nth-child(3) > vn-icon', + navigateBackToIndex: 'vn-worker-descriptor vn-icon[icon="chevron_left"]' } }; diff --git a/e2e/paths/03-worker-module/02_time_control.spec.js b/e2e/paths/03-worker-module/02_time_control.spec.js new file mode 100644 index 0000000000..0e72f40d90 --- /dev/null +++ b/e2e/paths/03-worker-module/02_time_control.spec.js @@ -0,0 +1,393 @@ +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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .write(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) + .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 + .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); + + expect(wholeWeekHours).toEqual('56:00 Hours'); + }); + }); +}); diff --git a/package-lock.json b/package-lock.json index d72f1316b9..9652653a6f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1505,7 +1505,7 @@ }, "util": { "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", "dev": true, "requires": { @@ -1733,7 +1733,7 @@ "base": { "version": "0.11.2", "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha1-e95c7RRbbVUakNuH+DxVi060io8=", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, "requires": { "cache-base": "^1.0.1", @@ -2321,7 +2321,7 @@ "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha1-Cn9GQWgxyLZi7jb+TnxZ129marI=", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, "requires": { "collection-visit": "^1.0.0", @@ -2496,7 +2496,7 @@ "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha1-+TNprouafOAv1B+q0MqDAzGQxGM=", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -2656,7 +2656,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -3194,13 +3194,13 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true }, "regexpu-core": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz", "integrity": "sha1-hqdj9Y7k18L2sQLkdkBQ3n7ZDGs=", "dev": true, "requires": { @@ -3211,13 +3211,13 @@ }, "regjsgen": { "version": "0.2.0", - "resolved": "http://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", "dev": true }, "regjsparser": { "version": "0.1.5", - "resolved": "http://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", "dev": true, "requires": { @@ -3847,7 +3847,7 @@ "dependencies": { "fs-extra": { "version": "0.30.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", + "resolved": "http://registry.npmjs.org/fs-extra/-/fs-extra-0.30.0.tgz", "integrity": "sha1-8jP/zAjU2n1DLapEl3aYnbHfk/A=", "dev": true, "requires": { @@ -4844,7 +4844,7 @@ }, "file-loader": { "version": "1.1.11", - "resolved": "https://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", + "resolved": "http://registry.npmjs.org/file-loader/-/file-loader-1.1.11.tgz", "integrity": "sha512-TGR4HU7HUsGg6GCOPJnFk06RhWgEWFLAGWiT6rcD+GRC2keU3s9RGJ+b3Z6/U73jwwNb2gKLJ7YCrp+jvU4ALg==", "dev": true, "requires": { @@ -5181,7 +5181,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5596,7 +5597,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -5652,6 +5654,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5695,12 +5698,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -5902,7 +5907,7 @@ "global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha1-bXcPDrUjrHgWTXK15xqIdyZcw+o=", + "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", "dev": true, "requires": { "global-prefix": "^1.0.1", @@ -6254,7 +6259,7 @@ }, "kind-of": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/kind-of/-/kind-of-1.1.0.tgz", "integrity": "sha1-FAo9LUGjbS78+pN3tiwk+ElaXEQ=", "dev": true }, @@ -6438,7 +6443,7 @@ "dependencies": { "es6-promise": { "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "resolved": "http://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", "dev": true }, @@ -7453,7 +7458,7 @@ "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha1-LBY7P6+xtgbZ0Xko8FwqHDjgdnc=", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, "requires": { "isobject": "^3.0.1" @@ -7623,7 +7628,7 @@ }, "jasmine-core": { "version": "2.99.1", - "resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", + "resolved": "http://registry.npmjs.org/jasmine-core/-/jasmine-core-2.99.1.tgz", "integrity": "sha1-5kAN8ea1bhMLYcS80JPap/boyhU=", "dev": true }, @@ -7640,7 +7645,7 @@ "jasmine-spec-reporter": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/jasmine-spec-reporter/-/jasmine-spec-reporter-4.2.1.tgz", - "integrity": "sha1-HWMq7ANBZwrTJPkrqEtLMrNeniI=", + "integrity": "sha512-FZBoZu7VE5nR7Nilzy+Np8KuVIOxF4oXDPDknehCYBDE080EnlPu0afdZNmpGDBRCUBv3mj5qgqCRmk6W/K8vg==", "dev": true, "requires": { "colors": "1.1.2" @@ -9685,7 +9690,7 @@ }, "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" }, "minstache": { @@ -10157,7 +10162,7 @@ "dependencies": { "jsesc": { "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "resolved": "http://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", "dev": true } @@ -10787,7 +10792,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -10815,6 +10821,7 @@ "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -10829,7 +10836,8 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -10840,7 +10848,8 @@ "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -10957,7 +10966,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -10969,6 +10979,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -10983,6 +10994,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -10990,12 +11002,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -11014,6 +11028,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -11094,7 +11109,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -11106,6 +11122,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -11191,7 +11208,8 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -11227,6 +11245,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -11246,6 +11265,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -11289,12 +11309,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -11593,7 +11615,7 @@ "dependencies": { "minimist": { "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, @@ -12149,7 +12171,7 @@ }, "pretty-bytes": { "version": "1.0.4", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", + "resolved": "http://registry.npmjs.org/pretty-bytes/-/pretty-bytes-1.0.4.tgz", "integrity": "sha1-CiLoIQYJrTVUL4yNXSFZr/B1HIQ=", "dev": true, "requires": { @@ -12238,7 +12260,7 @@ }, "through2": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-0.2.3.tgz", + "resolved": "http://registry.npmjs.org/through2/-/through2-0.2.3.tgz", "integrity": "sha1-6zKE2k6jEbbMis42U3SKUqvyWj8=", "dev": true, "requires": { @@ -13129,7 +13151,7 @@ }, "safe-regex": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, "requires": { @@ -13254,7 +13276,7 @@ "dependencies": { "source-map": { "version": "0.4.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "resolved": "http://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", "dev": true, "requires": { @@ -13394,7 +13416,7 @@ "set-value": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha1-ca5KiPD+77v1LR6mBPP7MV67YnQ=", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -13581,7 +13603,7 @@ "snapdragon-node": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha1-bBdfhv8UvbByRWPo88GwIaKGhTs=", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true, "requires": { "define-property": "^1.0.0", @@ -13632,7 +13654,7 @@ "snapdragon-util": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha1-+VZHlIbyrNeXAGk/b3uAXkWrVuI=", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", "dev": true, "requires": { "kind-of": "^3.2.0" @@ -13988,7 +14010,7 @@ "split-string": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha1-fLCd2jqGWFcFxks5pkZgOGguj+I=", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, "requires": { "extend-shallow": "^3.0.0" @@ -14172,7 +14194,7 @@ }, "string_decoder": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "resolved": "http://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { @@ -15543,7 +15565,7 @@ "useragent": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/useragent/-/useragent-2.3.0.tgz", - "integrity": "sha1-IX+UOtVAyyEoZYqyP8lg9qiMmXI=", + "integrity": "sha512-4AoH4pxuSvHCjqLO04sU6U/uE65BYza8l/KKBS0b0hnUPWi+cQ2BpeTEwejCSx9SPV5/U03nniDTrWx5NrmKdw==", "dev": true, "requires": { "lru-cache": "4.1.x", @@ -16280,7 +16302,7 @@ }, "globby": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "dev": true, "requires": { @@ -16293,7 +16315,7 @@ "dependencies": { "pify": { "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }