Skip to content

Commit e53920f

Browse files
committed
Change all NavigationManagerNavigateToSameUrl* tests to use WaitAssert.
1 parent e08b501 commit e53920f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,11 +1789,11 @@ public void NavigationManagerNavigateToSameUrlWithHash_ScrollsToElementOnTheSame
17891789

17901790
app.FindElement(By.Id("navigate-test1")).Click();
17911791

1792-
var currentWindowScrollY = BrowserScrollY;
17931792
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
17941793
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1795-
Assert.Equal("subdir/LongPageWithHash#test1", currentRelativeUrl);
1796-
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}");
17971797
}
17981798

17991799
[Fact]
@@ -1805,11 +1805,11 @@ public void NavigationManagerNavigateToSameUrlWithQueryAndHash_ScrollsToElementO
18051805

18061806
app.FindElement(By.Id("navigate-test1-with-query")).Click();
18071807

1808-
var currentWindowScrollY = BrowserScrollY;
18091808
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
18101809
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1811-
Assert.Equal("subdir/LongPageWithHash?color=green&number=123#test1", currentRelativeUrl);
1812-
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}");
18131813
}
18141814

18151815
[Fact]
@@ -1821,11 +1821,11 @@ public void NavigationManagerNavigateToSameUrlWithParamAndHash_ScrollsToElementO
18211821

18221822
app.FindElement(By.Id("navigate-test1-with-param")).Click();
18231823

1824-
var currentWindowScrollY = BrowserScrollY;
18251824
var test1VerticalLocation = app.FindElement(By.Id("test1")).Location.Y;
18261825
var currentRelativeUrl = _serverFixture.RootUri.MakeRelativeUri(new Uri(Browser.Url)).ToString();
1827-
Assert.Equal("subdir/LongPageWithHash/22#test1", currentRelativeUrl);
1828-
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}");
18291829
}
18301830

18311831
[Fact]

0 commit comments

Comments
 (0)