Skip to content

Commit 641ac54

Browse files
committed
Make sure buttons are visile before executing JS on them.
1 parent c973c00 commit 641ac54

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,10 @@ public void EnhancedNavigationScrollBehavesSameAsBrowserOnNavigation(bool enable
698698
// "next" page: check if we landed at 0, then navigate to "landing"
699699
AssertWeAreOnNextPage();
700700
WaitStreamingRendersFullPage(enableStreaming);
701+
Browser.WaitForElementToBeVisible(By.Id("some-content"));
701702
AssertEnhancedNavigation(useEnhancedNavigation, elementForStalenessCheckOnHashPage);
702703
Assert.Equal(0, Browser.GetScrollY());
703704
var elementForStalenessCheckOnScrollPage = Browser.Exists(By.TagName("html"));
704-
Browser.WaitForElementToBeVisible(By.Id("some-content"));
705705
var fragmentScrollPosition = (long)jsExecutor.ExecuteScript("return Math.round(document.getElementById('some-content').getBoundingClientRect().top + window.scrollY);");
706706
Browser.Exists(By.Id(button1Id)).Click();
707707

@@ -745,13 +745,15 @@ public void EnhancedNavigationScrollBehavesSameAsBrowserOnBackwardsForwardsActio
745745

746746
var jsExecutor = (IJavaScriptExecutor)Browser;
747747
var buttonId = $"do{buttonKeyword}-navigation";
748+
Browser.WaitForElementToBeVisible(By.Id(button1Id));
748749
var scrollPagePos1 = (long)jsExecutor.ExecuteScript($"return Math.round(document.getElementById('{buttonId}').getBoundingClientRect().top + window.scrollY);") - 100;
749750
Browser.SetScrollY(scrollPagePos1);
750751
Browser.Exists(By.Id(buttonId)).Click();
751752

752753
// "next" page: scroll to pos1, navigate away
753754
AssertWeAreOnNextPage();
754755
WaitStreamingRendersFullPage(enableStreaming);
756+
Browser.WaitForElementToBeVisible(By.Id(button1Id));
755757
AssertEnhancedNavigation(useEnhancedNavigation, elementForStalenessCheckOnHashPage);
756758
var elementForStalenessCheckOnScrollPage = Browser.Exists(By.TagName("html"));
757759
var hashPagePos1 = (long)jsExecutor.ExecuteScript($"return Math.round(document.getElementById('{buttonId}').getBoundingClientRect().top + window.scrollY);") - 100;

0 commit comments

Comments
 (0)