diff --git a/aio/content/examples/dynamic-component-loader/e2e/src/app.e2e-spec.ts b/aio/content/examples/dynamic-component-loader/e2e/src/app.e2e-spec.ts index 22403372ca..f0f7c7297b 100644 --- a/aio/content/examples/dynamic-component-loader/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/dynamic-component-loader/e2e/src/app.e2e-spec.ts @@ -1,19 +1,24 @@ import { browser, element, by } from 'protractor'; -/* tslint:disable:quotemark */ describe('Dynamic Component Loader', () => { - beforeEach(() => { - browser.get(''); - }); + // The tests trigger periodic asynchronous operations (via `setInterval()`), which will prevent + // the app from stabilizing. See https://angular.io/api/core/ApplicationRef#is-stable-examples + // for more details. + // To allow the tests to complete, we will disable automatically waiting for the Angular app to + // stabilize. + beforeAll(() => browser.waitForAngularEnabled(false)); + afterAll(() => browser.waitForAngularEnabled(true)); - it('should load ad banner', () => { - const headline = element(by.xpath("//h4[text()='Featured Hero Profile']")); - const name = element(by.xpath("//h3[text()='Bombasto']")); - const bio = element(by.xpath("//p[text()='Brave as they come']")); + beforeEach(() => browser.get('')); - expect(name).toBeDefined(); - expect(headline).toBeDefined(); - expect(bio).toBeDefined(); + it('should load ad banner', async () => { + const headline = element(by.cssContainingText('h3', 'Featured Hero Profile')); + const name = element(by.cssContainingText('h4', 'Bombasto')); + const bio = element(by.cssContainingText('p', 'Brave as they come')); + + expect(await headline.isPresent()).toBe(true); + expect(await name.isPresent()).toBe(true); + expect(await bio.isPresent()).toBe(true); }); });