import { browser, element, by } from 'protractor'; import {DispatchPage} from './dispatch.po'; import { doesNotReject } from 'assert'; type result = any; let dis = new DispatchPage(); describe('Dispatch KPI Count', () => { it ('show incomplete routes', async () => { let numRoutes = await dis.totalRoutes.getText(); let completedRoutes = await dis.totalCompletedRoutes.getText(); await expect(dis.rowCount.getText()).toContain(dis.totalCompletedStops.getText()); }); // it ('show total stops', async () => { // await dis.ordersTab.click(); // await browser.sleep(3000); // await expect(dis.orderRowCount.getText()).toContain(dis.totalStops.getText()); // }); it ('show unassigned total routes', async () => { await dis.totalUnassignedRoutes.click(); await dis.waitForItemNotToBePresent(dis.spinner); await browser.sleep(1000); await expect(dis.rowCount.getText()).toContain(dis.totalUnassignedRoutes.getText()); }); // it ('show unassigned will call', async () => { // await expect(dis.totalUnassignedWillCall.getText()); // }); it ('show routes not started', async () => { await dis.totalRoutesNotStarted.click(); await dis.waitForItemNotToBePresent(dis.spinner); await browser.sleep(3000); await expect(dis.rowCount.getText()).toContain(dis.totalRoutesNotStarted.getText()); }); it ('show late 20 routes', async () => { await dis.totalLate20.click(); if (dis.spinner.isPresent()) { await dis.waitForItemNotToBePresent(dis.spinner); expect(dis.rowCount.getText()).toContain(dis.totalLate20.getText()); console.log("spinner is present"); } else { await expect(dis.totalLate20.getText()).toBe(0); console.log("not present"); } }); it ('show late 30 routes', async () => { await dis.totalLate30.click(); await dis.waitForItemNotToBePresent(dis.spinner); await browser.sleep(1000); await expect (dis.rowCount.getText()).toContain(dis.totalLate30.getText()); }); it ('show completed Stops', async () => { await dis.ordersTab.click(); await dis.waitForItemToBeVisible(dis.badge); await browser.sleep(2000); await dis.totalCompletedStops.click(); await browser.sleep(1000); await dis.waitForItemNotToBePresent(dis.spinner); await browser.sleep(1000); await expect (dis.totalOrders.getText()).toContain(dis.totalCompletedStops.getText()); }); it ('show completed routes', async () => { await dis.routesTab.click(); await dis.waitForItemToBeVisible(dis.routes); await browser.sleep(2000); await dis.totalCompletedRoutes.click(); await browser.sleep(1000); await dis.waitForItemNotToBePresent(dis.spinner); await browser.sleep(1000); await expect(dis.rowCount.getText()).toContain(dis.totalCompletedRoutes.getText()); }); });