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

122 lines
4.8 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;
2020-02-13 07:31:29 +00:00
await page.loginAndModule('buyer', '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() => {
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);
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() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
await page.waitForState('ticket.index');
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.waitForSelector(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
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');
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() => {
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() => {
await page.waitToClick(selectors.globalItems.applicationsMenuButton);
await page.waitForSelector(selectors.globalItems.applicationsMenuVisible);
await page.waitToClick(selectors.globalItems.ticketsButton);
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() => {
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() => {
await page.doSearch('11');
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
2019-08-21 10:23:01 +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() => {
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() => {
await page.doSearch();
const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
2018-11-11 16:40:02 +00:00
expect(nResults).toEqual(5);
2018-11-11 16:40:02 +00:00
});
it('should update the agency then remove it afterwards', async() => {
await page.autocompleteSearch(selectors.ticketsIndex.firstWeeklyTicketAgency, 'Silla247');
let message = await page.waitForSnackbar();
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
await page.clearInput(selectors.ticketsIndex.firstWeeklyTicketAgency);
message = await page.waitForSnackbar();
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
});
2018-11-11 16:40:02 +00:00
});