Is your feature request related to a problem? Please describe.
On blazor unit tests, when we call RenderComponent, async calls in the render are not waited.
We use Thread.Sleep to wait an amount of time, without any guaranty that async calls are finished.
The usage of Thread.Sleep in unit tests produces random failures on CI pipelines.
Describe the solution you'd like
Replace the usage Thread.Sleep by:
WaitForAssertion
WaitForState
WaitForNextRender
Theses methods will block only the thread of test, not the rendrer and wait until the predicate/assertion passes or timeout.
Is your feature request related to a problem? Please describe. On blazor unit tests, when we call RenderComponent, async calls in the render are not waited. We use Thread.Sleep to wait an amount of time, without any guaranty that async calls are finished.
The usage of Thread.Sleep in unit tests produces random failures on CI pipelines.
Describe the solution you'd like Replace the usage Thread.Sleep by:
WaitForAssertion
WaitForState
WaitForNextRender
Theses methods will block only the thread of test, not the rendrer and wait until the predicate/assertion passes or timeout.
Examples:
Remark: The default timeout of the this methods is 1 second. We can change the value of this default timeout.
Additional context See also https://github.com/bUnit-dev/bUnit/issues/60