salix/e2e/paths/08-route/01_summary.spec.js

63 lines
2.2 KiB
JavaScript
Raw Normal View History

2020-02-12 13:36:05 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2022-09-14 12:03:49 +00:00
fdescribe('Route summary path', () => {
2020-02-12 13:36:05 +00:00
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'route');
2022-09-14 12:03:49 +00:00
await page.waitToClick(selectors.routeIndex.previewButton);
await page.waitToClick(selectors.routeSummary.goToRouteSummaryButton);
2020-02-12 13:36:05 +00:00
});
afterAll(async() => {
await browser.close();
});
it('should reach the first route summary section', async() => {
await page.waitForState('route.card.summary');
2020-02-12 13:36:05 +00:00
});
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() => {
2022-09-14 12:03:49 +00:00
await page.waitForState('route.card.summary');
2022-10-04 08:08:12 +00:00
await page.waitForTimeout(250);
2020-02-12 13:36:05 +00:00
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();
});
});