import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; describe('Route summary path', () => { let browser; let page; beforeAll(async() => { browser = await getBrowser(); page = browser.page; await page.loginAndModule('employee', 'route'); await page.waitToClick('vn-route-index vn-tbody > a:nth-child(7)'); }); afterAll(async() => { await browser.close(); }); it('should reach the first route summary section', async() => { await page.waitForState('route.card.summary'); }); it(`should display details from the route on the header`, async() => { await page.waitForTextInElement(selectors.routeSummary.header, 'first route'); const result = await page.waitToGetProperty(selectors.routeSummary.header, 'innerText'); expect(result).toContain('first route'); }); it('should display some route details like the cost', async() => { const result = await page.waitToGetProperty(selectors.routeSummary.cost, 'innerText'); expect(result).toContain('€10.00'); }); it('should click on the first ticket ID making the descriptor popover visible', async() => { await page.waitToClick(selectors.routeSummary.firstTicketID); await page.waitForSelector(selectors.routeSummary.firstTicketDescriptor); const visible = await page.isVisible(selectors.routeSummary.firstTicketDescriptor); expect(visible).toBe(true); }); it('should close the ticket descriptor', async() => { await page.closePopup(); }); it('should click on the first alias making the client descriptor popover visible', async() => { await page.waitToClick(selectors.routeSummary.firstAlias); await page.waitForSelector(selectors.routeSummary.firstClientDescriptor); const visible = await page.isVisible(selectors.routeSummary.firstClientDescriptor); expect(visible).toBe(true); }); it('should close the client descriptor', async() => { await page.closePopup(); }); });