From 9914998e76f0bc52d8a05477bed05f8c53f4a6e0 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Thu, 25 Apr 2019 12:29:42 +0300 Subject: [PATCH] ci(docs-infra): wait for conditions to reduce flakiness on CI (#29757) PR Close #29757 --- .../examples/attribute-directives/e2e/src/app.e2e-spec.ts | 5 ++++- .../e2e/src/app.e2e-spec.ts | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/aio/content/examples/attribute-directives/e2e/src/app.e2e-spec.ts b/aio/content/examples/attribute-directives/e2e/src/app.e2e-spec.ts index ebc9d5e986..00ef4e33c6 100644 --- a/aio/content/examples/attribute-directives/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/attribute-directives/e2e/src/app.e2e-spec.ts @@ -17,6 +17,7 @@ describe('Attribute directives', () => { it('should be able to select green highlight', () => { const highlightedEle = element(by.cssContainingText('p', 'Highlight me!')); const lightGreen = 'rgba(144, 238, 144, 1)'; + const getBgColor = () => highlightedEle.getCssValue('background-color'); expect(highlightedEle.getCssValue('background-color')).not.toEqual(lightGreen); @@ -24,6 +25,8 @@ describe('Attribute directives', () => { greenRb.click(); browser.actions().mouseMove(highlightedEle).perform(); - expect(highlightedEle.getCssValue('background-color')).toEqual(lightGreen); + // Wait for up to 2s for the background color to be updated, + // to account for slow environments (e.g. CI). + browser.wait(() => highlightedEle.getCssValue('background-color').then(c => c === lightGreen), 2000); }); }); diff --git a/aio/content/examples/dependency-injection-in-action/e2e/src/app.e2e-spec.ts b/aio/content/examples/dependency-injection-in-action/e2e/src/app.e2e-spec.ts index 07ab501be7..00dd11868c 100644 --- a/aio/content/examples/dependency-injection-in-action/e2e/src/app.e2e-spec.ts +++ b/aio/content/examples/dependency-injection-in-action/e2e/src/app.e2e-spec.ts @@ -73,8 +73,12 @@ describe('Dependency Injection Cookbook', function () { let yellow = 'rgba(255, 255, 0, 1)'; expect(target.getCssValue('background-color')).not.toEqual(yellow); - browser.actions().mouseMove(target.getWebElement()).perform(); - expect(target.getCssValue('background-color')).toEqual(yellow); + + browser.actions().mouseMove(target).perform(); + + // Wait for up to 2s for the background color to be updated, + // to account for slow environments (e.g. CI). + browser.wait(() => target.getCssValue('background-color').then(c => c === yellow), 2000); }); describe('in Parent Finder', function () {