Merge branch '2145_e2e_linux_fix' of https://gitea.verdnatura.es/verdnatura/salix into 2145_e2e_linux_fix

This commit is contained in:
Bernat 2020-03-10 08:27:34 +01:00
commit ea46d19403
3 changed files with 42 additions and 29 deletions

View File

@ -532,6 +532,22 @@ let actions = {
// $rootScope.$on('$viewContentLoaded', resolve());
// });
// });
},
respondToDialog: async function(response) {
await this.waitForSelector('.vn-dialog.vn-popup.shown');
const firstCount = await this.evaluate(response => {
const dialogs = document.querySelectorAll('.vn-dialog.vn-popup');
const dialogOnTop = dialogs[dialogs.length - 1];
const button = dialogOnTop.querySelector(`div.buttons [response="${response}"]`);
button.click();
return dialogs.length;
}, response);
this.waitForFunction(count => {
let currentCount = document.querySelectorAll('.vn-dialog.vn-popup').length;
return currentCount < count;
}, {}, firstCount);
}
};

View File

@ -742,7 +742,6 @@ export default {
fridayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(5) > vn-icon-button',
saturdayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(6) > vn-icon-button',
sundayAddTimeButton: 'vn-worker-time-control vn-table > div > vn-tfoot > vn-tr:nth-child(2) > vn-td:nth-child(7) > vn-icon-button',
confirmButton: '.vn-dialog.shown tpl-buttons > button',
firstEntryOfMonday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(1) > section:nth-child(1) > vn-chip > div',
firstEntryOfTuesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > section:nth-child(1) > vn-chip > div',
firstEntryOfWednesday: 'vn-worker-time-control vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(3) > section:nth-child(1) > vn-chip > div',

View File

@ -23,7 +23,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
@ -34,7 +34,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
@ -45,7 +45,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
@ -56,7 +56,7 @@ fdescribe('Worker time control path', () => {
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog);
await page.respondToDialog('accept');
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Entry removed');
@ -67,7 +67,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
@ -76,10 +76,9 @@ fdescribe('Worker time control path', () => {
it(`should add the break's scan in for Hank Pym and be in the right order`, async() => {
const scanTime = '10:20';
await page.waitFor(1000);
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
expect(result).toEqual('14:00');
@ -109,7 +108,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
@ -120,7 +119,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
@ -131,7 +130,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
@ -142,7 +141,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
@ -162,7 +161,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
@ -173,7 +172,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
@ -184,7 +183,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
@ -195,7 +194,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
@ -215,7 +214,7 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
@ -225,7 +224,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
@ -235,7 +234,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
@ -245,7 +244,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '17:59';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
@ -264,7 +263,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '07:30';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
@ -274,7 +273,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
@ -284,7 +283,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
@ -294,7 +293,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '15:30';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime);
@ -325,7 +324,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '06:00';
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
expect(result).toEqual(scanTime);
@ -335,7 +334,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '13:40';
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
expect(result).toEqual(scanTime);
@ -354,7 +353,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '05:00';
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime);
@ -364,7 +363,7 @@ fdescribe('Worker time control path', () => {
const scanTime = '12:40';
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
await page.respondToDialog('accept');
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime);
@ -391,7 +390,6 @@ fdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
await page.accessToSearchResult('salesBoss');
await page.accessToSection('worker.card.timeControl');
await page.waitFor(1000);
const wholeWeekHours = await page
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');