From aa5ff474ec62d1f3967ca251bfa4ae61f896f2f6 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 11 Mar 2022 12:21:39 +0100 Subject: [PATCH] solved test e2e --- e2e/helpers/selectors.js | 1 + e2e/paths/03-worker/04_time_control.spec.js | 38 +++++++++++-------- e2e/paths/05-ticket/05_tracking_state.spec.js | 2 +- .../01_create_and_basic_data.spec.js | 2 +- loopback/locale/es.json | 3 +- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d5b075e13..54c2274e7 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -898,6 +898,7 @@ export default { sundayWorkedHours: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(1) > vn-td:nth-child(7)', weekWorkedHours: 'vn-worker-time-control vn-side-menu vn-label-value > section > span', nextMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_right]', + previousMonthButton: 'vn-worker-time-control vn-side-menu vn-calendar vn-button[icon=keyboard_arrow_left]', secondWeekDay: 'vn-worker-time-control vn-side-menu vn-calendar .day:nth-child(8) > .day-number', navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]' }, diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index 3f5653aee..5709e6207 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -10,6 +10,8 @@ describe('Worker time control path', () => { await page.loginAndModule('salesBoss', 'worker'); await page.accessToSearchResult('HankPym'); await page.accessToSection('worker.card.timeControl'); + await page.waitToClick(selectors.workerTimeControl.previousMonthButton); + await page.waitToClick(selectors.workerTimeControl.secondWeekDay); }); afterAll(async() => { @@ -98,8 +100,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 7 hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.'); + it(`should check Hank Pym worked 6:40 hours`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '06:40 h.'); }); }); @@ -152,8 +154,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 happy hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.'); + it(`should check Hank Pym worked 7:40 hours`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '07:40 h.'); }); }); @@ -206,8 +208,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 cheerfull hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.'); + it(`should check Hank Pym worked 7:40 cheerfull hours`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '07:40 h.'); }); }); @@ -257,8 +259,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 joyfull hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.'); + it(`should check Hank Pym worked 7:40 joyfull hours`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '07:40 h.'); }); }); @@ -307,8 +309,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 hours with a smile on his face`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.'); + it(`should check Hank Pym worked 7:40 hours with a smile on his face`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '07:40 h.'); }); }); }); @@ -327,6 +329,8 @@ describe('Worker time control path', () => { it('should access to the time control section', async() => { await page.accessToSection('worker.card.timeControl'); await page.waitForState('worker.card.timeControl'); + await page.waitToClick(selectors.workerTimeControl.previousMonthButton); + await page.waitToClick(selectors.workerTimeControl.secondWeekDay); }); it('should lovingly scan in Hank Pym', async() => { @@ -352,8 +356,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 hours with all his will`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.'); + it(`should check Hank Pym worked 7:40 hours with all his will`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '07:40 h.'); }); }); @@ -380,11 +384,11 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - it(`should check Hank Pym worked 8 glad hours`, async() => { - await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.'); + it(`should check Hank Pym worked 7:40 glad hours`, async() => { + await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '07:40 h.'); }); - it(`should check Hank Pym doesn't have hours set on the next months first week`, async() => { + it(`should check Hank Pym doesn't have hours set on the next months second week`, async() => { await page.waitToClick(selectors.workerTimeControl.nextMonthButton); await page.waitToClick(selectors.workerTimeControl.secondWeekDay); await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.'); @@ -408,10 +412,12 @@ describe('Worker time control path', () => { await page.loginAndModule('HankPym', 'worker'); await page.accessToSearchResult('HankPym'); await page.accessToSection('worker.card.timeControl'); + await page.waitToClick(selectors.workerTimeControl.previousMonthButton); + await page.waitToClick(selectors.workerTimeControl.secondWeekDay); }); it('should check his weekly hours are alright', async() => { - await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.'); + await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '52:40 h.'); }); }); }); diff --git a/e2e/paths/05-ticket/05_tracking_state.spec.js b/e2e/paths/05-ticket/05_tracking_state.spec.js index 7978cf85c..949c9a8e6 100644 --- a/e2e/paths/05-ticket/05_tracking_state.spec.js +++ b/e2e/paths/05-ticket/05_tracking_state.spec.js @@ -25,7 +25,7 @@ describe('Ticket Create new tracking state path', () => { }); it(`should create a new state`, async() => { - await page.autocompleteSearch(selectors.createStateView.state, '¿Fecha?'); + await page.autocompleteSearch(selectors.createStateView.state, 'OK'); await page.waitToClick(selectors.createStateView.saveStateButton); const message = await page.waitForSnackbar(); diff --git a/e2e/paths/14-account/01_create_and_basic_data.spec.js b/e2e/paths/14-account/01_create_and_basic_data.spec.js index 42d5b2f68..4048413ba 100644 --- a/e2e/paths/14-account/01_create_and_basic_data.spec.js +++ b/e2e/paths/14-account/01_create_and_basic_data.spec.js @@ -80,7 +80,7 @@ describe('Account create and basic data path', () => { await page.reloadSection('account.card.roles'); const rolesCount = await page.countElement(selectors.accountRoles.anyResult); - expect(rolesCount).toEqual(35); + expect(rolesCount).toEqual(61); }); }); diff --git a/loopback/locale/es.json b/loopback/locale/es.json index 856ee57d8..3b926cc7f 100644 --- a/loopback/locale/es.json +++ b/loopback/locale/es.json @@ -219,5 +219,6 @@ "You can not modify is pay method checked": "No se puede modificar el campo método de pago validado", "Can't transfer claimed sales": "No puedes transferir lineas reclamadas", "You don't have privileges to create pay back": "No tienes permisos para crear un abono", - "The item is required": "El artículo es requerido" + "The item is required": "El artículo es requerido", + "date in the future": "Fecha en el futuro" } \ No newline at end of file