Skip to content

Commit 73abbda

Browse files
committed
NonInteractivityTests contain tests that require supression and tests that don't support session storage at the same time. Allow single tests to request id assignment.
1 parent 08c99cf commit 73abbda

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static void SuppressEnhancedNavigation<TServerFixture>(ServerTestBase<TSe
2323
var testId = ((IJavaScriptExecutor)browser).ExecuteScript($"return sessionStorage.getItem('test-id')");
2424
if (testId == null)
2525
{
26-
throw new InvalidOperationException("Test ID not found in sessionStorage. Ensure that suppression is enabled by passing `supportEnhancedNavigationSuppression: true` to InitializeAsync.");
26+
throw new InvalidOperationException("Test ID not found in sessionStorage. Ensure that suppression is enabled for test class by passing `supportEnhancedNavigationSuppression: true` to InitializeAsync or for a given test by calling `GrantTestId()` in the beginning of the test.");
2727
}
2828

2929
if (!skipNavigation)

src/Components/test/E2ETest/ServerRenderingTests/NoInteractivityTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ public void NotFoundSetOnInitialization_ResponseStarted_SSR(bool hasReExecutionM
285285
[InlineData(false, true)]
286286
public void NotFoundSetOnInitialization_ResponseStarted_EnhancedNavigationDisabled_SSR(bool hasReExecutionMiddleware, bool hasCustomNotFoundPageSet)
287287
{
288+
GrantTestId();
288289
EnhancedNavigationTestUtil.SuppressEnhancedNavigation(this, true, skipNavigation: true);
289290
string reexecution = hasReExecutionMiddleware ? "/reexecution" : "";
290291
string testUrl = $"{ServerPathBase}{reexecution}/set-not-found-ssr-streaming?useCustomNotFoundPage={hasCustomNotFoundPageSet}";

src/Shared/E2ETesting/BrowserTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public virtual Task InitializeAsync(string isolationContext, bool supportEnhance
6969
return Task.CompletedTask;
7070
}
7171

72-
private void GrantTestId()
72+
protected void GrantTestId()
7373
{
7474
var testId = Guid.NewGuid().ToString("N")[..8];
7575
((IJavaScriptExecutor)Browser).ExecuteScript($"sessionStorage.setItem('test-id', '{testId}')");

0 commit comments

Comments
 (0)