@@ -571,16 +571,13 @@ public void NavigationToSamePathDoesNotScrollToTheTop()
571571 BrowserScrollY = maxScrollPosition ;
572572
573573 app . FindElement ( By . Id ( "do-self-navigate" ) ) . Click ( ) ;
574- var scrollPosition = BrowserScrollY ;
575- Assert . True ( scrollPosition == maxScrollPosition , "Expected to stay scrolled down." ) ;
574+ WaitAssert . True ( Browser , ( ) => maxScrollPosition == BrowserScrollY , default , $ "Expected to stay scrolled down in { maxScrollPosition } but the scroll is in position { BrowserScrollY } .") ;
576575
577576 app . FindElement ( By . Id ( "do-self-navigate-with-query" ) ) . Click ( ) ;
578- scrollPosition = BrowserScrollY ;
579- Assert . True ( scrollPosition == maxScrollPosition , "Expected to stay scrolled down." ) ;
577+ WaitAssert . True ( Browser , ( ) => maxScrollPosition == BrowserScrollY , default , $ "Expected to stay scrolled down in { maxScrollPosition } but the scroll is in position { BrowserScrollY } .") ;
580578
581579 app . FindElement ( By . Id ( "do-self-navigate-to-fragment" ) ) . Click ( ) ;
582- scrollPosition = BrowserScrollY ;
583- Assert . True ( scrollPosition == fragmentScrollPosition , "Expected to scroll to the fragment." ) ;
580+ WaitAssert . True ( Browser , ( ) => fragmentScrollPosition == BrowserScrollY , default , $ "Expected to scroll to the fragment in position { fragmentScrollPosition } but the scroll is in position { BrowserScrollY } .") ;
584581 }
585582
586583 [ Fact ]
@@ -1696,11 +1693,11 @@ public void AnchorWithHrefContainingHashSamePage_ScrollsToElementOnTheSamePage()
16961693
16971694 app . FindElement ( By . Id ( "anchor-test1" ) ) . Click ( ) ;
16981695
1699- var currentWindowScrollY = BrowserScrollY ;
17001696 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
17011697 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1702- Assert . Equal ( "subdir/LongPageWithHash#test1" , currentRelativeUrl ) ;
1703- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1698+ string expectedUrl = "subdir/LongPageWithHash#test1" ;
1699+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1700+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
17041701 }
17051702
17061703 [ Fact ]
@@ -1712,11 +1709,11 @@ public void AnchorWithHrefToSameUrlWithQueryAndHash_ScrollsToElementOnTheSamePag
17121709
17131710 app . FindElement ( By . Id ( "anchor-test1-with-query" ) ) . Click ( ) ;
17141711
1715- var currentWindowScrollY = BrowserScrollY ;
17161712 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
17171713 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1718- Assert . Equal ( "subdir/LongPageWithHash?color=green&number=123#test1" , currentRelativeUrl ) ;
1719- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1714+ string expectedUrl = "subdir/LongPageWithHash?color=green&number=123#test1" ;
1715+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1716+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
17201717 }
17211718
17221719 [ Fact ]
@@ -1728,11 +1725,11 @@ public void AnchorWithHrefToSameUrlWithParamAndHash_ScrollsToElementOnTheSamePag
17281725
17291726 app . FindElement ( By . Id ( "anchor-test1-with-param" ) ) . Click ( ) ;
17301727
1731- var currentWindowScrollY = BrowserScrollY ;
17321728 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
17331729 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1734- Assert . Equal ( "subdir/LongPageWithHash/11#test1" , currentRelativeUrl ) ;
1735- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1730+ string expectedUrl = "subdir/LongPageWithHash/11#test1" ;
1731+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1732+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
17361733 }
17371734
17381735 [ Fact ]
@@ -1744,11 +1741,11 @@ public void AnchorWithHrefToSameUrlWithParamQueryAndHash_ScrollsToElementOnTheSa
17441741
17451742 app . FindElement ( By . Id ( "anchor-test1-with-param-and-query" ) ) . Click ( ) ;
17461743
1747- var currentWindowScrollY = BrowserScrollY ;
17481744 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
17491745 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1750- Assert . Equal ( "subdir/LongPageWithHash/11?color=green&number=123#test1" , currentRelativeUrl ) ;
1751- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1746+ string expectedUrl = "subdir/LongPageWithHash/11?color=green&number=123#test1" ;
1747+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1748+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
17521749 }
17531750
17541751 [ Fact ]
@@ -1760,11 +1757,11 @@ public void AnchorWithHrefContainingHashAnotherPage_NavigatesToPageAndScrollsToE
17601757
17611758 app . FindElement ( By . Id ( "anchor-test2" ) ) . Click ( ) ;
17621759
1763- var currentWindowScrollY = BrowserScrollY ;
17641760 var test2VerticalLocation = app . FindElement ( By . Id ( "test2" ) ) . Location . Y ;
17651761 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1766- Assert . Equal ( "subdir/LongPageWithHash2#test2" , currentRelativeUrl ) ;
1767- Assert . Equal ( test2VerticalLocation , currentWindowScrollY ) ;
1762+ string expectedUrl = "subdir/LongPageWithHash2#test2" ;
1763+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1764+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test2VerticalLocation , default , $ "Expected { test2VerticalLocation } but got { BrowserScrollY } ") ;
17681765 }
17691766
17701767 [ Fact ]
@@ -1776,11 +1773,11 @@ public void NavigationManagerNavigateToAnotherUrlWithHash_NavigatesToPageAndScro
17761773
17771774 app . FindElement ( By . Id ( "navigate-test2" ) ) . Click ( ) ;
17781775
1779- var currentWindowScrollY = BrowserScrollY ;
17801776 var test2VerticalLocation = app . FindElement ( By . Id ( "test2" ) ) . Location . Y ;
17811777 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1782- Assert . Equal ( "subdir/LongPageWithHash2#test2" , currentRelativeUrl ) ;
1783- Assert . Equal ( test2VerticalLocation , currentWindowScrollY ) ;
1778+ string expectedUrl = "subdir/LongPageWithHash2#test2" ;
1779+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1780+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test2VerticalLocation , default , $ "Expected { test2VerticalLocation } but got { BrowserScrollY } ") ;
17841781 }
17851782
17861783 [ Fact ]
@@ -1792,11 +1789,11 @@ public void NavigationManagerNavigateToSameUrlWithHash_ScrollsToElementOnTheSame
17921789
17931790 app . FindElement ( By . Id ( "navigate-test1" ) ) . Click ( ) ;
17941791
1795- var currentWindowScrollY = BrowserScrollY ;
17961792 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
17971793 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1798- Assert . Equal ( "subdir/LongPageWithHash#test1" , currentRelativeUrl ) ;
1799- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1794+ string expectedUrl = "subdir/LongPageWithHash#test1" ;
1795+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1796+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
18001797 }
18011798
18021799 [ Fact ]
@@ -1808,11 +1805,11 @@ public void NavigationManagerNavigateToSameUrlWithQueryAndHash_ScrollsToElementO
18081805
18091806 app . FindElement ( By . Id ( "navigate-test1-with-query" ) ) . Click ( ) ;
18101807
1811- var currentWindowScrollY = BrowserScrollY ;
18121808 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
18131809 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1814- Assert . Equal ( "subdir/LongPageWithHash?color=green&number=123#test1" , currentRelativeUrl ) ;
1815- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1810+ string expectedUrl = "subdir/LongPageWithHash?color=green&number=123#test1" ;
1811+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1812+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
18161813 }
18171814
18181815 [ Fact ]
@@ -1824,11 +1821,11 @@ public void NavigationManagerNavigateToSameUrlWithParamAndHash_ScrollsToElementO
18241821
18251822 app . FindElement ( By . Id ( "navigate-test1-with-param" ) ) . Click ( ) ;
18261823
1827- var currentWindowScrollY = BrowserScrollY ;
18281824 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
18291825 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1830- Assert . Equal ( "subdir/LongPageWithHash/22#test1" , currentRelativeUrl ) ;
1831- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1826+ string expectedUrl = "subdir/LongPageWithHash/22#test1" ;
1827+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1828+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
18321829 }
18331830
18341831 [ Fact ]
@@ -1840,11 +1837,11 @@ public void NavigationManagerNavigateToSameUrlWithParamQueryAndHash_ScrollsToEle
18401837
18411838 app . FindElement ( By . Id ( "navigate-test1-with-param-and-query" ) ) . Click ( ) ;
18421839
1843- var currentWindowScrollY = BrowserScrollY ;
18441840 var test1VerticalLocation = app . FindElement ( By . Id ( "test1" ) ) . Location . Y ;
18451841 var currentRelativeUrl = _serverFixture . RootUri . MakeRelativeUri ( new Uri ( Browser . Url ) ) . ToString ( ) ;
1846- Assert . Equal ( "subdir/LongPageWithHash/22?color=green&number=123#test1" , currentRelativeUrl ) ;
1847- Assert . Equal ( test1VerticalLocation , currentWindowScrollY ) ;
1842+ string expectedUrl = "subdir/LongPageWithHash/22?color=green&number=123#test1" ;
1843+ WaitAssert . True ( Browser , ( ) => expectedUrl == currentRelativeUrl , default , $ "Expected { expectedUrl } but got { currentRelativeUrl } ") ;
1844+ WaitAssert . True ( Browser , ( ) => BrowserScrollY == test1VerticalLocation , default , $ "Expected { test1VerticalLocation } but got { BrowserScrollY } ") ;
18481845 }
18491846
18501847 private long BrowserScrollY
0 commit comments