salix/e2e/paths/05-ticket/09_weekly.spec.js

133 lines
5.4 KiB
JavaScript
Raw Normal View History

2018-11-11 16:40:02 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-11-11 16:40:02 +00:00
2018-11-13 12:03:44 +00:00
describe('Ticket descriptor path', () => {
let browser;
let page;
2018-11-11 16:40:02 +00:00
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'ticket');
await page.accessToSection('ticket.weekly.index');
2018-11-11 16:40:02 +00:00
});
afterAll(async() => {
await browser.close();
2018-11-11 16:40:02 +00:00
});
it('should count the amount of tickets in the turns section', async() => {
await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5);
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
2018-11-11 16:40:02 +00:00
expect(result).toEqual(5);
2018-11-11 16:40:02 +00:00
});
it('should go back to the ticket index then search and access a ticket summary', async() => {
await page.accessToSection('ticket.index');
await page.accessToSearchResult('11');
2018-11-11 16:40:02 +00:00
});
2019-05-21 07:03:57 +00:00
it('should add the ticket to thursday turn using the descriptor more menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
const result = await page.waitForLastSnackbar();
2018-11-11 16:40:02 +00:00
expect(result).toEqual('Data saved!');
});
2019-01-11 11:25:53 +00:00
it('should again click on the Tickets button of the top bar menu', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
2020-02-04 15:21:10 +00:00
let url = await page.expectURL('#!/ticket/index');
2018-11-11 16:40:02 +00:00
2020-02-04 15:21:10 +00:00
expect(url).toBe(true);
2018-11-11 16:40:02 +00:00
});
it('should confirm the ticket 11 was added to thursday', async() => {
await page.accessToSection('ticket.weekly.index');
const result = await page.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
2018-11-19 08:27:15 +00:00
expect(result).toEqual('Thursday');
});
2019-01-11 11:25:53 +00:00
it('should click on the Tickets button of the top bar menu once more', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
2020-02-04 15:21:10 +00:00
let url = await page.expectURL('#!/ticket/index');
2018-11-19 08:27:15 +00:00
2020-02-04 15:21:10 +00:00
expect(url).toBe(true);
2018-11-19 08:27:15 +00:00
});
2019-01-11 11:25:53 +00:00
it('should now search for the ticket 11', async() => {
2020-02-03 14:55:11 +00:00
await page.write(selectors.ticketsIndex.topbarSearch, '11');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
const result = await page.countElement(selectors.ticketsIndex.searchResult);
2018-11-19 08:27:15 +00:00
expect(result).toEqual(1);
});
2019-01-11 11:25:53 +00:00
it(`should click on the search result to access to the ticket`, async() => {
await page.waitToClick(selectors.ticketsIndex.searchResult);
2020-02-04 15:21:10 +00:00
let url = await page.expectURL('/summary');
2018-11-19 08:27:15 +00:00
2020-02-04 15:21:10 +00:00
expect(url).toBe(true);
2018-11-19 08:27:15 +00:00
});
2019-01-11 11:25:53 +00:00
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
const result = await page.waitForLastSnackbar();
2018-11-19 08:27:15 +00:00
expect(result).toEqual('Data saved!');
});
2019-01-11 11:25:53 +00:00
it('should click on the Tickets button of the top bar menu once again', async() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.wait(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
2020-02-04 15:21:10 +00:00
let url = await page.expectURL('#!/ticket/index');
2018-11-19 08:27:15 +00:00
2020-02-04 15:21:10 +00:00
expect(url).toBe(true);
2018-11-19 08:27:15 +00:00
});
2019-01-11 11:25:53 +00:00
it('should confirm the ticket 11 was added on saturday', async() => {
await page.accessToSection('ticket.weekly.index');
const result = await page.waitToGetProperty(selectors.ticketsIndex.sixthWeeklyTicket, 'value');
2018-11-11 16:40:02 +00:00
2018-11-19 08:27:15 +00:00
expect(result).toEqual('Saturday');
2018-11-11 16:40:02 +00:00
});
2019-08-21 10:23:01 +00:00
it('should now search for the weekly ticket 11', async() => {
2020-02-03 14:55:11 +00:00
await page.write(selectors.ticketsIndex.topbarSearch, '11');
await page.waitToClick(selectors.ticketsIndex.searchButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1);
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
2019-08-21 10:23:01 +00:00
expect(result).toEqual(1);
});
2019-05-21 07:23:53 +00:00
2019-01-11 11:25:53 +00:00
it('should delete the weekly ticket 11', async() => {
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
const result = await page.waitForLastSnackbar();
2018-11-11 16:40:02 +00:00
expect(result).toEqual('Data saved!');
});
2019-01-11 11:25:53 +00:00
it('should confirm the sixth weekly ticket was deleted', async() => {
await page.waitForContentLoaded();
await page.clearInput('vn-searchbar');
await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton);
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5);
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
2018-11-11 16:40:02 +00:00
expect(result).toEqual(5);
});
});