From 59e7d2fba83eb7ec3e24027129f39b64dc5f68bc Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:20:46 +0000 Subject: [PATCH 1/9] Fix: `OnPageLoaded` did not guarantee WASM got already loaded. --- src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorRunOptions.cs | 1 - src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs | 1 - src/mono/wasm/Wasm.Build.Tests/BrowserRunner.cs | 6 +----- .../wasm/Wasm.Build.Tests/TestAppScenarios/AppTestBase.cs | 2 -- .../Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs | 4 +++- .../BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor | 2 +- 6 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorRunOptions.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorRunOptions.cs index 1b8145c69ae7d..c0e2a2e60cce0 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorRunOptions.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorRunOptions.cs @@ -16,7 +16,6 @@ public record BlazorRunOptions bool CheckCounter = true, Dictionary? ServerEnvironment = null, Func? Test = null, - Action? OnPageLoaded = null, Action? OnConsoleMessage = null, Action? OnServerMessage = null, Action? OnErrorMessage = null, diff --git a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs index d66fa1d04a0fb..da9c7764f2d1f 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Blazor/BlazorWasmTestBase.cs @@ -202,7 +202,6 @@ public async Task BlazorRunTest(string runArgs, var page = await runner.RunAsync( runCommand, runArgs, - onPageLoaded: runOptions.OnPageLoaded, onConsoleMessage: OnConsoleMessage, onServerMessage: runOptions.OnServerMessage, onError: OnErrorMessage, diff --git a/src/mono/wasm/Wasm.Build.Tests/BrowserRunner.cs b/src/mono/wasm/Wasm.Build.Tests/BrowserRunner.cs index 291c2d472ea06..c29233c698441 100644 --- a/src/mono/wasm/Wasm.Build.Tests/BrowserRunner.cs +++ b/src/mono/wasm/Wasm.Build.Tests/BrowserRunner.cs @@ -122,7 +122,6 @@ public async Task RunAsync( string args, bool headless = true, Action? onConsoleMessage = null, - Action? onPageLoaded = null, Action? onServerMessage = null, Action? onError = null, Func? modifyBrowserUrl = null) @@ -130,14 +129,13 @@ public async Task RunAsync( var urlString = await StartServerAndGetUrlAsync(cmd, args, onServerMessage); var browser = await SpawnBrowserAsync(urlString, headless); var context = await browser.NewContextAsync(); - return await RunAsync(context, urlString, headless, onPageLoaded, onConsoleMessage, onError, modifyBrowserUrl); + return await RunAsync(context, urlString, headless, onConsoleMessage, onError, modifyBrowserUrl); } public async Task RunAsync( IBrowserContext context, string browserUrl, bool headless = true, - Action? onPageLoaded = null, Action? onConsoleMessage = null, Action? onError = null, Func? modifyBrowserUrl = null, @@ -150,8 +148,6 @@ public async Task RunAsync( browserUrl = modifyBrowserUrl(browserUrl); IPage page = await context.NewPageAsync(); - if (onPageLoaded is not null) - page.Load += (_, _) => onPageLoaded(page); if (onConsoleMessage is not null) page.Console += (_, msg) => onConsoleMessage(page, msg); diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/AppTestBase.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/AppTestBase.cs index 7647b16586209..01a1afe96c0bb 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/AppTestBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/AppTestBase.cs @@ -110,7 +110,6 @@ private async Task RunSdkStyleApp(RunOptions options, BlazorRunHost h CheckCounter: false, Config: options.Configuration, ServerEnvironment: options.ServerEnvironment, - OnPageLoaded: options.OnPageLoaded, OnConsoleMessage: OnConsoleMessage, OnServerMessage: OnServerMessage, BrowserPath: options.BrowserPath, @@ -170,7 +169,6 @@ protected record RunOptions( string? TestScenario = null, Dictionary BrowserQueryString = null, Dictionary ServerEnvironment = null, - Action OnPageLoaded = null, Action OnConsoleMessage = null, Action OnServerMessage = null, int? ExpectedExitCode = 0 diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index b1e46d5110067..bc7500c8c00f9 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -47,7 +47,6 @@ public async Task SignalRPassMessages(string config, string transport) ServerEnvironment: new Dictionary { ["ASPNETCORE_ENVIRONMENT"] = "Development" }, BrowserPath: "/chat", BrowserQueryString: new Dictionary { ["transport"] = transport, ["message"] = "ping" }, - OnPageLoaded: async page => await page.ClickAsync("button#connectButton"), OnServerMessage: (msg) => { serverOutput.Add(msg); }, OnConsoleMessage: async (page, msg) => { @@ -55,6 +54,9 @@ public async Task SignalRPassMessages(string config, string transport) if (msg.Text.Contains("TestOutput ->")) _testOutput.WriteLine(msg.Text); + if (msg.Text.Contains("Finished GetQueryParameters")) + await page.ClickAsync("button#connectButton"); + if (msg.Text.Contains("SignalR connected")) await page.ClickAsync("button#subscribeButton"); diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index 22fc7317b7557..e3549b22948c6 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -49,7 +49,7 @@ } transport = Helper.GetValue(parameters, "transport"); message = $"{transport} {Helper.GetValue(parameters, "message")}" ; - Helper.TestOutputWriteLine($"GetQueryParameters on CurrentManagedThreadId={Environment.CurrentManagedThreadId} finished"); + Helper.TestOutputWriteLine($"Finished GetQueryParameters on CurrentManagedThreadId={Environment.CurrentManagedThreadId}."); } private async Task Connect() From 4b866c8b9e95f7fe92b1d41d5683daa3d950dff6 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 21 Mar 2024 12:33:53 +0000 Subject: [PATCH 2/9] Trigger the test only on first render, otherwise it would be triggered multiple times. --- .../TestAppScenarios/SignalRClientTests.cs | 3 +++ .../BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index bc7500c8c00f9..6768fcb2f9808 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -55,7 +55,10 @@ public async Task SignalRPassMessages(string config, string transport) _testOutput.WriteLine(msg.Text); if (msg.Text.Contains("Finished GetQueryParameters")) + { + await Task.Delay(500); // make sure OnAfterRender returned await page.ClickAsync("button#connectButton"); + } if (msg.Text.Contains("SignalR connected")) await page.ClickAsync("button#subscribeButton"); diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index e3549b22948c6..cd3c74cdd1546 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -30,9 +30,11 @@ protected override void OnAfterRender(bool firstRender) { base.OnAfterRender(firstRender); - - Helper.TestOutputWriteLine($"OnAfterRender on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); - GetQueryParameters(); + if (firstRender) + { + Helper.TestOutputWriteLine($"OnAfterRender on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); + GetQueryParameters(); + } } private void GetQueryParameters() From 435c52aa180540d0ac01ce0f4f844b47013dcce3 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:57:14 +0000 Subject: [PATCH 3/9] Add logs to see why the test timed out. --- .../Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index 6768fcb2f9808..5ff72c91787aa 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -47,10 +47,14 @@ public async Task SignalRPassMessages(string config, string transport) ServerEnvironment: new Dictionary { ["ASPNETCORE_ENVIRONMENT"] = "Development" }, BrowserPath: "/chat", BrowserQueryString: new Dictionary { ["transport"] = transport, ["message"] = "ping" }, - OnServerMessage: (msg) => { serverOutput.Add(msg); }, + OnServerMessage: (msg) => { + serverOutput.Add(msg); + Console.WriteLine($"[BUG_TRACKING_SERVER] {msg}"); + }, OnConsoleMessage: async (page, msg) => { consoleOutput.Add(msg.Text); + Console.WriteLine($"[BUG_TRACKING_CONSOLE] {msg.Text}"); if (msg.Text.Contains("TestOutput ->")) _testOutput.WriteLine(msg.Text); From 8b550be1df066309296f17b0c979531953e28ceb Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:00:03 +0000 Subject: [PATCH 4/9] Even more logging. --- .../BlazorHosted.Client/Pages/Chat.razor | 25 +++++++++++++++++++ .../BlazorHosted.Client/Program.cs | 4 +++ 2 files changed, 29 insertions(+) diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index cd3c74cdd1546..8767748a3b991 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -27,8 +27,33 @@ private List chatMessages = new List(); private string wrongQueryError = "Query string with parameters 'message' and 'transport' are required"; + public Chat() + { + Helper.TestOutputWriteLine("Chat component constructor called"); + } + + protected override void OnInitialized() + { + Helper.TestOutputWriteLine("OnInitialized"); + base.OnInitialized(); + } + + protected override void OnParametersSet() + { + Helper.TestOutputWriteLine("OnParametersSet"); + base.OnParametersSet(); + } + + protected override bool ShouldRender() + { + bool shouldRender = base.ShouldRender(); + Helper.TestOutputWriteLine($"ShouldRender = {shouldRender}"); + return shouldRender; + } + protected override void OnAfterRender(bool firstRender) { + Helper.TestOutputWriteLine($"OnAfterRender firstRender = {firstRender}"); base.OnAfterRender(firstRender); if (firstRender) { diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs index 67a2fb06d6a1e..a122b3e3f9c3d 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs @@ -5,9 +5,13 @@ using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; +Console.WriteLine($"Program.cs start"); var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); +builder.Logging.SetMinimumLevel(LogLevel.Debug); + +Console.WriteLine($"Program.cs builder created"); await builder.Build().RunAsync().ConfigureAwait(false); From 3c8a07d6e1d84826f4aec639b0c5753fa4932058 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:34:54 +0000 Subject: [PATCH 5/9] Most logging won't be useful - remove. --- .../TestAppScenarios/SignalRClientTests.cs | 6 +----- .../BlazorHosted.Client/Pages/Chat.razor | 20 +------------------ .../BlazorHosted.Client/Program.cs | 3 --- 3 files changed, 2 insertions(+), 27 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index 5ff72c91787aa..5b5769a56bc24 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -47,14 +47,10 @@ public async Task SignalRPassMessages(string config, string transport) ServerEnvironment: new Dictionary { ["ASPNETCORE_ENVIRONMENT"] = "Development" }, BrowserPath: "/chat", BrowserQueryString: new Dictionary { ["transport"] = transport, ["message"] = "ping" }, - OnServerMessage: (msg) => { - serverOutput.Add(msg); - Console.WriteLine($"[BUG_TRACKING_SERVER] {msg}"); - }, + OnServerMessage: (msg) => serverOutput.Add(msg), OnConsoleMessage: async (page, msg) => { consoleOutput.Add(msg.Text); - Console.WriteLine($"[BUG_TRACKING_CONSOLE] {msg.Text}"); if (msg.Text.Contains("TestOutput ->")) _testOutput.WriteLine(msg.Text); diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index 8767748a3b991..630cbf4ae7e41 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -27,23 +27,6 @@ private List chatMessages = new List(); private string wrongQueryError = "Query string with parameters 'message' and 'transport' are required"; - public Chat() - { - Helper.TestOutputWriteLine("Chat component constructor called"); - } - - protected override void OnInitialized() - { - Helper.TestOutputWriteLine("OnInitialized"); - base.OnInitialized(); - } - - protected override void OnParametersSet() - { - Helper.TestOutputWriteLine("OnParametersSet"); - base.OnParametersSet(); - } - protected override bool ShouldRender() { bool shouldRender = base.ShouldRender(); @@ -53,13 +36,12 @@ protected override void OnAfterRender(bool firstRender) { - Helper.TestOutputWriteLine($"OnAfterRender firstRender = {firstRender}"); - base.OnAfterRender(firstRender); if (firstRender) { Helper.TestOutputWriteLine($"OnAfterRender on CurrentManagedThreadId={Environment.CurrentManagedThreadId}"); GetQueryParameters(); } + base.OnAfterRender(firstRender); } private void GetQueryParameters() diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs index a122b3e3f9c3d..1f0fe1a65b3fa 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs @@ -5,13 +5,10 @@ using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -Console.WriteLine($"Program.cs start"); var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Logging.SetMinimumLevel(LogLevel.Debug); -Console.WriteLine($"Program.cs builder created"); - await builder.Build().RunAsync().ConfigureAwait(false); From e4f6b3c99252661b1a34e12fdc9c37c8b176c8d4 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Tue, 26 Mar 2024 08:19:08 +0000 Subject: [PATCH 6/9] Prevent no logs when error thrown in the app. --- .../Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs | 4 ++++ .../BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index 5b5769a56bc24..b9f2890d2f576 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -54,6 +54,10 @@ public async Task SignalRPassMessages(string config, string transport) if (msg.Text.Contains("TestOutput ->")) _testOutput.WriteLine(msg.Text); + // prevent timeouts with [Long Running Test] on error + if (msg.Text.Contains("[ERROR]")) + throw new Exception($"{_testOutput}\n{msg.Text}"); + if (msg.Text.Contains("Finished GetQueryParameters")) { await Task.Delay(500); // make sure OnAfterRender returned diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor index 630cbf4ae7e41..f90aa96c87b92 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Pages/Chat.razor @@ -27,6 +27,8 @@ private List chatMessages = new List(); private string wrongQueryError = "Query string with parameters 'message' and 'transport' are required"; + // remove when https://github.com/dotnet/runtime/issues/96546 is fixed + // log that rendering is about to start in case we hit the issue before OnAfterRender is called protected override bool ShouldRender() { bool shouldRender = base.ShouldRender(); From 2cd0a33691c6814aa01cdf9c2b09e9f36188aac6 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Wed, 27 Mar 2024 09:27:22 +0000 Subject: [PATCH 7/9] Cleanup. --- .../TestAppScenarios/SignalRClientTests.cs | 8 ++++++-- .../BlazorHostedApp/BlazorHosted.Client/Program.cs | 1 - 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index b9f2890d2f576..d3131846de9ed 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -55,8 +55,12 @@ public async Task SignalRPassMessages(string config, string transport) _testOutput.WriteLine(msg.Text); // prevent timeouts with [Long Running Test] on error - if (msg.Text.Contains("[ERROR]")) - throw new Exception($"{_testOutput}\n{msg.Text}"); + if (msg.Text.ToLowerInvariant().Contains.("error")) + { + Console.WriteLine(msg.Text); + Console.WriteLine(_testOutput); + throw new Exception(msg.Text); + } if (msg.Text.Contains("Finished GetQueryParameters")) { diff --git a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs index 1f0fe1a65b3fa..67a2fb06d6a1e 100644 --- a/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs +++ b/src/mono/wasm/testassets/BlazorHostedApp/BlazorHosted.Client/Program.cs @@ -9,6 +9,5 @@ builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); -builder.Logging.SetMinimumLevel(LogLevel.Debug); await builder.Build().RunAsync().ConfigureAwait(false); From 1a895b5e7fe16afae8848bf73727e88542f2d842 Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Wed, 27 Mar 2024 10:28:53 +0000 Subject: [PATCH 8/9] typo --- .../Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index d3131846de9ed..811288502c522 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -55,7 +55,7 @@ public async Task SignalRPassMessages(string config, string transport) _testOutput.WriteLine(msg.Text); // prevent timeouts with [Long Running Test] on error - if (msg.Text.ToLowerInvariant().Contains.("error")) + if (msg.Text.ToLowerInvariant().Contains("error")) { Console.WriteLine(msg.Text); Console.WriteLine(_testOutput); From 1c6334a816bb4c45c38f85f2659bf035ed4ea7fd Mon Sep 17 00:00:00 2001 From: Ilona Tomkowicz <32700855+ilonatommy@users.noreply.github.com> Date: Wed, 27 Mar 2024 15:12:45 +0000 Subject: [PATCH 9/9] @maraf's feedback - make waiting deterministic --- .../Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs index 811288502c522..eeda072308991 100644 --- a/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/SignalRClientTests.cs @@ -64,7 +64,8 @@ public async Task SignalRPassMessages(string config, string transport) if (msg.Text.Contains("Finished GetQueryParameters")) { - await Task.Delay(500); // make sure OnAfterRender returned + // first click after render - make sure buttons are available + await page.WaitForSelectorAsync("button#connectButton"); await page.ClickAsync("button#connectButton"); }