ci(docs-infra): wait for conditions to reduce flakiness on CI (#29757)

PR Close #29757
This commit is contained in:
George Kalpakas 2019-04-25 12:29:42 +03:00 committed by Andrew Kushnir
parent 00866186a7
commit 9914998e76
2 changed files with 10 additions and 3 deletions

View File

@ -17,6 +17,7 @@ describe('Attribute directives', () => {
it('should be able to select green highlight', () => { it('should be able to select green highlight', () => {
const highlightedEle = element(by.cssContainingText('p', 'Highlight me!')); const highlightedEle = element(by.cssContainingText('p', 'Highlight me!'));
const lightGreen = 'rgba(144, 238, 144, 1)'; const lightGreen = 'rgba(144, 238, 144, 1)';
const getBgColor = () => highlightedEle.getCssValue('background-color');
expect(highlightedEle.getCssValue('background-color')).not.toEqual(lightGreen); expect(highlightedEle.getCssValue('background-color')).not.toEqual(lightGreen);
@ -24,6 +25,8 @@ describe('Attribute directives', () => {
greenRb.click(); greenRb.click();
browser.actions().mouseMove(highlightedEle).perform(); 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);
}); });
}); });

View File

@ -73,8 +73,12 @@ describe('Dependency Injection Cookbook', function () {
let yellow = 'rgba(255, 255, 0, 1)'; let yellow = 'rgba(255, 255, 0, 1)';
expect(target.getCssValue('background-color')).not.toEqual(yellow); 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 () { describe('in Parent Finder', function () {