angular/aio/content/examples/testing/e2e/src/app.e2e-spec.ts
Kristiyan Kostadinov e86a1d3441 docs: make all examples compatible with strict mode (#41999)
Turns on the `strict` compiler flag and resolves the compilation errors in the various AIO examples.

PR Close #41999
2021-05-17 10:42:18 -07:00

30 lines
807 B
TypeScript

import { browser, element, by } from 'protractor';
describe('Testing Example', () => {
const expectedViewNames = ['Dashboard', 'Heroes', 'About'];
beforeAll(() => browser.get(''));
function getPageElts() {
return {
navElts: element.all(by.css('app-root nav a')),
appDashboard: element(by.css('app-root app-dashboard')),
};
}
it('has title', async () => {
expect(await browser.getTitle()).toEqual('App Under Test');
});
it(`has views ${expectedViewNames}`, async () => {
const viewNames = await getPageElts().navElts.map(el => el!.getText());
expect(viewNames).toEqual(expectedViewNames);
});
it('has dashboard as the active view', async () => {
const page = getPageElts();
expect(await page.appDashboard.isPresent()).toBeTruthy();
});
});