Reputation: 73
I understand how to use waitFor
with a simple function, but I can't imaging a good use case to use it with a Promise. Do you have an idea? TY
Upvotes: 0
Views: 1808
Reputation: 1808
waitFor
will wait for the callback to not throw an error, so you can always await
the promise inside waitFor
.
await waitFor(async () => await new Promise(...))
Btw most of the time you can just await
the promise without the need for waitFor
. A good example would be the findBy
methods:
await findBy('#someId')
Upvotes: 2