Skip to content

Commit 9a926ce

Browse files
committed
Use client redirect with url change when user dissbles enhanced navigation.
1 parent 975e250 commit 9a926ce

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ private void AssertNotFoundPageRendered()
127127
private void AssertUrlNotChanged(string expectedUrl) =>
128128
Browser.True(() => Browser.Url.Contains(expectedUrl), $"Expected URL to contain '{expectedUrl}', but found '{Browser.Url}'");
129129

130+
private void AssertUrlChanged(string urlPart) =>
131+
Browser.False(() => Browser.Url.Contains(urlPart), $"Expected URL not to contain '{urlPart}', but found '{Browser.Url}'");
132+
130133
[Theory]
131134
[InlineData(true, true)]
132135
[InlineData(true, false)]
@@ -163,6 +166,20 @@ public void NotFoundSetOnInitialization_ResponseStarted_SSR(bool hasReExecutionM
163166
AssertUrlNotChanged(testUrl);
164167
}
165168

169+
[Theory]
170+
[InlineData(true, true)]
171+
[InlineData(true, false)]
172+
[InlineData(false, true)]
173+
public void NotFoundSetOnInitialization_ResponseStarted_EnhancedNavigationDisabled_SSR(bool hasReExecutionMiddleware, bool hasCustomNotFoundPageSet)
174+
{
175+
EnhancedNavigationTestUtil.SuppressEnhancedNavigation(this, true, skipNavigation: true);
176+
string reexecution = hasReExecutionMiddleware ? "/reexecution" : "";
177+
string testUrl = $"{ServerPathBase}{reexecution}/set-not-found-ssr-streaming?useCustomNotFoundPage={hasCustomNotFoundPageSet}";
178+
Navigate(testUrl);
179+
AssertNotFoundRendered_ResponseStarted_Or_POST(hasReExecutionMiddleware, hasCustomNotFoundPageSet, testUrl);
180+
AssertUrlChanged(testUrl);
181+
}
182+
166183
private void AssertNotFoundRendered_ResponseStarted_Or_POST(bool hasReExecutionMiddleware, bool hasCustomNotFoundPageSet, string testUrl)
167184
{
168185
if (hasCustomNotFoundPageSet)

src/Shared/E2ETesting/WaitAssert.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan time
4040
public static void True(this IWebDriver driver, Func<bool> actual, string message)
4141
=> WaitAssertCore(driver, () => Assert.True(actual(), message));
4242

43+
public static void False(this IWebDriver driver, Func<bool> actual, string message)
44+
=> WaitAssertCore(driver, () => Assert.False(actual(), message));
45+
4346
public static void False(this IWebDriver driver, Func<bool> actual)
4447
=> WaitAssertCore(driver, () => Assert.False(actual()));
4548

0 commit comments

Comments
 (0)