Improve enhanced navigation suppression in tests #63132
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
because the first thing they do is suppression, without navigation to any page (they are in
about:blank
state, with nowindow
object). For these tests, initial navigation toServerPathBase
could solve the problem, working on it.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