2019-04-08 13:38:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2021-03-23 16:19:05 +00:00
|
|
|
describe('Route tickets path', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('delivery', 'route');
|
2021-03-23 16:19:05 +00:00
|
|
|
await page.accessToSearchResult('2');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSection('route.card.tickets');
|
|
|
|
});
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should modify the first ticket priority', async() => {
|
2021-03-23 16:19:05 +00:00
|
|
|
await page.clearInput(selectors.routeTickets.firstTicketPriority);
|
|
|
|
await page.type(selectors.routeTickets.firstTicketPriority, '9');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.keyboard.press('Enter');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
2021-03-23 16:19:05 +00:00
|
|
|
it('should confirm the buscaman button is disabled', async() => {
|
|
|
|
await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`);
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => {
|
2021-03-23 16:19:05 +00:00
|
|
|
await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`, {visible: false});
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
2019-07-01 11:41:38 +00:00
|
|
|
it('should check the route volume on the descriptor', async() => {
|
2020-04-08 09:24:40 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText');
|
2019-07-01 11:41:38 +00:00
|
|
|
|
2021-03-23 16:19:05 +00:00
|
|
|
expect(result).toEqual('0.2 / 50 m³');
|
2019-07-01 11:41:38 +00:00
|
|
|
});
|
|
|
|
|
2019-04-08 13:38:47 +00:00
|
|
|
it('should count how many tickets are in route', async() => {
|
2021-03-23 16:19:05 +00:00
|
|
|
const result = await page.countElement(selectors.routeTickets.anyTicket);
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2021-03-23 16:19:05 +00:00
|
|
|
expect(result).toEqual(1);
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the first ticket in route', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton);
|
|
|
|
await page.waitToClick(selectors.routeTickets.confirmButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Ticket removed from route');
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should now count how many tickets are in route to find one less', async() => {
|
2021-03-23 16:19:05 +00:00
|
|
|
await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0);
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
});
|