Skip to content

Improve enhanced navigation suppression in tests #63132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

ilonatommy
Copy link
Member

@ilonatommy ilonatommy commented Aug 5, 2025

Suppress enhanced navigation once per test

Enhanced navigation suppression was per page, after navigating away we were falling back to enhanced navigation, regardless of the test settings. It's because we were treating the storage as temporary measure where we were setting the suppression flag and instantly removing it after reading it in blazor start function. For tests that never navigated away (did not re-trigger blazor boot function) it was enough but for other ones, not.

Description

  • The enhanced navigation suppression flag has short guid of test. We can set it once and never remove from the session storage because it's unique per test instance.

  • Because we never remove it, consecutive navigations will run with same settings as the first page load.

  • This PR fixed order of actions: we should navigate to a page only after the suppression method got called.

  • It also enabled tests that got disabled because of issues with non deterministic behavior when enhanced navigation is suppressed.

  • PROBLEM Not all types of tests can use the storage:

  Failed Microsoft.AspNetCore.Components.E2ETest.ServerExecutionTests.ServerAuthTest.AuthorizeViewCases_RequirePolicy_Authorized [1 ms]
  Error Message:
   OpenQA.Selenium.UnsupportedOperationException : <unknown>: Failed to read the 'sessionStorage' property from 'Window': Storage is disabled inside 'data:' URLs.

because the first thing they do is suppression, without navigation to any page (they are in about:blank state, with no window object). For these tests, initial navigation to ServerPathBase could solve the problem, working on it.

  • Passing supportEnhancedNavigationSupression to initialization method is required to conditionally enable this feature for the entire test file. If new tests are added and will try to suppress without this setup, they will get a descriptive exception on how to enable it.

Fixes #60875

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 test-fixed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quarantine EnhancedNavigationScrollBehavesSameAsBrowserOnNavigation
1 participant