mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
refactor(core): Update flaky test with wait condition (#53437)
The tests in this commit have been flaky commonly due to the elements not being found. Hopefully using `ExpectedConditions` helps. PR Close #53437
This commit is contained in:
parent
7a28f50711
commit
44f9f0108e
2 changed files with 6 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { element, by } from 'protractor';
|
||||
import { element, by, ExpectedConditions, browser } from 'protractor';
|
||||
import { AppPage } from './app.po';
|
||||
|
||||
|
||||
|
|
@ -22,6 +22,7 @@ describe('providers App', () => {
|
|||
|
||||
it('should show customers when the button is clicked', async () => {
|
||||
const customersMessage = element(by.css('app-customers > p'));
|
||||
await browser.wait(ExpectedConditions.visibilityOf(customersMessage));
|
||||
expect(await customersMessage.getText()).toBe('customers works!');
|
||||
});
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ describe('providers App', () => {
|
|||
|
||||
it('should show orders when the button is clicked', async () => {
|
||||
const ordersMessage = element(by.css('app-orders > p'));
|
||||
await browser.wait(ExpectedConditions.visibilityOf(ordersMessage));
|
||||
expect(await ordersMessage.getText()).toBe('orders works!');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { element, by } from 'protractor';
|
||||
import { element, by, ExpectedConditions, browser } from 'protractor';
|
||||
import { AppPage } from './app.po';
|
||||
|
||||
|
||||
|
|
@ -22,6 +22,7 @@ describe('providers App', () => {
|
|||
|
||||
it('should show customers when the button is clicked', async () => {
|
||||
const customersMessage = element(by.css('app-customers > p'));
|
||||
await browser.wait(ExpectedConditions.visibilityOf(customersMessage));
|
||||
expect(await customersMessage.getText()).toBe('customers works!');
|
||||
});
|
||||
|
||||
|
|
@ -32,6 +33,7 @@ describe('providers App', () => {
|
|||
|
||||
it('should show orders when the button is clicked', async () => {
|
||||
const ordersMessage = element(by.css('app-orders > p'));
|
||||
await browser.wait(ExpectedConditions.visibilityOf(ordersMessage));
|
||||
expect(await ordersMessage.getText()).toBe('orders works!');
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue