import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Route tickets path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('delivery', 'route'); await page.accessToSearchResult('2'); await page.accessToSection('route.card.tickets'); }); afterAll(async() => { await browser.close(); }); it('should modify the first ticket priority', async() => { await page.writeOnEditableTD(selectors.routeTickets.firstTicketPriority, '9'); await page.keyboard.press('Enter'); const message = await page.waitForSnackbar(); expect(message.text).toContain('Data saved!'); }); it('should confirm the buscaman button is disabled', async() => { await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`); }); it('should check the first ticket checkbox and confirm the buscamanButton button is no longer disabled', async() => { await page.waitForSelector(`${selectors.routeTickets.buscamanButton}.disabled`, {visible: false}); }); it('should check the route volume on the descriptor', async() => { const result = await page.waitToGetProperty(selectors.routeDescriptor.volume, 'innerText'); expect(result).toEqual('0.2 / 50 m³'); }); it('should count how many tickets are in route', async() => { const result = await page.countElement(selectors.routeTickets.anyTicket); expect(result).toEqual(1); }); it('should delete the first ticket in route', async() => { await page.waitToClick(selectors.routeTickets.firstTicketDeleteButton); await page.waitToClick(selectors.routeTickets.confirmButton); const message = await page.waitForSnackbar(); expect(message.text).toContain('Ticket removed from route'); }); it('should now count how many tickets are in route to find one less', async() => { await page.waitForNumberOfElements(selectors.routeTickets.anyTicket, 0); }); });