diff --git a/e2e/paths/03-worker/05_calendar.spec.js b/e2e/paths/03-worker/05_calendar.spec.js index a4d22c9fc..9a1998c07 100644 --- a/e2e/paths/03-worker/05_calendar.spec.js +++ b/e2e/paths/03-worker/05_calendar.spec.js @@ -1,15 +1,14 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #2390-calendar_date_filter e2e -xdescribe('Worker calendar path', () => { +fdescribe('Worker calendar path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('hr', 'worker'); - await page.accessToSearchResult('coolerNick'); + await page.accessToSearchResult('Hank Pym'); await page.accessToSection('worker.card.calendar'); }); @@ -18,10 +17,10 @@ xdescribe('Worker calendar path', () => { }); describe('as hr', () => { - it('should check 0 total holidays have been used so far', async() => { + it('should check 5 total holidays have been used so far before testing anything', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 0 '); + expect(result).toContain(' 5 '); }); it('should set two days as holidays on the calendar', async() => { @@ -52,22 +51,22 @@ xdescribe('Worker calendar path', () => { await page.waitToClick(selectors.workerCalendar.mayEighth); }); - it('should check the total holidays used now has 1.5 more days', async() => { + it('should check the total holidays increased by 1.5', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 1.5 '); + expect(result).toContain(' 6.5 '); }); }); - describe(`as cool boss`, () => { - it(`should log in and get to cool's calendar`, async() => { - await page.loginAndModule('coolerBoss', 'worker'); - await page.accessToSearchResult('coolerNick'); + describe(`as salesBoss`, () => { + it(`should log in and get to Hank's calendar`, async() => { + await page.loginAndModule('salesBoss', 'worker'); + await page.accessToSearchResult('Hank Pym'); await page.accessToSection('worker.card.calendar'); }); it('should undo what was done here', async() => { - await page.waitFor(4000); + await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.holidays); await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); @@ -98,37 +97,41 @@ xdescribe('Worker calendar path', () => { it('should check the total holidays used are back to what it was', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 0 '); + expect(result).toContain(' 5 '); }); }); - describe(`as cooler`, () => { + describe(`as Hank`, () => { it(`should log in and get to his calendar`, async() => { - await page.loginAndModule('cooler', 'worker'); - await page.accessToSearchResult('coolerNick'); + await page.loginAndModule('HankPym', 'worker'); + await page.accessToSearchResult('Hank Pym'); await page.accessToSection('worker.card.calendar'); }); it('should make a futile attempt to add holidays', async() => { - await page.waitFor(4000); + await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.holidays); await page.waitFor(400); await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst); }); - it('should check the total holidays used remain the same', async() => { + it('should check the total holidays used are now the initial ones', async() => { const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); - expect(result).toContain(' 0 '); + expect(result).toContain(' 5 '); }); - it('should use the year selector yo go to the previous year', async() => { - const date = new Date(); - const lastYear = (date.getFullYear() - 1).toString(); + // #1361 worker.calendar "hopefully this test works straight away after refreshing holidays per year on each filtering." + // it('should use the year selector to go to the previous year', async() => { + // const date = new Date(); + // const lastYear = (date.getFullYear() - 1).toString(); - await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); + // await page.autocompleteSearch(selectors.workerCalendar.year, lastYear); - expect(result).toContain(' 0 '); - }); + // await page.waitFor(400); + // const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); + + // expect(result).toContain(' 0 '); + // }); }); });