Skip to content

Commit bd7858d

Browse files
committed
Restore enhanced nav asserts after the condition that full page is loaded.
1 parent d94b1af commit bd7858d

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -690,42 +690,43 @@ public void EnhancedNavigationScrollBehavesSameAsFullNavigation(bool enableStrea
690690
// scroll maximally down and go to another page - we should land at the top of that page
691691
Browser.SetScrollY(maxScrollPosition);
692692
Browser.Exists(By.Id("do-navigation")).Click();
693+
WaitFullPageLoaded();
693694
AssertEnhancedNavigationOnHashPage();
694695
AssertWeAreOnHashPage();
695696
Assert.Equal(0, Browser.GetScrollY());
696697
var elementForStalenessCheckOnHashPage = Browser.Exists(By.TagName("html"));
697698

698-
WaitFullPageLoaded();
699699
var fragmentScrollPosition = (long)jsExecutor.ExecuteScript("return Math.round(document.getElementById('some-content').getBoundingClientRect().top + window.scrollY);");
700700

701701
// go back and check if the scroll position is preserved
702702
Browser.Navigate().Back();
703703
AssertWeAreOnScrollTestPage();
704+
WaitFullPageLoaded();
704705
AssertEnhancedNavigationOnScrollPage();
705706

706707
// parts of page conditioned with showContent are showing with a delay - it affect the scroll position
707708
// from some reason, scroll position differs by 1 pixel between enhanced and browser's navigation
708709
var expectedMaxScrollPositionAfterBackwardsAction = useEnhancedNavigation ? maxScrollPosition: maxScrollPosition - 1;
709-
WaitFullPageLoaded();
710710
Assert.Equal(expectedMaxScrollPositionAfterBackwardsAction, Browser.GetScrollY());
711711

712712
// navigate to a fragment on another page - we should land at the beginning of the fragment
713713
Browser.Exists(By.Id("do-navigation-with-fragment")).Click();
714714
AssertWeAreOnHashPage();
715+
WaitFullPageLoaded();
715716
AssertEnhancedNavigationOnHashPage();
716717
var expectedFragmentScrollPosition = fragmentScrollPosition - 1;
717-
WaitFullPageLoaded();
718718
Assert.Equal(expectedFragmentScrollPosition, Browser.GetScrollY());
719719

720720
// go back to be able to go forward and check if the scroll position is preserved
721721
Browser.Navigate().Back();
722722
AssertWeAreOnScrollTestPage();
723+
WaitFullPageLoaded();
723724
AssertEnhancedNavigationOnScrollPage();
724725

725726
Browser.Navigate().Forward();
726727
AssertWeAreOnHashPage();
727-
AssertEnhancedNavigationOnHashPage();
728728
WaitFullPageLoaded();
729+
AssertEnhancedNavigationOnHashPage();
729730
Assert.Equal(expectedFragmentScrollPosition, Browser.GetScrollY());
730731

731732
void AssertEnhancedNavigationOnHashPage() =>
@@ -736,11 +737,6 @@ void AssertEnhancedNavigationOnScrollPage()
736737

737738
void AssertEnhancedNavigation(IWebElement elementForStalenessCheck)
738739
{
739-
// enhanced navigation asserts are not deterministic with streaming
740-
if (enableStreaming)
741-
{
742-
return;
743-
}
744740
bool enhancedNavigationDetected = !IsElementStale(elementForStalenessCheck);
745741
Assert.Equal(useEnhancedNavigation, enhancedNavigationDetected);
746742
}

0 commit comments

Comments
 (0)