From 1c033059445bd956d84d8c84157afbd85accc7b9 Mon Sep 17 00:00:00 2001 From: Malcolm Smith <20709258+msmithNI@users.noreply.github.com> Date: Sun, 27 Oct 2024 14:52:33 -0500 Subject: [PATCH] Switch to extra wait --- .../NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js | 4 +--- .../SprightBlazor/wwwroot/SprightBlazor.lib.module.js | 4 +--- .../BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs | 3 +++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/blazor-workspace/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js b/packages/blazor-workspace/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js index 4f6cf5cee8..92caa4c71a 100644 --- a/packages/blazor-workspace/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js +++ b/packages/blazor-workspace/NimbleBlazor/wwwroot/NimbleBlazor.lib.module.js @@ -164,9 +164,7 @@ function registerNimbleEvents(Blazor) { } function handleRuntimeStarted() { - window.requestAnimationFrame(() => { - window.NimbleBlazor.hasRuntimeStarted = true; - }); + window.NimbleBlazor.hasRuntimeStarted = true; } // Blazor Web Apps diff --git a/packages/blazor-workspace/SprightBlazor/wwwroot/SprightBlazor.lib.module.js b/packages/blazor-workspace/SprightBlazor/wwwroot/SprightBlazor.lib.module.js index 3e41a1d69d..d520796138 100644 --- a/packages/blazor-workspace/SprightBlazor/wwwroot/SprightBlazor.lib.module.js +++ b/packages/blazor-workspace/SprightBlazor/wwwroot/SprightBlazor.lib.module.js @@ -35,9 +35,7 @@ export function registerSprightEvents(Blazor) { } function handleRuntimeStarted() { - window.requestAnimationFrame(() => { - window.NimbleBlazor.hasRuntimeStarted = true; - }); + window.NimbleBlazor.hasRuntimeStarted = true; } // Blazor Web Apps diff --git a/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs b/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs index 6615fd406d..2657f48a84 100644 --- a/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs +++ b/packages/blazor-workspace/Tests/BlazorWorkspace.Testing.Acceptance/AcceptanceTestsBase.cs @@ -33,6 +33,9 @@ private async Task NavigateToPageAsync(IPage page, string route) private async Task WaitForComponentsInitializationAsync(IPage page) { await page.WaitForFunctionAsync(ComponentLibraryInitializationTestJavaScript); + // Have encountered some test intermittency when interacting with the components immediately + // after the JS scripts report ready. Added an extra wait here to mitigate. + await Task.Delay(150); } protected sealed class AsyncDisposablePage : IAsyncDisposable