Skip to content

Commit dd58e2b

Browse files
committed
tests fix
1 parent f40458c commit dd58e2b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public void CanNavigateToNonHtmlResponse()
7373
Navigate($"{ServerPathBase}/nav");
7474
Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Non-HTML page")).Click();
7575
Browser.Equal("Hello, this is plain text", () => Browser.Exists(By.TagName("html")).Text);
76+
77+
//Check if the fall back because of the non-html response sends a warning
78+
var logs = Browser.GetBrowserLogs(LogLevel.Warning);
79+
Assert.Contains(logs, log => log.Message.Contains("Enhanced navigation failed for destination") && log.Message.Contains("Falling back to full page load.") && !log.Message.Contains("Error"));
7680
}
7781

7882
[Fact]
@@ -324,10 +328,6 @@ public void RefreshCanFallBackOnFullPageReload(string renderMode)
324328
Browser.Exists(By.Id("refresh-with-refresh")).Click();
325329
Browser.True(() => IsElementStale(initialRenderIdElement));
326330

327-
//Check if the warning about the fail were logged.
328-
var logs = Browser.GetBrowserLogs(LogLevel.Warning);
329-
Assert.Contains(logs, log => log.Message.Contains("Enhanced navigation failed for destination") && !log.Message.Contains("Error"));
330-
331331
var finalRenderIdElement = Browser.Exists(By.Id("render-id"));
332332
var finalRenderId = -1;
333333
Browser.True(() => int.TryParse(finalRenderIdElement.Text, out finalRenderId));
@@ -469,6 +469,11 @@ public void EnhancedNavNotUsedForNonBlazorDestinations()
469469
Browser.Exists(By.TagName("nav")).FindElement(By.LinkText("Non-Blazor HTML page")).Click();
470470
Browser.Equal("This is a non-Blazor endpoint", () => Browser.Exists(By.TagName("h1")).Text);
471471
Assert.Equal("undefined", Browser.ExecuteJavaScript<string>("return typeof Blazor")); // Blazor JS is NOT loaded
472+
473+
//Check if the fall back because of the non-blazor endpoint navigation sends a warning
474+
var logs = Browser.GetBrowserLogs(LogLevel.Warning);
475+
Assert.Contains(logs, log => log.Message.Contains("Enhanced navigation failed for destination") && log.Message.Contains("Falling back to full page load.") && !log.Message.Contains("Error"));
476+
472477
}
473478

474479
[Theory]

0 commit comments

Comments
 (0)