Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.
Update .net e2e playwright test navigation wait
Leendert de Borstfa9c863388e5
diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.csindex dfde635ba..c7b0ea294 100644--- a/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs+++ b/apps/server/Tests/AliasVault.E2ETests/Common/ClientPlaywrightTest.cs@@ -501,7 +501,7 @@ public class ClientPlaywrightTest : PlaywrightTest{// Try to register a new account.await NavigateUsingBlazorRouter("user/register");- await WaitForUrlAsync("user/register");+ await WaitForUrlAsync("user/register", "Create account");// Try to register an account with the generated test credentials.var emailField = await WaitForAndGetElement("input[id='email']");diff --git a/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs b/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.csindex 0949ced7a..2d5a3dbd7 100644--- a/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs+++ b/apps/server/Tests/AliasVault.E2ETests/Common/PlaywrightTest.cs@@ -111,23 +111,21 @@ public abstract class PlaywrightTest/// <returns>Task.</returns>protected async Task NavigateUsingBlazorRouter(string relativeUrl){- // Navigate to the app's base URL initially if not already there- if (!Page.Url.StartsWith(AppBaseUrl))- {- await Page.GotoAsync(AppBaseUrl);-- // Wait for Blazor to load completely- await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);- }-- // Perform soft navigation within the app- await Page.EvaluateAsync($"window.blazorNavigate('{relativeUrl}')");+ const int maxRetries = 3;- // Wait for the URL to change to the expected value- await Page.WaitForURLAsync("**/" + relativeUrl, new PageWaitForURLOptions+ for (int attempt = 1; attempt <= maxRetries; attempt++){- Timeout = TestDefaults.DefaultTimeout,- });+ try+ {+ await NavigateUsingBlazorRouterInternal(relativeUrl);+ return;+ }+ catch (TimeoutException) when (attempt < maxRetries)+ {+ Console.WriteLine($"Navigation to '{relativeUrl}' failed (attempt {attempt}/{maxRetries}), retrying...");+ await Task.Delay(500);+ }+ }}/// <summary>@@ -265,4 +263,40 @@ public abstract class PlaywrightTest/// </summary>/// <returns>Async task.</returns>protected abstract Task SetupEnvironment();++ /// <summary>+ /// Internal navigation implementation.+ /// </summary>+ /// <param name="relativeUrl">Relative URL.</param>+ /// <returns>Task.</returns>+ private async Task NavigateUsingBlazorRouterInternal(string relativeUrl)+ {+ // Navigate to the app's base URL initially if not already there+ if (!Page.Url.StartsWith(AppBaseUrl))+ {+ await Page.GotoAsync(AppBaseUrl);++ // Wait for Blazor to load completely+ await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);+ }++ // Check if we're already on the target URL (pattern matching)+ var targetPattern = new System.Text.RegularExpressions.Regex(@".*/" + System.Text.RegularExpressions.Regex.Escape(relativeUrl) + @"(\?.*)?$");+ var alreadyOnTarget = targetPattern.IsMatch(Page.Url);++ // Perform soft navigation within the app+ await Page.EvaluateAsync($"window.blazorNavigate('{relativeUrl}')");++ // Only wait for URL change if we weren't already on the target URL+ if (!alreadyOnTarget)+ {+ await Page.WaitForURLAsync("**/" + relativeUrl, new PageWaitForURLOptions+ {+ Timeout = TestDefaults.DefaultTimeout,+ });+ }++ // Always wait for the network to settle after navigation+ await Page.WaitForLoadStateAsync(LoadState.NetworkIdle);+ }}