From 243b0653522c2b91a2e15474b4a7f1cf831bbbc3 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Mon, 4 Mar 2024 09:11:13 -0500 Subject: [PATCH] Fix waitUntil usage examples (#329) --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 56c24386..11da0bfc 100644 --- a/README.md +++ b/README.md @@ -315,21 +315,21 @@ it('should not wait', async() => { #### Waiting for a Condition -In cases where there are no other reliable hooks (like events, `getUpdateComplete()` or `getLoadingComplete()`), `waitUntil(condition)` can be used to wait for a particular condition to become `true`. The condition can optionally return a Promise. +In cases where there are no other reliable hooks (like events, `getUpdateComplete()` or `getLoadingComplete()`), `waitUntil(condition, failMessage)` can be used to wait for a particular condition to become `true`. The condition can optionally return a Promise. ```javascript import { fixture, waitUntil } from '@brightspace-ui/testing'; it('should wait for condition', async() => { const elem = await fixture(...); - await waitUntil(() => elem.foo === 'bar'); + await waitUntil(() => elem.foo === 'bar', 'foo never became "bar"'); }); ``` By default, `waitUntil` will poll every `50ms` and time out after `1000ms`. Those options can be configured: ```javascript -await waitUntil(() => elem.condition, { +await waitUntil(() => elem.condition, 'Condition was never met', { interval: 10, timeout: 2000 });