@@ -597,22 +597,6 @@ public void DynamicallyAddedSsrComponents_CanGetRemoved_BeforeStreamingRendering
597597 AssertBrowserLogDoesNotContainErrors ( ) ;
598598 }
599599
600- [ Fact ]
601- public void AutoRenderMode_UsesBlazorServer_IfWebAssemblyResourcesTakeTooLongToLoad ( )
602- {
603- Navigate ( ServerPathBase ) ;
604- Browser . Equal ( "Hello" , ( ) => Browser . Exists ( By . TagName ( "h1" ) ) . Text ) ;
605- ForceWebAssemblyResourceCacheMiss ( ) ;
606- BlockWebAssemblyResourceLoad ( ) ;
607-
608- Navigate ( $ "{ ServerPathBase } /streaming-interactivity") ;
609- Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
610-
611- Browser . Click ( By . Id ( AddAutoPrerenderedId ) ) ;
612- Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( "is-interactive-0" ) ) . Text ) ;
613- Browser . Equal ( "Server" , ( ) => Browser . FindElement ( By . Id ( "render-mode-0" ) ) . Text ) ;
614- }
615-
616600 [ Fact ]
617601 public void AutoRenderMode_UsesBlazorWebAssembly_AfterAddingWebAssemblyRootComponent ( )
618602 {
@@ -659,8 +643,6 @@ public void AutoRenderMode_UsesBlazorServerOnFirstLoad_ThenWebAssemblyOnSuccessi
659643 Navigate ( ServerPathBase ) ;
660644 Browser . Equal ( "Hello" , ( ) => Browser . Exists ( By . TagName ( "h1" ) ) . Text ) ;
661645 BlockWebAssemblyResourceLoad ( ) ;
662- UseLongWebAssemblyLoadTimeout ( ) ;
663- ForceWebAssemblyResourceCacheMiss ( ) ;
664646
665647 Navigate ( $ "{ ServerPathBase } /streaming-interactivity") ;
666648 Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
@@ -697,8 +679,6 @@ public void AutoRenderMode_UsesBlazorServer_IfBootResourceHashChanges()
697679 Navigate ( ServerPathBase ) ;
698680 Browser . Equal ( "Hello" , ( ) => Browser . Exists ( By . TagName ( "h1" ) ) . Text ) ;
699681 BlockWebAssemblyResourceLoad ( ) ;
700- UseLongWebAssemblyLoadTimeout ( ) ;
701- ForceWebAssemblyResourceCacheMiss ( ) ;
702682
703683 Navigate ( $ "{ ServerPathBase } /streaming-interactivity") ;
704684 Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
@@ -715,14 +695,11 @@ public void AutoRenderMode_UsesBlazorServer_IfBootResourceHashChanges()
715695 Browser . Click ( By . Id ( $ "remove-counter-link-1") ) ;
716696 Browser . DoesNotExist ( By . Id ( "is-interactive-1" ) ) ;
717697
718- UseLongWebAssemblyLoadTimeout ( ) ;
719698 Browser . Navigate ( ) . Refresh ( ) ;
720699
721700 Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( "is-interactive-0" ) ) . Text ) ;
722701 Browser . Equal ( "WebAssembly" , ( ) => Browser . FindElement ( By . Id ( "render-mode-0" ) ) . Text ) ;
723702
724- BlockWebAssemblyResourceLoad ( ) ;
725- UseLongWebAssemblyLoadTimeout ( ) ;
726703 ForceWebAssemblyResourceCacheMiss ( "dummy hash" ) ;
727704 Browser . Navigate ( ) . Refresh ( ) ;
728705
@@ -766,8 +743,6 @@ public void AutoRenderMode_CanUseBlazorServer_WhenMultipleAutoComponentsAreAdded
766743 Navigate ( ServerPathBase ) ;
767744 Browser . Equal ( "Hello" , ( ) => Browser . Exists ( By . TagName ( "h1" ) ) . Text ) ;
768745 BlockWebAssemblyResourceLoad ( ) ;
769- UseLongWebAssemblyLoadTimeout ( ) ;
770- ForceWebAssemblyResourceCacheMiss ( ) ;
771746
772747 Navigate ( $ "{ ServerPathBase } /streaming-interactivity") ;
773748 Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
@@ -911,6 +886,36 @@ public void AutoRenderMode_UsesBlazorServer_AfterWebAssemblyComponentsNoLongerEx
911886 Browser . Equal ( "Server" , ( ) => Browser . FindElement ( By . Id ( "render-mode-3" ) ) . Text ) ;
912887 }
913888
889+ [ Fact ]
890+ public void WebAssemblyRenderMode_DownloadsWebAssemblyResourcesInParallel ( )
891+ {
892+ Navigate ( $ "{ ServerPathBase } /streaming-interactivity?ClearSiteData=True") ;
893+ Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
894+
895+ Browser . Click ( By . Id ( AddWebAssemblyPrerenderedId ) ) ;
896+ Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( "is-interactive-0" ) ) . Text ) ;
897+ Browser . Equal ( "WebAssembly" , ( ) => Browser . FindElement ( By . Id ( "render-mode-0" ) ) . Text ) ;
898+
899+ Browser . True ( ( ) => GetMaxParallelWebAssemblyResourceDownloadCount ( ) > 1 ) ;
900+ }
901+
902+ [ Fact ]
903+ public void AutoRenderMode_DoesNotDownloadWebAssemblyResourcesInParallel ( )
904+ {
905+ Navigate ( $ "{ ServerPathBase } /streaming-interactivity?ClearSiteData=True") ;
906+ Browser . Equal ( "Not streaming" , ( ) => Browser . FindElement ( By . Id ( "status" ) ) . Text ) ;
907+
908+ Browser . Click ( By . Id ( AddAutoPrerenderedId ) ) ;
909+ Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( "is-interactive-0" ) ) . Text ) ;
910+ Browser . Equal ( "Server" , ( ) => Browser . FindElement ( By . Id ( "render-mode-0" ) ) . Text ) ;
911+
912+ Browser . Click ( By . Id ( AddWebAssemblyPrerenderedId ) ) ;
913+ Browser . Equal ( "True" , ( ) => Browser . FindElement ( By . Id ( "is-interactive-1" ) ) . Text ) ;
914+ Browser . Equal ( "WebAssembly" , ( ) => Browser . FindElement ( By . Id ( "render-mode-1" ) ) . Text ) ;
915+
916+ Browser . Equal ( 1 , GetMaxParallelWebAssemblyResourceDownloadCount ) ;
917+ }
918+
914919 [ Fact ]
915920 public void Circuit_ShutsDown_WhenAllBlazorServerComponentsGetRemoved ( )
916921 {
@@ -1135,6 +1140,9 @@ public void NavigationManagerCanRefreshSSRPageWhenServerInteractivityEnabled()
11351140
11361141 private void BlockWebAssemblyResourceLoad ( )
11371142 {
1143+ // Force a WebAssembly resource cache miss so that we can fall back to using server interactivity
1144+ ForceWebAssemblyResourceCacheMiss ( ) ;
1145+
11381146 ( ( IJavaScriptExecutor ) Browser ) . ExecuteScript ( "sessionStorage.setItem('block-load-boot-resource', 'true')" ) ;
11391147
11401148 // Clear caches so that we can block the resource load
@@ -1146,11 +1154,6 @@ private void UnblockWebAssemblyResourceLoad()
11461154 ( ( IJavaScriptExecutor ) Browser ) . ExecuteScript ( "window.unblockLoadBootResource()" ) ;
11471155 }
11481156
1149- private void UseLongWebAssemblyLoadTimeout ( )
1150- {
1151- ( ( IJavaScriptExecutor ) Browser ) . ExecuteScript ( "sessionStorage.setItem('use-long-auto-timeout', 'true')" ) ;
1152- }
1153-
11541157 private void ForceWebAssemblyResourceCacheMiss ( string resourceHash = null )
11551158 {
11561159 if ( resourceHash is not null )
@@ -1164,6 +1167,11 @@ private void ForceWebAssemblyResourceCacheMiss(string resourceHash = null)
11641167 }
11651168 }
11661169
1170+ private long GetMaxParallelWebAssemblyResourceDownloadCount ( )
1171+ {
1172+ return ( long ) ( ( IJavaScriptExecutor ) Browser ) . ExecuteScript ( "return window['__aspnetcore__testing__max__parallel__resource__download__count'] || 0;" ) ;
1173+ }
1174+
11671175 private string InteractiveCallsiteUrl ( bool prerender , int ? serverIncrement = default , int ? webAssemblyIncrement = default )
11681176 {
11691177 var result = $ "{ ServerPathBase } /interactive-callsite?suppress-autostart&prerender={ prerender } ";
0 commit comments