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:
Andrew Scott 2023-12-07 14:59:20 -08:00 committed by Alex Rickabaugh
parent 7a28f50711
commit 44f9f0108e
2 changed files with 6 additions and 2 deletions

View file

@ -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!');
});

View file

@ -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!');
});