@@ -5,7 +5,9 @@ namespace Bunit.Extensions.WaitForHelpers;
55
66public class RenderedFragmentWaitForElementsHelperExtensionsAsyncTest : TestContext
77{
8- public RenderedFragmentWaitForElementsHelperExtensionsAsyncTest ( ITestOutputHelper testOutput )
8+ private readonly static TimeSpan WaitForTestTimeout = TimeSpan . FromMilliseconds ( 5 ) ;
9+
10+ public RenderedFragmentWaitForElementsHelperExtensionsAsyncTest ( ITestOutputHelper testOutput )
911 {
1012 Services . AddXunitLogger ( testOutput ) ;
1113 }
@@ -29,7 +31,7 @@ public async Task Test002()
2931 var cut = RenderComponent < DelayRenderFragment > ( ) ;
3032
3133 var expected = await Should . ThrowAsync < WaitForFailedException > ( async ( ) =>
32- await cut . WaitForElementAsync ( "#notHereElm" , TimeSpan . FromMilliseconds ( 10 ) ) ) ;
34+ await cut . WaitForElementAsync ( "#notHereElm" , WaitForTestTimeout ) ) ;
3335
3436 expected . Message . ShouldStartWith ( WaitForElementHelper . TimeoutBeforeFoundMessage ) ;
3537 }
@@ -53,7 +55,7 @@ public async Task Test022()
5355 var cut = RenderComponent < DelayRenderFragment > ( ) ;
5456
5557 var expected = await Should . ThrowAsync < WaitForFailedException > ( async ( ) =>
56- await cut . WaitForElementsAsync ( "#notHereElm" , TimeSpan . FromMilliseconds ( 30 ) ) ) ;
58+ await cut . WaitForElementsAsync ( "#notHereElm" , WaitForTestTimeout ) ) ;
5759
5860 expected . Message . ShouldStartWith ( WaitForElementsHelper . TimeoutBeforeFoundMessage ) ;
5961 expected . InnerException . ShouldBeNull ( ) ;
@@ -66,7 +68,7 @@ public async Task Test023()
6668 var cut = RenderComponent < DelayRenderFragment > ( ) ;
6769
6870 var expected = await Should . ThrowAsync < WaitForFailedException > ( async ( ) =>
69- await cut . WaitForElementsAsync ( "#notHereElm" , 2 , TimeSpan . FromMilliseconds ( 30 ) ) ) ;
71+ await cut . WaitForElementsAsync ( "#notHereElm" , 2 , WaitForTestTimeout ) ) ;
7072
7173 expected . Message . ShouldStartWith ( string . Format ( CultureInfo . InvariantCulture , WaitForElementsHelper . TimeoutBeforeFoundWithCountMessage , 2 ) ) ;
7274 expected . InnerException . ShouldBeNull ( ) ;
0 commit comments