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

168 lines
6.5 KiB
JavaScript
Raw Normal View History

2018-11-11 16:40:02 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-11-13 12:03:44 +00:00
describe('Ticket descriptor path', () => {
2018-11-11 16:40:02 +00:00
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('employee', 'ticket');
2018-11-11 16:40:02 +00:00
});
2019-08-21 10:23:01 +00:00
it('should count the amount of tickets in the turns section', async() => {
2018-11-11 16:40:02 +00:00
const result = await nightmare
2019-11-11 15:32:03 +00:00
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
2018-11-11 16:40:02 +00:00
.wait(selectors.ticketsIndex.weeklyTicket)
.countElement(selectors.ticketsIndex.weeklyTicket);
expect(result).toEqual(5);
});
2019-01-11 11:25:53 +00:00
it('should now click on the Tickets button of the top bar menu', async() => {
2018-11-11 16:40:02 +00:00
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-11 16:40:02 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
2019-01-11 11:25:53 +00:00
it('should search for the ticket 11', async() => {
2018-11-11 16:40:02 +00:00
const result = await nightmare
2019-08-21 10:23:01 +00:00
.write(selectors.ticketsIndex.searchTicketInput, 11)
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketsIndex.searchButton)
2019-11-10 13:13:55 +00:00
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.countElement(selectors.ticketsIndex.searchResult);
2018-11-11 16:40:02 +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() => {
2018-11-11 16:40:02 +00:00
const url = await nightmare
2019-11-10 13:13:55 +00:00
.waitToClick(selectors.ticketsIndex.searchResult)
2018-11-11 16:40:02 +00:00
.waitForURL('/summary')
.parsedUrl();
2018-11-11 16:40:02 +00:00
expect(url.hash).toContain('/summary');
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() => {
2018-11-11 16:40:02 +00:00
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
.waitToClick(selectors.ticketDescriptor.thursdayButton)
.waitForLastSnackbar();
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() => {
2018-11-11 16:40:02 +00:00
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-11 16:40:02 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
2019-01-11 11:25:53 +00:00
it('should confirm the ticket 11 was added on thursday', async() => {
2018-11-11 16:40:02 +00:00
const result = await nightmare
2019-11-11 15:32:03 +00:00
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
2019-07-29 11:12:36 +00:00
.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() => {
2018-11-19 08:27:15 +00:00
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-19 08:27:15 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
2019-01-11 11:25:53 +00:00
it('should now search for the ticket 11', async() => {
2018-11-19 08:27:15 +00:00
const result = await nightmare
2019-08-21 10:23:01 +00:00
.write(selectors.ticketsIndex.searchTicketInput, 11)
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.ticketsIndex.searchButton)
2019-11-10 13:13:55 +00:00
.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1)
.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() => {
2018-11-19 08:27:15 +00:00
const url = await nightmare
2019-11-10 13:13:55 +00:00
.waitToClick(selectors.ticketsIndex.searchResult)
2018-11-19 08:27:15 +00:00
.waitForURL('/summary')
.parsedUrl();
2018-11-19 08:27:15 +00:00
expect(url.hash).toContain('/summary');
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() => {
2018-11-19 08:27:15 +00:00
const result = await nightmare
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn)
.waitToClick(selectors.ticketDescriptor.saturdayButton)
.waitForLastSnackbar();
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() => {
2018-11-19 08:27:15 +00:00
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.ticketsButton)
.wait(selectors.ticketsIndex.searchTicketInput)
2018-11-19 08:27:15 +00:00
.parsedUrl();
expect(url.hash).toEqual('#!/ticket/index');
});
2019-01-11 11:25:53 +00:00
it('should confirm the ticket 11 was added on saturday', async() => {
2018-11-19 08:27:15 +00:00
const result = await nightmare
2019-11-11 15:32:03 +00:00
.waitToClick(selectors.ticketsIndex.menuWeeklyTickets)
2019-07-29 11:12:36 +00:00
.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() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchWeeklyTicketInput, 11)
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1)
.countElement(selectors.ticketsIndex.searchWeeklyResult);
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() => {
2018-11-11 16:40:02 +00:00
const result = await nightmare
2019-08-21 10:23:01 +00:00
.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon)
2019-05-21 07:03:57 +00:00
.waitToClick(selectors.ticketsIndex.acceptDeleteTurn)
2018-11-11 16:40:02 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-01-11 11:25:53 +00:00
it('should confirm the sixth weekly ticket was deleted', async() => {
2018-11-11 16:40:02 +00:00
const result = await nightmare
2019-11-10 13:13:55 +00:00
.waitToClick('vn-searchbar vn-icon[icon=clear]')
2019-08-21 10:23:01 +00:00
.waitToClick(selectors.ticketsIndex.searchWeeklyButton)
.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5)
.countElement(selectors.ticketsIndex.searchWeeklyResult);
2018-11-11 16:40:02 +00:00
expect(result).toEqual(5);
});
});