From 1c7aa369b93c45ee8ff293e214214ccf73925ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Rozto=C4=8Dil?= Date: Thu, 4 Sep 2025 18:19:55 +0200 Subject: [PATCH 1/3] Split internal and external navigation tests for NavigationLock --- .../NavigationLockPrerenderingTest.cs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs index 645a29cc7bfa..1f073fc99b7c 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs @@ -26,7 +26,7 @@ public override Task InitializeAsync() [Fact] [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/57153")] - public void NavigationIsLockedAfterPrerendering() + public void ExternalNavigationIsLockedAfterPrerendering() { Navigate("/locked-navigation"); @@ -35,13 +35,24 @@ public void NavigationIsLockedAfterPrerendering() BeginInteractivity(); - // Assert that internal navigations are blocked - Browser.Click(By.Id("internal-navigation-link")); - Browser.Equal("Prevented navigations: 1", () => Browser.FindElement(By.Id("num-prevented-navigations")).Text); - // Assert that external navigations are blocked Browser.Navigate().GoToUrl("about:blank"); Browser.SwitchTo().Alert().Dismiss(); + Browser.Equal("Prevented navigations: 0", () => Browser.FindElement(By.Id("num-prevented-navigations")).Text); + } + + [Fact] + public void InternalNavigationIsLockedAfterPrerendering() + { + Navigate("/locked-navigation"); + + // Assert that the component rendered successfully + Browser.Equal("Prevented navigations: 0", () => Browser.FindElement(By.Id("num-prevented-navigations")).Text); + + BeginInteractivity(); + + // Assert that internal navigations are blocked + Browser.Click(By.Id("internal-navigation-link")); Browser.Equal("Prevented navigations: 1", () => Browser.FindElement(By.Id("num-prevented-navigations")).Text); } From e16afac0e020546c247c34a128ae65035040732e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Rozto=C4=8Dil?= Date: Fri, 5 Sep 2025 12:26:44 +0200 Subject: [PATCH 2/3] Skip navigation tests that are currently not fixable --- .../ServerExecutionTests/NavigationLockPrerenderingTest.cs | 4 ++-- src/Components/test/E2ETest/Tests/RoutingTest.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs index 1f073fc99b7c..059cb5c67cd3 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs @@ -24,8 +24,8 @@ public NavigationLockPrerenderingTest( public override Task InitializeAsync() => InitializeAsync(BrowserFixture.RoutingTestContext); - [Fact] - [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/57153")] + // See https://github.com/dotnet/aspnetcore/issues/57153 + [Fact(Skip = "BeforeUnload alert does not work with Selenium/ChromeDriver after update")] public void ExternalNavigationIsLockedAfterPrerendering() { Navigate("/locked-navigation"); diff --git a/src/Components/test/E2ETest/Tests/RoutingTest.cs b/src/Components/test/E2ETest/Tests/RoutingTest.cs index 45ff979605d4..df00d004d4a8 100644 --- a/src/Components/test/E2ETest/Tests/RoutingTest.cs +++ b/src/Components/test/E2ETest/Tests/RoutingTest.cs @@ -1155,8 +1155,8 @@ public void NavigationLock_HistoryNavigationWorks_AfterRefresh() Browser.Equal("1", () => app.FindElement(By.Id("location-changed-count"))?.Text); } - [Fact] - [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/57153")] + // See https://github.com/dotnet/aspnetcore/issues/57153 + [Fact(Skip = "BeforeUnload alert does not work with Selenium/ChromeDriver after update")] public void NavigationLock_CanBlockExternalNavigation() { SetUrlViaPushState("/"); From 3efa346d31404e9d3f330c19770bc2ee94c153c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Rozto=C4=8Dil?= Date: Fri, 5 Sep 2025 15:19:38 +0200 Subject: [PATCH 3/3] Simplify Skip comments --- .../ServerExecutionTests/NavigationLockPrerenderingTest.cs | 3 +-- src/Components/test/E2ETest/Tests/RoutingTest.cs | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs b/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs index 059cb5c67cd3..7b88e1d88745 100644 --- a/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs +++ b/src/Components/test/E2ETest/ServerExecutionTests/NavigationLockPrerenderingTest.cs @@ -24,8 +24,7 @@ public NavigationLockPrerenderingTest( public override Task InitializeAsync() => InitializeAsync(BrowserFixture.RoutingTestContext); - // See https://github.com/dotnet/aspnetcore/issues/57153 - [Fact(Skip = "BeforeUnload alert does not work with Selenium/ChromeDriver after update")] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/57153")] public void ExternalNavigationIsLockedAfterPrerendering() { Navigate("/locked-navigation"); diff --git a/src/Components/test/E2ETest/Tests/RoutingTest.cs b/src/Components/test/E2ETest/Tests/RoutingTest.cs index df00d004d4a8..a094aa66f971 100644 --- a/src/Components/test/E2ETest/Tests/RoutingTest.cs +++ b/src/Components/test/E2ETest/Tests/RoutingTest.cs @@ -1155,8 +1155,7 @@ public void NavigationLock_HistoryNavigationWorks_AfterRefresh() Browser.Equal("1", () => app.FindElement(By.Id("location-changed-count"))?.Text); } - // See https://github.com/dotnet/aspnetcore/issues/57153 - [Fact(Skip = "BeforeUnload alert does not work with Selenium/ChromeDriver after update")] + [Fact(Skip = "https://github.com/dotnet/aspnetcore/issues/57153")] public void NavigationLock_CanBlockExternalNavigation() { SetUrlViaPushState("/");