Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1992-goWhenOneResult

This commit is contained in:
Juan Ferrer 2020-03-18 13:54:20 +01:00
commit bac3a4a30d
11 changed files with 131 additions and 119 deletions

View File

@ -1,5 +1,46 @@
import {url as defaultURL} from './config'; import {url as defaultURL} from './config';
function checkVisibility(selector) {
let selectorMatches = document.querySelectorAll(selector);
let element = selectorMatches[0];
if (selectorMatches.length > 1)
throw new Error(`Multiple matches of ${selector} found`);
let isVisible = false;
if (element) {
let eventHandler = event => {
event.preventDefault();
isVisible = true;
};
element.addEventListener('mouseover', eventHandler);
let rect = element.getBoundingClientRect();
let x = rect.left + rect.width / 2;
let y = rect.top + rect.height / 2;
let elementInCenter = document.elementFromPoint(x, y);
let elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
let e = new MouseEvent('mouseover', {
view: window,
bubbles: true,
cancelable: true,
});
if (elementInCenter)
elementInCenter.dispatchEvent(e);
if (elementInTopLeft)
elementInTopLeft.dispatchEvent(e);
if (elementInBottomRight)
elementInBottomRight.dispatchEvent(e);
element.removeEventListener('mouseover', eventHandler);
}
return isVisible;
}
let actions = { let actions = {
clickIfExists: async function(selector) { clickIfExists: async function(selector) {
let exists; let exists;
@ -99,10 +140,12 @@ let actions = {
}, },
clearInput: async function(selector) { clearInput: async function(selector) {
await this.waitForSelector(selector, {visible: true}); await this.waitForSelector(selector);
let field = await this.evaluate(selector => { let field = await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field; return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field;
}, selector); }, selector);
if ((field != null && field != '') || field == '0') { if ((field != null && field != '') || field == '0') {
let coords = await this.evaluate(selector => { let coords = await this.evaluate(selector => {
let rect = document.querySelector(selector).getBoundingClientRect(); let rect = document.querySelector(selector).getBoundingClientRect();
@ -112,6 +155,7 @@ let actions = {
await this.waitForSelector(`${selector} [icon="clear"]`, {visible: true}); await this.waitForSelector(`${selector} [icon="clear"]`, {visible: true});
await this.waitToClick(`${selector} [icon="clear"]`); await this.waitToClick(`${selector} [icon="clear"]`);
} }
await this.evaluate(selector => { await this.evaluate(selector => {
return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field == ''; return document.querySelector(`${selector} input`).closest('.vn-field').$ctrl.field == '';
}, selector); }, selector);
@ -172,7 +216,9 @@ let actions = {
waitToClick: async function(selector) { waitToClick: async function(selector) {
await this.waitForSelector(selector); await this.waitForSelector(selector);
await this.click(selector); await this.waitForFunction(checkVisibility, {}, selector);
return await this.click(selector);
}, },
writeOnEditableTD: async function(selector, text) { writeOnEditableTD: async function(selector, text) {
@ -191,47 +237,8 @@ let actions = {
}, },
isVisible: async function(selector) { isVisible: async function(selector) {
await this.wait(selector); await this.waitForSelector(selector);
return await this.evaluate(elementSelector => { return await this.evaluate(checkVisibility, selector);
let selectorMatches = document.querySelectorAll(elementSelector);
let element = selectorMatches[0];
if (selectorMatches.length > 1)
throw new Error(`Multiple matches of ${elementSelector} found`);
let isVisible = false;
if (element) {
let eventHandler = event => {
event.preventDefault();
isVisible = true;
};
element.addEventListener('mouseover', eventHandler);
let rect = element.getBoundingClientRect();
let x = rect.left + rect.width / 2;
let y = rect.top + rect.height / 2;
let elementInCenter = document.elementFromPoint(x, y);
let elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
let e = new MouseEvent('mouseover', {
view: window,
bubbles: true,
cancelable: true,
});
if (elementInCenter)
elementInCenter.dispatchEvent(e);
if (elementInTopLeft)
elementInTopLeft.dispatchEvent(e);
if (elementInBottomRight)
elementInBottomRight.dispatchEvent(e);
element.removeEventListener('mouseover', eventHandler);
}
return isVisible;
}, selector);
}, },
waitImgLoad: async function(selector) { waitImgLoad: async function(selector) {
@ -242,16 +249,6 @@ let actions = {
}, {}, selector); }, {}, selector);
}, },
clickIfVisible: async function(selector) {
await this.wait(selector);
let isVisible = await this.isVisible(selector);
if (isVisible)
return await this.click(selector);
throw new Error(`invisible selector: ${selector}`);
},
countElement: async function(selector) { countElement: async function(selector) {
return await this.evaluate(selector => { return await this.evaluate(selector => {
return document.querySelectorAll(selector).length; return document.querySelectorAll(selector).length;
@ -518,15 +515,22 @@ let actions = {
waitForContentLoaded: async function() { waitForContentLoaded: async function() {
await this.waitFor(1000); await this.waitFor(1000);
// to be implemented in base of a directive loaded once al modules are done loading, further investigation required. },
// await this.waitForFunction(() => {
// return new Promise(resolve => { respondToDialog: async function(response) {
// angular.element(document).ready(() => resolve()); await this.waitForSelector('.vn-dialog.vn-popup.shown');
// const $rootScope = angular.element(document).find('ui-view').injector().get('$rootScope'); const firstCount = await this.evaluate(text => {
// $rootScope.$$postDigest(resolve()); const dialogs = document.querySelectorAll('.vn-dialog.vn-popup');
// $rootScope.$on('$viewContentLoaded', resolve()); const dialogOnTop = dialogs[dialogs.length - 1];
// }); const button = dialogOnTop.querySelector(`div.buttons [response="${text}"]`);
// }); button.click();
return dialogs.length;
}, response);
this.waitForFunction(firstCount => {
const dialogs = document.querySelectorAll('.vn-dialog.vn-popup');
return dialogs.length < firstCount;
}, {}, firstCount);
} }
}; };

View File

@ -194,8 +194,7 @@ export default {
dms: { dms: {
deleteFileButton: 'vn-client-dms-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', deleteFileButton: 'vn-client-dms-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
firstDocWorker: 'vn-client-dms-index vn-td:nth-child(7) > span', firstDocWorker: 'vn-client-dms-index vn-td:nth-child(7) > span',
firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor', firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor'
acceptDeleteButton: '.vn-confirm.shown button[response="accept"]'
}, },
clientContacts: { clientContacts: {
addContactButton: 'vn-client-contact vn-icon[icon="add_circle"]', addContactButton: 'vn-client-contact vn-icon[icon="add_circle"]',
@ -207,6 +206,7 @@ export default {
itemsIndex: { itemsIndex: {
searchIcon: 'vn-searchbar vn-icon[icon="search"]', searchIcon: 'vn-searchbar vn-icon[icon="search"]',
createItemButton: `vn-float-button`, createItemButton: `vn-float-button`,
firstSearchResult: 'vn-item-index a:nth-child(1)',
searchResult: 'vn-item-index a.vn-tr', searchResult: 'vn-item-index a.vn-tr',
searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]', searchResultPreviewButton: 'vn-item-index .buttons > [icon="desktop_windows"]',
searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]', searchResultCloneButton: 'vn-item-index .buttons > [icon="icon-clone"]',
@ -310,7 +310,7 @@ export default {
addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]', addBarcodeButton: 'vn-item-barcode vn-icon[icon="add_circle"]',
thirdCode: 'vn-item-barcode vn-horizontal:nth-child(3) vn-textfield[ng-model="barcode.code"]', thirdCode: 'vn-item-barcode vn-horizontal:nth-child(3) vn-textfield[ng-model="barcode.code"]',
submitBarcodesButton: 'vn-item-barcode button[type=submit]', submitBarcodesButton: 'vn-item-barcode button[type=submit]',
firstCodeRemoveButton: 'vn-item-barcode vn-horizontal vn-none vn-icon[icon="delete"]' firstCodeRemoveButton: 'vn-item-barcode vn-horizontal:nth-child(1) vn-icon[icon="delete"]'
}, },
itemNiches: { itemNiches: {
addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]', addNicheButton: 'vn-item-niche vn-icon[icon="add_circle"]',
@ -536,7 +536,7 @@ export default {
firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]', firstAddServiceTypeButton: 'vn-ticket-service vn-icon-button[vn-tooltip="New service type"]',
firstServiceType: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]', firstServiceType: 'vn-ticket-service vn-autocomplete[ng-model="service.ticketServiceTypeFk"]',
firstQuantity: 'vn-ticket-service vn-input-number[ng-model="service.quantity"]', firstQuantity: 'vn-ticket-service vn-input-number[ng-model="service.quantity"]',
firstPrice: 'vn-ticket-service vn-input-number[ng-model="service.price"]', firstPrice: 'vn-ticket-service vn-horizontal:nth-child(1) vn-input-number[ng-model="service.price"]',
firstVatType: 'vn-ticket-service vn-autocomplete[label="Tax class"]', firstVatType: 'vn-ticket-service vn-autocomplete[label="Tax class"]',
fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]', fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]',
newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]', newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]',
@ -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', 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', 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', 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', 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', 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', 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

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors'; import selectors from '../../helpers/selectors';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
xdescribe('Client lock verified data path', () => { describe('Client lock verified data path', () => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {
@ -113,7 +113,7 @@ xdescribe('Client lock verified data path', () => {
}); });
}); });
xdescribe('as salesAssistant', () => { describe('as salesAssistant', () => {
it('should log in as salesAssistant then get to the client fiscal data', async() => { it('should log in as salesAssistant then get to the client fiscal data', async() => {
await page.forceReloadSection('client.card.fiscalData'); await page.forceReloadSection('client.card.fiscalData');
await page.loginAndModule('salesAssistant', 'client'); await page.loginAndModule('salesAssistant', 'client');

View File

@ -19,7 +19,7 @@ describe('Client DMS', () => {
describe('as salesPerson', () => { describe('as salesPerson', () => {
it('should delete de first file', async() => { it('should delete de first file', async() => {
await page.waitToClick(selectors.dms.deleteFileButton); await page.waitToClick(selectors.dms.deleteFileButton);
await page.waitToClick(selectors.dms.acceptDeleteButton); await page.respondToDialog('accept');
let result = await page.waitForLastSnackbar(); let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');

View File

@ -28,6 +28,7 @@ describe('Client contacts', () => {
}); });
it('should delete de contact', async() => { it('should delete de contact', async() => {
await page.waitFor(3000);
await page.waitToClick(selectors.clientContacts.deleteFirstPhone); await page.waitToClick(selectors.clientContacts.deleteFirstPhone);
await page.waitToClick(selectors.clientContacts.saveButton); await page.waitToClick(selectors.clientContacts.saveButton);
let result = await page.waitForLastSnackbar(); let result = await page.waitForLastSnackbar();

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
xdescribe('Worker time control path', () => { describe('Worker time control path', () => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {
@ -23,7 +23,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -34,7 +34,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -45,7 +45,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -56,7 +56,7 @@ xdescribe('Worker time control path', () => {
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime); await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete); await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog); await page.respondToDialog('accept');
let result = await page.waitForLastSnackbar(); let result = await page.waitForLastSnackbar();
expect(result).toEqual('Entry removed'); expect(result).toEqual('Entry removed');
@ -67,7 +67,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -78,7 +78,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
expect(result).toEqual('14:00'); expect(result).toEqual('14:00');
@ -108,7 +108,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -119,7 +119,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -130,7 +130,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -141,7 +141,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -161,7 +161,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -172,7 +172,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -183,7 +183,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -194,7 +194,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -214,7 +214,7 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -224,7 +224,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '10:00'; const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -234,7 +234,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '10:20'; const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -244,7 +244,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '17:59'; const scanTime = '17:59';
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -263,7 +263,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '07:30'; const scanTime = '07:30';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -273,7 +273,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '10:00'; const scanTime = '10:00';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -283,7 +283,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '10:20'; const scanTime = '10:20';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -293,7 +293,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '15:30'; const scanTime = '15:30';
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -310,21 +310,29 @@ xdescribe('Worker time control path', () => {
describe('as HHRR', () => { describe('as HHRR', () => {
describe('on Saturday', () => { describe('on Saturday', () => {
it('should log in and navigate to timeControl', async() => { it('should log in as hr and pick the worker module', async() => {
await page.loginAndModule('hr', 'worker'); await page.loginAndModule('hr', 'worker');
});
it('should search for a worker and access to its summary', async() => {
await page.accessToSearchResult('HankPym'); await page.accessToSearchResult('HankPym');
await Promise.all([ let url = await page.expectURL('/summary');
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
page.waitForContentLoaded(), expect(url).toBe(true);
page.accessToSection('worker.card.timeControl') });
]);
it('should access to the time control section', async() => {
await page.accessToSection('worker.card.timeControl');
let url = await page.expectURL('/time-control');
expect(url).toBe(true);
}); });
it('should lovingly scan in Hank Pym', async() => { it('should lovingly scan in Hank Pym', async() => {
const scanTime = '06:00'; const scanTime = '06:00';
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -334,7 +342,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '13:40'; const scanTime = '13:40';
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -353,7 +361,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '05:00'; const scanTime = '05:00';
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -363,7 +371,7 @@ xdescribe('Worker time control path', () => {
const scanTime = '12:40'; const scanTime = '12:40';
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton); await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialog, scanTime); 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'); const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime); expect(result).toEqual(scanTime);
@ -390,7 +398,6 @@ xdescribe('Worker time control path', () => {
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex); await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
await page.accessToSearchResult('salesBoss'); await page.accessToSearchResult('salesBoss');
await page.accessToSection('worker.card.timeControl'); await page.accessToSection('worker.card.timeControl');
await page.waitFor(1000);
const wholeWeekHours = await page const wholeWeekHours = await page
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText'); .waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
xdescribe('Item index path', () => { describe('Item index path', () => {
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {
@ -40,7 +40,7 @@ xdescribe('Item index path', () => {
}); });
it('should navigate forth and back to see the images column is still visible', async() => { it('should navigate forth and back to see the images column is still visible', async() => {
await page.waitToClick(selectors.itemsIndex.searchResult); await page.waitToClick(selectors.itemsIndex.firstSearchResult);
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton); await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
await page.waitToClick(selectors.itemsIndex.searchIcon); await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.wait(selectors.itemsIndex.searchResult); await page.wait(selectors.itemsIndex.searchResult);
@ -54,8 +54,8 @@ xdescribe('Item index path', () => {
await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true}); await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true});
}); });
xit('should mark all unchecked boxes to leave the index as it was', async() => { it('should mark all unchecked boxes to leave the index as it was', async() => {
await page.waitForContentLoaded(); await page.waitFor(3000); // otherwise the snackbar doesnt appear some times.
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton); await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
await page.waitToClick(selectors.itemsIndex.idCheckbox); await page.waitToClick(selectors.itemsIndex.idCheckbox);
await page.waitToClick(selectors.itemsIndex.stemsCheckbox); await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
@ -74,7 +74,7 @@ xdescribe('Item index path', () => {
}); });
it('should now navigate forth and back to see the ids column is now visible', async() => { it('should now navigate forth and back to see the ids column is now visible', async() => {
await page.waitToClick(selectors.itemsIndex.searchResult); await page.waitToClick(selectors.itemsIndex.firstSearchResult);
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton); await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
await page.waitToClick(selectors.itemsIndex.searchIcon); await page.waitToClick(selectors.itemsIndex.searchIcon);
await page.wait(selectors.itemsIndex.searchResult); await page.wait(selectors.itemsIndex.searchResult);

View File

@ -25,7 +25,7 @@ describe('Ticket services path', () => {
await page.wait(selectors.ticketService.firstAddServiceTypeButton); await page.wait(selectors.ticketService.firstAddServiceTypeButton);
const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton); const result = await page.isDisabled(selectors.ticketService.firstAddServiceTypeButton);
expect(result).toBeTruthy(); expect(result).toBe(true);
}); });
it('should receive an error if you attempt to save a service without access rights', async() => { it('should receive an error if you attempt to save a service without access rights', async() => {

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
xdescribe('Claim action path', () => { describe('Claim action path', () => {
let browser; let browser;
let page; let page;
@ -24,8 +24,8 @@ xdescribe('Claim action path', () => {
expect(result).toEqual('Data saved!'); expect(result).toEqual('Data saved!');
}); });
xit('should import the second importable ticket', async() => { it('should import the second importable ticket', async() => {
await page.waitFor(2000); // the animation adding the header element for the claimed total obscures somehow other elements for 2 seconds await page.waitFor(3000); // the animation adding the header element for the claimed total obscures somehow other elements for about 2 seconds
await page.waitToClick(selectors.claimAction.importTicketButton); await page.waitToClick(selectors.claimAction.importTicketButton);
await page.waitToClick(selectors.claimAction.secondImportableTicket); await page.waitToClick(selectors.claimAction.secondImportableTicket);
const result = await page.waitForLastSnackbar(); const result = await page.waitForLastSnackbar();
@ -63,7 +63,7 @@ xdescribe('Claim action path', () => {
}); });
it('should check the "is paid with mana" checkbox', async() => { it('should check the "is paid with mana" checkbox', async() => {
page.waitFor(2500); // can't use waitForNavigation here and needs more time than a single second to get the section ready... page.waitFor(3000); // can't use waitForNavigation here and needs more time than a single second to get the section ready...
await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox); await page.waitToClick(selectors.claimAction.isPaidWithManaCheckbox);
const result = await page.waitForLastSnackbar(); const result = await page.waitForLastSnackbar();

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
xdescribe('InvoiceOut descriptor path', () => { describe('InvoiceOut descriptor path', () => {
let browser; let browser;
let page; let page;
@ -26,7 +26,7 @@ xdescribe('InvoiceOut descriptor path', () => {
expect(result).toEqual(1); expect(result).toEqual(1);
}); });
xit('should navigate to the invoiceOut index', async() => { it('should navigate to the invoiceOut index', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible); await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.invoiceOutButton); await page.waitToClick(selectors.globalItems.invoiceOutButton);

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js'; import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
xdescribe('Zone basic data path', () => { describe('Zone basic data path', () => {
let browser; let browser;
let page; let page;
@ -40,9 +40,10 @@ xdescribe('Zone basic data path', () => {
await page.write(selectors.zoneBasicData.inflation, '200'); await page.write(selectors.zoneBasicData.inflation, '200');
await page.waitToClick(selectors.zoneBasicData.volumetric); await page.waitToClick(selectors.zoneBasicData.volumetric);
await page.waitToClick(selectors.zoneBasicData.saveButton); await page.waitToClick(selectors.zoneBasicData.saveButton);
await page.waitForContentLoaded();
}); });
xit('should reload the section', async() => { it('should now reload the section', async() => {
await page.reloadSection('zone.card.basicData'); await page.reloadSection('zone.card.basicData');
let url = await page.expectURL('#!/zone/10/basic-data'); let url = await page.expectURL('#!/zone/10/basic-data');
@ -73,7 +74,7 @@ xdescribe('Zone basic data path', () => {
expect(result).toEqual('1'); expect(result).toEqual('1');
}); });
xit('should confirm the closing hour was updated', async() => { it('should confirm the closing hour was updated', async() => {
const result = await page.waitToGetProperty(selectors.zoneBasicData.closing, 'value'); const result = await page.waitToGetProperty(selectors.zoneBasicData.closing, 'value');
expect(result).toEqual('21:00'); expect(result).toEqual('21:00');