diff --git a/aio/content/examples/component-interaction/e2e/src/app.e2e-spec.ts b/aio/content/examples/component-interaction/e2e/src/app.e2e-spec.ts index ea6a998285..d5727cc70c 100644 --- a/aio/content/examples/component-interaction/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/component-interaction/e2e/src/app.e2e-spec.ts @@ -145,19 +145,25 @@ describe('Component Communication Cookbook Tests', () => { // #enddocregion child-to-parent }); - // Can't run timer tests in protractor because - // interaction w/ zones causes all tests to freeze & timeout. - xdescribe('Parent calls child via local var', () => { + describe('Parent calls child via local var', () => { countDownTimerTests('app-countdown-parent-lv'); }); - xdescribe('Parent calls ViewChild', () => { + describe('Parent calls ViewChild', () => { countDownTimerTests('app-countdown-parent-vc'); }); function countDownTimerTests(parentTag: string) { // #docregion countdown-timer-tests // ... + // 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. + beforeEach(() => browser.waitForAngularEnabled(false)); + afterEach(() => browser.waitForAngularEnabled(true)); + it('timer and parent seconds should match', async () => { const parent = element(by.tagName(parentTag)); const startButton = parent.element(by.buttonText('Start')); @@ -165,7 +171,9 @@ describe('Component Communication Cookbook Tests', () => { const timer = parent.element(by.tagName('app-countdown-timer')); await startButton.click(); - await browser.sleep(10); // give `seconds` a chance to catchup with `timer` + + // Wait for `` to be populated with any text. + await browser.wait(() => timer.getText(), 2000); expect(await timer.getText()).toContain(await seconds.getText()); });