From 2bf0f6c08af97255f5b0f612b795683ed54c9ea3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:02:02 +0000 Subject: [PATCH 1/3] Initial plan From 7cb561b25e7efc66a4367b501ffb23e0e8216f6f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:09:14 +0000 Subject: [PATCH 2/3] Remove IsElementStale and use WebDriverExtensions.IsStale Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com> --- .../EnhancedNavigationTestUtil.cs | 13 ------------- .../ServerRenderingTests/InteractivityTest.cs | 3 ++- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs index 12fac8e74548..1fa7b8fce9e3 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs @@ -97,17 +97,4 @@ public static long GetScrollY(this IWebDriver browser) public static long SetScrollY(this IWebDriver browser, long value) => Convert.ToInt64(((IJavaScriptExecutor)browser).ExecuteScript($"window.scrollTo(0, {value})"), CultureInfo.CurrentCulture); - - public static bool IsElementStale(IWebElement element) - { - try - { - _ = element.Enabled; - return false; - } - catch (StaleElementReferenceException) - { - return true; - } - } } diff --git a/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs index 4ea368a72437..8ad4cbb048e4 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using Components.TestServer.RazorComponents; +using Microsoft.AspNetCore.Components.E2ETest; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure; using Microsoft.AspNetCore.Components.E2ETest.Infrastructure.ServerFixtures; using Microsoft.AspNetCore.Components.E2ETests.ServerExecutionTests; @@ -1308,7 +1309,7 @@ public void CanPerformNavigateToFromInteractiveEventHandler(bool suppressEnhance // Verify the elements were preserved if and only if they should be var shouldPreserveElements = !suppressEnhancedNavigation && !forceLoad; - Assert.Equal(shouldPreserveElements, !EnhancedNavigationTestUtil.IsElementStale(originalNavElem)); + Assert.Equal(shouldPreserveElements, !originalNavElem.IsStale()); } private void BlockWebAssemblyResourceLoad() From 50d23df758e8d35fbeb9e843f34fed6b53d2ce3d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:24:19 +0000 Subject: [PATCH 3/3] Remove unused private IsElementStale method from EnhancedNavigationTest.cs Co-authored-by: ilonatommy <32700855+ilonatommy@users.noreply.github.com> --- .../E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index c7f52c3c155e..5b28c9d299ac 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -989,7 +989,4 @@ private static Func ElementWithTextAppears(By selector, string // Ensure we actually observed the new content, not just the presence of the element. return string.Equals(elements[0].Text, expectedText, StringComparison.Ordinal); }; - - private static bool IsElementStale(IWebElement element) - => EnhancedNavigationTestUtil.IsElementStale(element); }