test(elements): make e2e tests for elements docs examples even less flaky (#26726)
PR Close #26726
This commit is contained in:
parent
1880c9531f
commit
54ea10288e
|
@ -13,6 +13,10 @@ describe('Elements', () => {
|
||||||
browser.wait(EC.elementToBeClickable(elem), 5000);
|
browser.wait(EC.elementToBeClickable(elem), 5000);
|
||||||
elem.click();
|
elem.click();
|
||||||
};
|
};
|
||||||
|
const waitForText = (elem: ElementFinder) => {
|
||||||
|
// Waiting for the element to have some text, makes the tests less flaky.
|
||||||
|
browser.wait(async () => /\S/.test(await elem.getText()), 5000);
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(() => browser.get(''));
|
beforeEach(() => browser.get(''));
|
||||||
|
|
||||||
|
@ -33,6 +37,8 @@ describe('Elements', () => {
|
||||||
messageInput.sendKeys('Angular rocks!');
|
messageInput.sendKeys('Angular rocks!');
|
||||||
|
|
||||||
click(popupComponentButton);
|
click(popupComponentButton);
|
||||||
|
waitForText(popupComponent);
|
||||||
|
|
||||||
expect(popupComponent.getText()).toContain('Popup: Angular rocks!');
|
expect(popupComponent.getText()).toContain('Popup: Angular rocks!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,6 +68,8 @@ describe('Elements', () => {
|
||||||
messageInput.sendKeys('Angular rocks!');
|
messageInput.sendKeys('Angular rocks!');
|
||||||
|
|
||||||
click(popupElementButton);
|
click(popupElementButton);
|
||||||
|
waitForText(popupElement);
|
||||||
|
|
||||||
expect(popupElement.getText()).toContain('Popup: Angular rocks!');
|
expect(popupElement.getText()).toContain('Popup: Angular rocks!');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue