1361 - Añadir filtro por año #348

Merged
joan merged 16 commits from 1361-calendar_date_filter into dev 2020-08-18 12:18:41 +00:00
2 changed files with 150 additions and 0 deletions
Showing only changes of commit f7089f3806 - Show all commits

View File

@ -803,6 +803,22 @@ export default {
navigateBackToIndex: 'vn-worker-descriptor [name="goToModuleIndex"]',
acceptDeleteDialog: '.vn-confirm.shown button[response="accept"]'
},
workerCalendar: {
year: 'vn-worker-calendar vn-autocomplete[ng-model="$ctrl.year"]',
totalHolidaysUsed: 'vn-worker-calendar div.totalBox > div',
januaryThirtyFirst: 'vn-worker-calendar vn-calendar:nth-child(2) section:nth-child(33) > div',
marchTwentyThird: 'vn-worker-calendar vn-calendar:nth-child(4) section:nth-child(29) > div',
mayFourth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(8) > div',
mayEighth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(12) > div',
mayTwelfth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(16) > div',
mayThirteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(17) > div',
mayFourteenth: 'vn-worker-calendar vn-calendar:nth-child(6) section:nth-child(18) > div',
holidays: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(1)',
absence: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(2)',
halfHoliday: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(3)',
furlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(4)',
halfFurlough: 'vn-worker-calendar > vn-side-menu div:nth-child(3) > vn-chip:nth-child(5)',
},
invoiceOutIndex: {
topbarSearch: 'vn-searchbar',
searchButton: 'vn-searchbar vn-icon[icon="search"]',

View File

@ -0,0 +1,134 @@
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
// #2390-calendar_date_filter e2e
xdescribe('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.accessToSection('worker.card.calendar');
});
afterAll(async() => {
await browser.close();
});
describe('as hr', () => {
it('should check 0 total holidays have been used so far', async() => {
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
expect(result).toContain(' 0 ');
});
it('should set two days as holidays on the calendar', async() => {
await page.waitToClick(selectors.workerCalendar.holidays);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.absence);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.marchTwentyThird);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.halfHoliday);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.mayFourth);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.furlough);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.mayTwelfth);
await page.waitToClick(selectors.workerCalendar.mayThirteenth);
await page.waitToClick(selectors.workerCalendar.mayFourteenth);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.halfFurlough);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.mayEighth);
});
it('should check the total holidays used now has 1.5 more days', async() => {
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
expect(result).toContain(' 1.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');
await page.accessToSection('worker.card.calendar');
});
it('should undo what was done here', async() => {
await page.waitFor(4000);
await page.waitToClick(selectors.workerCalendar.holidays);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.januaryThirtyFirst);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.absence);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.marchTwentyThird);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.halfHoliday);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.mayFourth);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.furlough);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.mayTwelfth);
await page.waitToClick(selectors.workerCalendar.mayThirteenth);
await page.waitToClick(selectors.workerCalendar.mayFourteenth);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.halfFurlough);
await page.waitFor(400);
await page.waitToClick(selectors.workerCalendar.mayEighth);
});
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 ');
});
});
describe(`as cooler`, () => {
it(`should log in and get to his calendar`, async() => {
await page.loginAndModule('cooler', 'worker');
await page.accessToSearchResult('coolerNick');
await page.accessToSection('worker.card.calendar');
});
it('should make a futile attempt to add holidays', async() => {
await page.waitFor(4000);
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() => {
const result = await page.waitToGetProperty(selectors.workerCalendar.totalHolidaysUsed, 'innerText');
expect(result).toContain(' 0 ');
});
it('should use the year selector yo go to the previous year', async() => {
const date = new Date();
const lastYear = (date.getFullYear() - 1).toString();
await page.autocompleteSearch(selectors.workerCalendar.year, lastYear);
expect(result).toContain(' 0 ');
});
});
});