2018-11-11 16:40:02 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
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', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
2018-11-11 16:40:02 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-02-13 07:31:29 +00:00
|
|
|
await page.loginAndModule('buyer', 'ticket');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSection('ticket.weekly.index');
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
it('should count the amount of tickets in the turns section', async() => {
|
|
|
|
const result = await page.countElement(selectors.ticketsIndex.weeklyTicket);
|
2018-11-11 16:40:02 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
expect(result).toEqual(5);
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
|
|
|
|
2020-01-23 15:01:29 +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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.thursdayButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-11 16:40:02 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it('should again click on the Tickets button of the top bar menu', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
|
|
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
it('should confirm the ticket 11 was added to thursday', async() => {
|
|
|
|
await page.accessToSection('ticket.weekly.index');
|
2020-01-29 13:54:07 +00:00
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
|
|
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
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-03-23 09:40:09 +00:00
|
|
|
await page.accessToSearchResult('11');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.card.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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
|
|
|
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-19 08:27:15 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-11-19 08:27:15 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it('should click on the Tickets button of the top bar menu once again', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
|
|
|
|
await page.wait(selectors.globalItems.applicationsMenuVisible);
|
|
|
|
await page.waitToClick(selectors.globalItems.ticketsButton);
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('ticket.index');
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSection('ticket.weekly.index');
|
2020-01-29 13:54:07 +00:00
|
|
|
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-03-31 16:33:48 +00:00
|
|
|
await page.doSearch('11');
|
|
|
|
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
2019-08-21 10:23:01 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toEqual(1);
|
2019-08-21 10:23:01 +00:00
|
|
|
});
|
2019-05-21 07:23:53 +00:00
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it('should delete the weekly ticket 11', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.ticketsIndex.firstWeeklyTicketDeleteIcon);
|
|
|
|
await page.waitToClick(selectors.ticketsIndex.acceptDeleteTurn);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2018-11-11 16:40:02 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it('should confirm the sixth weekly ticket was deleted', async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch();
|
|
|
|
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
2018-11-11 16:40:02 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toEqual(5);
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|
2020-04-08 10:33:36 +00:00
|
|
|
|
2020-04-08 11:15:07 +00:00
|
|
|
it('should update the agency then remove it afterwards', async() => {
|
2020-04-08 10:33:36 +00:00
|
|
|
await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247');
|
2020-04-09 14:50:41 +00:00
|
|
|
let message = await page.waitForSnackbar();
|
2020-04-08 10:33:36 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-04-08 10:33:36 +00:00
|
|
|
|
|
|
|
await page.clearInput(selectors.ticketsIndex.firstWeeklyTicketAgency);
|
2020-04-09 14:50:41 +00:00
|
|
|
message = await page.waitForSnackbar();
|
2020-04-08 10:33:36 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2020-04-08 10:33:36 +00:00
|
|
|
});
|
2018-11-11 16:40:02 +00:00
|
|
|
});
|