Skip to content

Commit 09e9d16

Browse files
committed
Change all AnchorWithHref* tests to use WaitAssert.
1 parent e53920f commit 09e9d16

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/Components/test/E2ETest/Tests/RoutingTest.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,11 +1693,11 @@ public void AnchorWithHrefContainingHashSamePage_ScrollsToElementOnTheSamePage()
16931693

16941694
app.FindElement(By.Id("anchor-test1")).Click();
16951695

1696-
var currentWindowScrollY = BrowserScrollY;
16971696
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
16981697
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1699-
Assert.Equal("subdir/LongPageWithHash#test1", currentRelativeUrl);
1700-
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}");
17011701
}
17021702

17031703
[Fact]
@@ -1709,11 +1709,11 @@ public void AnchorWithHrefToSameUrlWithQueryAndHash_ScrollsToElementOnTheSamePag
17091709

17101710
app.FindElement(By.Id("anchor-test1-with-query")).Click();
17111711

1712-
var currentWindowScrollY = BrowserScrollY;
17131712
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
17141713
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1715-
Assert.Equal("subdir/LongPageWithHash?color=green&number=123#test1", currentRelativeUrl);
1716-
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}");
17171717
}
17181718

17191719
[Fact]
@@ -1725,11 +1725,11 @@ public void AnchorWithHrefToSameUrlWithParamAndHash_ScrollsToElementOnTheSamePag
17251725

17261726
app.FindElement(By.Id("anchor-test1-with-param")).Click();
17271727

1728-
var currentWindowScrollY = BrowserScrollY;
17291728
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
17301729
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1731-
Assert.Equal("subdir/LongPageWithHash/11#test1", currentRelativeUrl);
1732-
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}");
17331733
}
17341734

17351735
[Fact]
@@ -1741,11 +1741,11 @@ public void AnchorWithHrefToSameUrlWithParamQueryAndHash_ScrollsToElementOnTheSa
17411741

17421742
app.FindElement(By.Id("anchor-test1-with-param-and-query")).Click();
17431743

1744-
var currentWindowScrollY = BrowserScrollY;
17451744
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
17461745
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1747-
Assert.Equal("subdir/LongPageWithHash/11?color=green&number=123#test1", currentRelativeUrl);
1748-
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}");
17491749
}
17501750

17511751
[Fact]
@@ -1757,11 +1757,11 @@ public void AnchorWithHrefContainingHashAnotherPage_NavigatesToPageAndScrollsToE
17571757

17581758
app.FindElement(By.Id("anchor-test2")).Click();
17591759

1760-
var currentWindowScrollY = BrowserScrollY;
17611760
var test2VerticalLocation = app.FindElement(By.Id("test2")).Location.Y;
17621761
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1763-
Assert.Equal("subdir/LongPageWithHash2#test2", currentRelativeUrl);
1764-
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}");
17651765
}
17661766

17671767
[Fact]
@@ -1773,11 +1773,11 @@ public void NavigationManagerNavigateToAnotherUrlWithHash_NavigatesToPageAndScro
17731773

17741774
app.FindElement(By.Id("navigate-test2")).Click();
17751775

1776-
var currentWindowScrollY = BrowserScrollY;
17771776
var test2VerticalLocation = app.FindElement(By.Id("test2")).Location.Y;
17781777
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1779-
Assert.Equal("subdir/LongPageWithHash2#test2", currentRelativeUrl);
1780-
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}");
17811781
}
17821782

17831783
[Fact]

0 commit comments

Comments
 (0)