Skip to content

Fix flaky EnhancedNavigationTest by using retry-based assertions#66327

Merged
ilonatommy merged 1 commit into
mainfrom
fix/flaky-enhanced-nav-test
Apr 16, 2026
Merged

Fix flaky EnhancedNavigationTest by using retry-based assertions#66327
ilonatommy merged 1 commit into
mainfrom
fix/flaky-enhanced-nav-test

Conversation

@ilonatommy
Copy link
Copy Markdown
Member

Replace Assert.EndsWith (point-in-time) with Browser.True(() => ...EndsWith(...)) (retry-based) for assertions that follow a Click() triggering enhanced navigation. The race condition caused the assertion to read the URI before the navigation completed and the query string was appended.

Fixes #66310

@ilonatommy ilonatommy self-assigned this Apr 15, 2026
@ilonatommy ilonatommy requested a review from a team as a code owner April 15, 2026 13:29
Copilot AI review requested due to automatic review settings April 15, 2026 13:29
@ilonatommy ilonatommy added area-blazor Includes: Blazor, Razor Components feature-blazor-enhanced-navigation labels Apr 15, 2026
@ilonatommy ilonatommy force-pushed the fix/flaky-enhanced-nav-test branch from a744aa3 to 044cadc Compare April 15, 2026 13:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses flakiness in Components enhanced-navigation E2E coverage by replacing point-in-time URI assertions with retry-based assertions, ensuring the test waits for navigation/query-string updates to complete before validating NavigationManager.Uri.

Changes:

  • Replace Assert.EndsWith(...) URI assertions with retry-based Browser.True(() => ...EndsWith(...)) for enhanced-navigation flows.
  • Use StringComparison.Ordinal for deterministic URL suffix comparisons.
  • Remove the quarantine marker from the previously flaky test.

Comment thread src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs Outdated
Comment thread src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs Outdated
Replace Assert.EndsWith (point-in-time) with Browser.True(() => ...EndsWith(...))
(retry-based) for assertions that follow a Click() triggering enhanced
navigation. The race condition caused the assertion to read the URI before
the navigation completed and the query string was appended.

Fixes #66310

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@ilonatommy ilonatommy force-pushed the fix/flaky-enhanced-nav-test branch from 044cadc to c6a3804 Compare April 15, 2026 13:41
@ilonatommy ilonatommy enabled auto-merge (squash) April 15, 2026 13:59
@ilonatommy ilonatommy merged commit c15ad94 into main Apr 16, 2026
25 checks passed
@ilonatommy ilonatommy deleted the fix/flaky-enhanced-nav-test branch April 16, 2026 09:49
@dotnet-policy-service dotnet-policy-service Bot added this to the 11.0-preview4 milestone Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components feature-blazor-enhanced-navigation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quarantine EnhancedNavigationTest.NavigationManagerUriGetsUpdatedOnEnhancedNavigation_OnlyServerOrWebAssembly is flaky

3 participants