#1976 Implementar Puppeteer worker + item + gulp changes
gitea/salix/puppeteer There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2020-01-14 09:24:09 +01:00
parent 3bcaaddb14
commit 54f7d21e24
15 changed files with 245 additions and 230 deletions

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Worker pbx path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('employee');
await page.accessToSection('worker.card.pbx');
});
afterAll(async() => {
page.close();
browser.close();
});
it('should receive an error when the extension exceeds 4 characters', async() => {

View File

@ -1,95 +1,101 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
import getBrowser from '../../helpers/puppeteer';
describe('Worker time control path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('hr', 'worker')
.accessToSearchResult('HankPym')
.accessToSection('worker.card.timeControl');
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesBoss', 'worker');
await page.accessToSearchResult('HankPym');
await page.accessToSection('worker.card.timeControl');
});
describe('as HHRR', () => {
afterAll(async() => {
browser.close();
});
describe('as salesBoss', () => {
describe('on Monday', () => {
it('should scan in Hank Pym', async() => {
const scanTime = '07:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should scan in Hank Pym for a wrong hour and forget to scan in from the break`, async() => {
const scanTime = '18:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should delete the wrong entry for Hank Pym`, async() => {
const wrongScanTime = '18:00';
const result = await nightmare
.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime)
.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete)
.waitToClick(selectors.workerTimeControl.acceptDeleteDialog)
.waitForLastSnackbar();
await page.waitForTextInElement(selectors.workerTimeControl.thirdEntryOfMonday, wrongScanTime);
await page.waitToClick(selectors.workerTimeControl.thirdEntryOfMondayDelete);
await page.waitToClick(selectors.workerTimeControl.acceptDeleteDialog);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Entry removed');
});
it(`should scan out Hank Pym to leave early`, async() => {
const scanTime = '14:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.mondayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfMonday, 'innerText');
expect(result).toEqual('14:00');
});
it(`should the third entry be the scan in from break`, async() => {
const scanTime = '10:20';
const result = await nightmare
const result = await page
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfMonday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 8 hours`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.')
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '07:00 h.');
const result = await page
.waitToGetProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
expect(result).toEqual('07:00 h.');
@ -99,52 +105,51 @@ describe('Worker time control path', () => {
describe('on Tuesday', () => {
it('should happily scan in Hank Pym', async() => {
const scanTime = '08:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfTuesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfTuesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfTuesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.tuesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfTuesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 8 happy hours`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.')
.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
await page.waitForTextInElement(selectors.workerTimeControl.tuesdayWorkedHours, '08:00 h.');
const result = await page.waitToGetProperty(selectors.workerTimeControl.tuesdayWorkedHours, 'innerText');
expect(result).toEqual('08:00 h.');
});
@ -153,52 +158,51 @@ describe('Worker time control path', () => {
describe('on Wednesday', () => {
it('should cheerfully scan in Hank Pym', async() => {
const scanTime = '09:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfWednesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfWednesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfWednesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.wednesdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfWednesday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 8 cheerfull hours`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.')
.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
await page.waitForTextInElement(selectors.workerTimeControl.wednesdayWorkedHours, '08:00 h.');
const result = await page.waitToGetProperty(selectors.workerTimeControl.wednesdayWorkedHours, 'innerText');
expect(result).toEqual('08:00 h.');
});
@ -207,52 +211,48 @@ describe('Worker time control path', () => {
describe('on Thursday', () => {
it('should joyfully scan in Hank Pym', async() => {
const scanTime = '09:59';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfThursday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfThursday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfThursday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.thursdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfThursday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 8 joyfull hours`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.')
.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
await page.waitForTextInElement(selectors.workerTimeControl.thursdayWorkedHours, '08:00 h.');
const result = await page.waitToGetProperty(selectors.workerTimeControl.thursdayWorkedHours, 'innerText');
expect(result).toEqual('08:00 h.');
});
@ -261,93 +261,88 @@ describe('Worker time control path', () => {
describe('on Friday', () => {
it('should smilingly scan in Hank Pym', async() => {
const scanTime = '07:30';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.fridayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfFriday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfFriday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.thirdEntryOfFriday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.fourthEntryOfFriday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.fridayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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
.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.')
.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
await page.waitForTextInElement(selectors.workerTimeControl.fridayWorkedHours, '08:00 h.');
const result = await page.waitToGetProperty(selectors.workerTimeControl.fridayWorkedHours, 'innerText');
expect(result).toEqual('08:00 h.');
});
});
});
describe('as hr', () => {
describe('as HHRR', () => {
describe('on Saturday', () => {
beforeAll(() => {
nightmare
.loginAndModule('hr', 'worker')
.accessToSearchResult('HankPym')
.accessToSection('worker.card.timeControl');
it('should log in and navigate to timeControl', async() => {
await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('HankPym');
await Promise.all([
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
page.waitForContentLoaded(),
page.accessToSection('worker.card.timeControl')
]);
});
it('should lovingly scan in Hank Pym', async() => {
const scanTime = '06:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSaturday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSaturday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.saturdayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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
.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.')
.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
await page.waitForTextInElement(selectors.workerTimeControl.saturdayWorkedHours, '08:00 h.');
const result = await page.waitToGetProperty(selectors.workerTimeControl.saturdayWorkedHours, 'innerText');
expect(result).toEqual('08:00 h.');
});
@ -356,49 +351,51 @@ describe('Worker time control path', () => {
describe('on Sunday', () => {
it('should gladly scan in Hank Pym', async() => {
const scanTime = '05:00';
const result = await nightmare
.waitToClick(selectors.workerTimeControl.sundayAddTimeButton)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.firstEntryOfSunday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.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)
.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime)
.waitToClick(selectors.workerTimeControl.confirmButton)
.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
await page.waitToClick(selectors.workerTimeControl.sundayAddTimeButton);
await page.pickTime(selectors.workerTimeControl.timeDialogInput, scanTime);
await page.waitToClick(selectors.workerTimeControl.confirmButton);
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfSunday, 'innerText');
expect(result).toEqual(scanTime);
});
it(`should check Hank Pym worked 8 glad hours`, async() => {
const result = await nightmare
.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.')
.waitToGetProperty(selectors.workerTimeControl.sundayWorkedHours, 'innerText');
await page.waitForTextInElement(selectors.workerTimeControl.sundayWorkedHours, '08:00 h.');
const result = await page.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)
.waitToClick(selectors.workerTimeControl.secondWeekDay)
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.')
await page.waitToClick(selectors.workerTimeControl.nextMonthButton);
await page.waitToClick(selectors.workerTimeControl.secondWeekDay);
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '00:00 h.');
const wholeWeekHours = await page
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
expect(wholeWeekHours).toEqual('00:00 h.');
});
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')
await page.waitToClick(selectors.workerTimeControl.navigateBackToIndex);
await page.accessToSearchResult('salesBoss');
await Promise.all([
page.waitForNavigation({waitUntil: ['load', 'networkidle0', 'domcontentloaded']}),
page.waitForContentLoaded(),
page.accessToSection('worker.card.timeControl')
]);
await page.waitFor(1000);
const wholeWeekHours = await page
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
expect(wholeWeekHours).toEqual('00:00 h.');
@ -407,17 +404,15 @@ describe('Worker time control path', () => {
});
describe('after all this amazing week', () => {
beforeAll(() => {
nightmare
.loginAndModule('HankPym', 'worker')
.accessToSearchResult('HankPym')
.accessToSection('worker.card.timeControl');
it('should log in Hank', async() => {
await page.loginAndModule('HankPym', 'worker');
await page.accessToSearchResult('HankPym');
await page.accessToSection('worker.card.timeControl');
});
it('should Hank Pym check his hours are alright', async() => {
const wholeWeekHours = await nightmare
.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.')
.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
it('should check his hours are alright', async() => {
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '55:00 h.');
const wholeWeekHours = await page.waitToGetProperty(selectors.workerTimeControl.weekWorkedHours, 'innerText');
expect(wholeWeekHours).toEqual('55:00 h.');
});

View File

@ -1,15 +1,17 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item summary path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'item');
});
afterAll(async() => {
page.close();
browser.close();
});
it('should search for an item', async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item Edit basic data path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Melee weapon combat fist 15cm');
await page.accessToSection('item.card.basicData');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should check the descritor edit button is visible for buyer`, async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item edit tax path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.tax');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should add the item tax to all countries`, async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item create tags path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.tags');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should create a new tag and delete a former one`, async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item create niche path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.niche');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should click create a new niche and delete a former one`, async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item Create botanical path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon pistol 9mm');
await page.accessToSection('item.card.botanical');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should create a new botanical for the item`, async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item Create barcodes path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('Ranged weapon longbow 2m');
await page.accessToSection('item.card.itemBarcode');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should click create a new code and delete a former one`, async() => {

View File

@ -1,15 +1,17 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item Create/Clone path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
});
afterAll(async() => {
page.close();
browser.close();
});
describe('create', () => {

View File

@ -1,15 +1,17 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item regularize path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'item');
});
afterAll(async() => {
page.close();
browser.close();
});
it('should edit the user local warehouse', async() => {

View File

@ -1,16 +1,18 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item index path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'item');
await page.waitToClick(selectors.itemsIndex.searchIcon);
});
afterAll(async() => {
page.close();
browser.close();
});
it('should click on the fields to show button to open the list of columns to show', async() => {

View File

@ -1,15 +1,17 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item log path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('developer', 'item');
});
afterAll(async() => {
page.close();
browser.close();
});
it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => {

View File

@ -1,17 +1,19 @@
import selectors from '../../helpers/selectors.js';
import openPage from '../../helpers/puppeteer';
import getBrowser from '../../helpers/puppeteer';
describe('Item descriptor path', () => {
let browser;
let page;
beforeAll(async() => {
page = await openPage();
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('buyer', 'item');
await page.accessToSearchResult('1');
await page.accessToSection('item.card.basicData');
});
afterAll(async() => {
page.close();
browser.close();
});
it('should check the descriptor inactive icon is dark as the item is active', async() => {

View File

@ -207,7 +207,6 @@ e2eOnly.description = `Runs the e2e tests only`;
function e2eSingleRun() {
require('@babel/register')({presets: ['@babel/preset-env']});
require('@babel/polyfill');
let getBrowser = require('./e2e/helpers/puppeteer').getBrowser;
const jasmine = require('gulp-jasmine');
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
@ -222,8 +221,7 @@ function e2eSingleRun() {
// `${__dirname}/e2e/paths/07*/*[sS]pec.js`,
// `${__dirname}/e2e/paths/08*/*[sS]pec.js`,
// `${__dirname}/e2e/paths/09*/*[sS]pec.js`,
// `${__dirname}/e2e/paths/**/*[sS]pec.js`,
`${__dirname}/e2e/helpers/extensions.js`
// `${__dirname}/e2e/paths/**/*[sS]pec.js`
];
return gulp.src(specFiles).pipe(jasmine({
@ -239,11 +237,7 @@ function e2eSingleRun() {
}
})
]
})
.on('jasmineDone', async function() {
await getBrowser().close();
})
);
}));
}
e2eSingleRun.description = `Runs the e2e tests just once`;