From ea136d06be0d814b5c234138858b0728ff4ac595 Mon Sep 17 00:00:00 2001 From: Tanay Parikh Date: Tue, 20 Apr 2021 15:22:54 -0700 Subject: [PATCH 1/2] Remove await for WASM `platform.callEntryPoint` Also added an E2E test. Addresses #31971 Insertion into preview 4: https://github.com/dotnet/aspnetcore/pull/31978 --- src/Components/Web.JS/src/Boot.WebAssembly.ts | 2 +- .../testassets/StandaloneApp/wwwroot/index.html | 9 ++++++++- .../test/E2ETest/Tests/StandaloneAppTest.cs | 16 ++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Components/Web.JS/src/Boot.WebAssembly.ts b/src/Components/Web.JS/src/Boot.WebAssembly.ts index 102bbd830b36..5fd2f2bffc46 100644 --- a/src/Components/Web.JS/src/Boot.WebAssembly.ts +++ b/src/Components/Web.JS/src/Boot.WebAssembly.ts @@ -119,7 +119,7 @@ async function boot(options?: Partial): Promise { } // Start up the application - await platform.callEntryPoint(resourceLoader.bootConfig.entryAssembly); + platform.callEntryPoint(resourceLoader.bootConfig.entryAssembly); } function invokeJSFromDotNet(callInfo: Pointer, arg0: any, arg1: any, arg2: any): any { diff --git a/src/Components/WebAssembly/testassets/StandaloneApp/wwwroot/index.html b/src/Components/WebAssembly/testassets/StandaloneApp/wwwroot/index.html index 8828febac2bf..083f2f53346a 100644 --- a/src/Components/WebAssembly/testassets/StandaloneApp/wwwroot/index.html +++ b/src/Components/WebAssembly/testassets/StandaloneApp/wwwroot/index.html @@ -18,6 +18,13 @@ 🗙 - + + diff --git a/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs b/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs index d94eb117f7db..5127b9a7d9d2 100644 --- a/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs +++ b/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs @@ -108,6 +108,22 @@ public void HasFetchDataPage() } } + [Fact] + public void IsStarted() + { + // Read from property + var jsExecutor = (IJavaScriptExecutor)Browser; + + var isStarted = jsExecutor.ExecuteScript("return window['__aspnetcore__testing__blazor_wasm__started__'];"); + if (isStarted is null) + { + Assert.True(false, "Blazor wasm started value not set"); + } + + // Confirm server has started + Assert.True((bool)isStarted); + } + private void WaitUntilLoaded() { var app = Browser.Exists(By.TagName("app")); From fa029e6ac6e6862d0f8f428ce5c67e416371804b Mon Sep 17 00:00:00 2001 From: Tanay Parikh Date: Tue, 20 Apr 2021 16:19:45 -0700 Subject: [PATCH 2/2] Update src/Components/test/E2ETest/Tests/StandaloneAppTest.cs --- src/Components/test/E2ETest/Tests/StandaloneAppTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs b/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs index 5127b9a7d9d2..2bc38a1c1a23 100644 --- a/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs +++ b/src/Components/test/E2ETest/Tests/StandaloneAppTest.cs @@ -117,7 +117,7 @@ public void IsStarted() var isStarted = jsExecutor.ExecuteScript("return window['__aspnetcore__testing__blazor_wasm__started__'];"); if (isStarted is null) { - Assert.True(false, "Blazor wasm started value not set"); + throw new InvalidOperationException("Blazor wasm started value not set"); } // Confirm server has started