fix(worker): fix calendar e2e
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Alex Moreno 2022-03-11 13:23:02 +01:00
parent 8e37518449
commit 0fd556dd2a
1 changed files with 6 additions and 12 deletions

View File

@ -9,7 +9,7 @@ describe('Worker calendar path', () => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('hr', 'worker'); await page.loginAndModule('hr', 'worker');
await page.accessToSearchResult('Hank Pym'); await page.accessToSearchResult('Charles Xavier');
await page.accessToSection('worker.card.calendar'); await page.accessToSection('worker.card.calendar');
}); });
@ -18,12 +18,6 @@ describe('Worker calendar path', () => {
}); });
describe('as hr', () => { describe('as hr', () => {
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(' 5 ');
});
it('should set two days as holidays on the calendar and check the total holidays increased by 1.5', async() => { it('should set two days as holidays on the calendar and check the total holidays increased by 1.5', async() => {
await page.waitToClick(selectors.workerCalendar.holidays); await page.waitToClick(selectors.workerCalendar.holidays);
await page.waitForTimeout(reasonableTimeBetweenClicks); await page.waitForTimeout(reasonableTimeBetweenClicks);
@ -56,14 +50,14 @@ describe('Worker calendar path', () => {
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
expect(result).toContain(' 6.5 '); expect(result).toContain(' 1.5 ');
}); });
}); });
describe(`as salesBoss`, () => { describe(`as salesBoss`, () => {
it(`should log in and get to Hank's calendar`, async() => { it(`should log in and get to Hank's calendar`, async() => {
await page.loginAndModule('salesBoss', 'worker'); await page.loginAndModule('salesBoss', 'worker');
await page.accessToSearchResult('Hank Pym'); await page.accessToSearchResult('Charles Xavier');
await page.accessToSection('worker.card.calendar'); await page.accessToSection('worker.card.calendar');
}); });
@ -101,14 +95,14 @@ describe('Worker calendar path', () => {
it('should check the total holidays used are back to what it was', async() => { it('should check the total holidays used are back to what it was', async() => {
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
expect(result).toContain(' 5 '); expect(result).toContain(' 0 ');
}); });
}); });
describe(`as Hank`, () => { describe(`as Hank`, () => {
it(`should log in and get to his calendar`, async() => { it(`should log in and get to his calendar`, async() => {
await page.loginAndModule('HankPym', 'worker'); await page.loginAndModule('HankPym', 'worker');
await page.accessToSearchResult('Hank Pym'); await page.accessToSearchResult('Charles Xavier');
await page.accessToSection('worker.card.calendar'); await page.accessToSection('worker.card.calendar');
}); });
@ -122,7 +116,7 @@ describe('Worker calendar path', () => {
it('should check the total holidays used are now the initial ones', async() => { it('should check the total holidays used are now the initial ones', async() => {
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText'); const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
expect(result).toContain(' 5 '); expect(result).toContain(' 0 ');
}); });
it('should use the year selector to go to the previous year', async() => { it('should use the year selector to go to the previous year', async() => {