Skip to content

Commit 8aee498

Browse files
committed
[dotnet] Fix tests
1 parent f187855 commit 8aee498

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

dotnet/test/common/RelativeLocatorTest.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ public void ShouldBeAbleToFindElementsAboveAnotherWithXpath()
4747
{
4848
driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("relative_locators.html"));
4949

50-
IWebElement lowest = driver.FindElement(By.Id("seventh"));
50+
IWebElement lowest = driver.FindElement(By.Id("bottomLeft"));
5151

5252
var elements = driver.FindElements(RelativeBy.WithLocator(By.XPath("//td[1]")).Above(lowest));
5353

5454
var values = elements.Select(element => element.GetDomAttribute("id"));
55-
Assert.That(values, Is.EquivalentTo(new List<string> { "fourth", "first" }));
55+
Assert.That(values, Is.EquivalentTo(new List<string> { "left", "topLeft" }));
5656
}
5757

5858
[Test]
@@ -73,10 +73,10 @@ public void ShouldBeAbleToCombineFilters()
7373
{
7474
driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("relative_locators.html"));
7575

76-
ReadOnlyCollection<IWebElement> seen = driver.FindElements(RelativeBy.WithLocator(By.TagName("td")).Above(By.Id("center")).RightOf(By.Id("second")));
76+
ReadOnlyCollection<IWebElement> seen = driver.FindElements(RelativeBy.WithLocator(By.TagName("td")).Above(By.Id("center")).RightOf(By.Id("top")));
7777

7878
var elementIds = seen.Select(element => element.GetDomAttribute("id"));
79-
Assert.That(elementIds, Is.EquivalentTo(new List<string>() { "third" }));
79+
Assert.That(elementIds, Is.EquivalentTo(new List<string>() { "topRight" }));
8080
}
8181

8282

@@ -85,10 +85,10 @@ public void ShouldBeAbleToCombineFiltersWithXpath()
8585
{
8686
driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("relative_locators.html"));
8787

88-
ReadOnlyCollection<IWebElement> seen = driver.FindElements(RelativeBy.WithLocator(By.XPath("//td[1]")).Below(By.Id("second")).Above(By.Id("seventh")));
88+
ReadOnlyCollection<IWebElement> seen = driver.FindElements(RelativeBy.WithLocator(By.XPath("//td[1]")).Below(By.Id("top")).Above(By.Id("bottomLeft")));
8989

9090
var values = seen.Select(element => element.GetDomAttribute("id"));
91-
Assert.That(values, Is.EquivalentTo(new List<string> { "fourth" }));
91+
Assert.That(values, Is.EquivalentTo(new List<string> { "left" }));
9292
}
9393

9494
[Test]
@@ -97,10 +97,10 @@ public void ShouldBeAbleToCombineFiltersWithCssSelector()
9797
driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("relative_locators.html"));
9898

9999
ReadOnlyCollection<IWebElement> seen = driver.FindElements(
100-
RelativeBy.WithLocator(By.CssSelector("td")).Above(By.Id("center")).RightOf(By.Id("second")));
100+
RelativeBy.WithLocator(By.CssSelector("td")).Above(By.Id("center")).RightOf(By.Id("top")));
101101

102102
var values = seen.Select(element => element.GetDomAttribute("id"));
103-
Assert.That(values, Is.EquivalentTo(new List<string> { "third" }));
103+
Assert.That(values, Is.EquivalentTo(new List<string> { "topRight" }));
104104
}
105105

106106
[Test]
@@ -120,7 +120,7 @@ public void ExerciseNearLocatorWithTagName()
120120
// 5-8. Diagonally close (pythagoras sorting, with top row first
121121
// because of DOM insertion order)
122122
var values = seen.Select(element => element.GetDomAttribute("id"));
123-
Assert.That(values, Is.EquivalentTo(new List<string> { "second", "eighth", "fourth", "sixth", "first", "third", "seventh", "ninth" }));
123+
Assert.That(values, Is.EquivalentTo(new List<string> { "top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight" }));
124124
}
125125

126126
[Test]
@@ -140,7 +140,7 @@ public void ExerciseNearLocatorWithXpath()
140140
// 5-8. Diagonally close (pythagoras sorting, with top row first
141141
// because of DOM insertion order)
142142
var values = seen.Select(element => element.GetDomAttribute("id"));
143-
Assert.That(values, Is.EquivalentTo(new List<string> { "second", "eighth", "fourth", "sixth", "first", "third", "seventh", "ninth" }));
143+
Assert.That(values, Is.EquivalentTo(new List<string> { "top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight" }));
144144
}
145145

146146
[Test]
@@ -160,7 +160,7 @@ public void ExerciseNearLocatorWithCssSelector()
160160
// 5-8. Diagonally close (pythagoras sorting, with top row first
161161
// because of DOM insertion order)
162162
var values = seen.Select(element => element.GetDomAttribute("id"));
163-
Assert.That(values, Is.EquivalentTo(new List<string> { "second", "eighth", "fourth", "sixth", "first", "third", "seventh", "ninth" }));
163+
Assert.That(values, Is.EquivalentTo(new List<string> { "top", "bottom", "left", "right", "topLeft", "topRight", "bottomLeft", "bottomRight" }));
164164
}
165165

166166
[Test]
@@ -218,11 +218,11 @@ public void NearLocatorShouldNotFindFarElements()
218218
{
219219
driver.Url = (EnvironmentManager.Instance.UrlBuilder.WhereIs("relative_locators.html"));
220220

221-
var rect3 = driver.FindElement(By.Id("rect3"));
221+
var rect = driver.FindElement(By.Id("rect1"));
222222

223223
Assert.That(() =>
224224
{
225-
var rect2 = driver.FindElement(RelativeBy.WithLocator(By.Id("rect4")).Near(rect3));
225+
var rect2 = driver.FindElement(RelativeBy.WithLocator(By.Id("rect4")).Near(rect));
226226

227227
}, Throws.TypeOf<NoSuchElementException>().With.Message.EqualTo("Unable to find element; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception"));
228228
}

0 commit comments

Comments
 (0)