142 lines
5.7 KiB
JavaScript
142 lines
5.7 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Ticket descriptor path', () => {
|
|
let browser;
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('employee', 'ticket');
|
|
await page.accessToSection('ticket.weekly.index');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
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);
|
|
|
|
expect(result).toEqual(5);
|
|
});
|
|
|
|
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');
|
|
await page.waitForContentLoaded();
|
|
});
|
|
|
|
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();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
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);
|
|
await page.waitForContentLoaded();
|
|
|
|
const url = await page.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
});
|
|
|
|
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');
|
|
|
|
expect(result).toEqual('Thursday');
|
|
});
|
|
|
|
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);
|
|
await page.waitForURL('#!/ticket/index');
|
|
|
|
const url = await page.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
});
|
|
|
|
it('should now search for the ticket 11', async() => {
|
|
await page.waitForContentLoaded();
|
|
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
|
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1);
|
|
const result = await page.countElement(selectors.ticketsIndex.searchResult);
|
|
|
|
expect(result).toEqual(1);
|
|
});
|
|
|
|
it(`should click on the search result to access to the ticket`, async() => {
|
|
await page.waitToClick(selectors.ticketsIndex.searchResult);
|
|
await page.waitForURL('/summary');
|
|
const url = await page.parsedUrl();
|
|
|
|
expect(url.hash).toContain('/summary');
|
|
});
|
|
|
|
it('should add the ticket to saturday turn using the descriptor more menu', async() => {
|
|
await page.waitForContentLoaded();
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuAddToTurn);
|
|
await page.waitToClick(selectors.ticketDescriptor.saturdayButton);
|
|
const result = await page.waitForLastSnackbar();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
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);
|
|
await page.wait(selectors.ticketsIndex.searchTicketInput);
|
|
const url = await page.parsedUrl();
|
|
|
|
expect(url.hash).toEqual('#!/ticket/index');
|
|
});
|
|
|
|
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');
|
|
|
|
expect(result).toEqual('Saturday');
|
|
});
|
|
|
|
it('should now search for the weekly ticket 11', async() => {
|
|
await page.write(selectors.ticketsIndex.searchTicketInput, '11');
|
|
await page.waitToClick(selectors.ticketsIndex.searchButton);
|
|
await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1);
|
|
const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult);
|
|
|
|
expect(result).toEqual(1);
|
|
});
|
|
|
|
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();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
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);
|
|
|
|
expect(result).toEqual(5);
|
|
});
|
|
});
|