Skip to content

Commit 72751e8

Browse files
JohnChen0barancev
authored andcommitted
Fix testShouldNotScrollIfAlreadyScrolledAndElementIsInView
testShouldNotScrollIfAlreadyScrolledAndElementIsInView does not work correctly. While clikcing button1, a spec-compliant implementation should scroll the page just enough to bring button1 into view, while button2 remains out of view, thus clicking button2 should cause scroll again. Reversing the order of the clicks to fix this.
1 parent 638815a commit 72751e8

File tree

3 files changed

+6
-18
lines changed

3 files changed

+6
-18
lines changed

dotnet/test/common/ClickScrollingTest.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,12 @@ public void ShouldNotScrollOverflowElementsWhichAreVisible()
9191

9292

9393
[Test]
94-
[IgnoreBrowser(Browser.Chrome, "Webkit-based browsers apparently scroll anyway.")]
95-
[IgnoreBrowser(Browser.Edge, "Webkit-based browsers apparently scroll anyway.")]
9694
public void ShouldNotScrollIfAlreadyScrolledAndElementIsInView()
9795
{
9896
driver.Url = EnvironmentManager.Instance.UrlBuilder.WhereIs("scroll3.html");
99-
driver.FindElement(By.Id("button1")).Click();
100-
long scrollTop = GetScrollTop();
10197
driver.FindElement(By.Id("button2")).Click();
98+
long scrollTop = GetScrollTop();
99+
driver.FindElement(By.Id("button1")).Click();
102100
Assert.AreEqual(scrollTop, GetScrollTop());
103101
}
104102

java/client/test/org/openqa/selenium/ClickScrollingTest.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,15 +134,11 @@ public void testShouldNotScrollOverflowElementsWhichAreVisible() {
134134
}
135135

136136
@Test
137-
@NotYetImplemented(CHROME)
138-
@NotYetImplemented(CHROMIUMEDGE)
139-
@NotYetImplemented(MARIONETTE)
140-
@NotYetImplemented(EDGE)
141137
public void testShouldNotScrollIfAlreadyScrolledAndElementIsInView() {
142138
driver.get(appServer.whereIs("scroll3.html"));
143-
driver.findElement(By.id("button1")).click();
144-
long scrollTop = getScrollTop();
145139
driver.findElement(By.id("button2")).click();
140+
long scrollTop = getScrollTop();
141+
driver.findElement(By.id("button1")).click();
146142
assertThat(getScrollTop()).isEqualTo(scrollTop);
147143
}
148144

py/test/selenium/webdriver/common/click_scrolling_tests.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,11 @@ def testShouldNotScrollOverflowElementsWhichAreVisible(driver, pages):
8585
assert 0 == yOffset, "Should not have scrolled"
8686

8787

88-
@pytest.mark.xfail_chrome(
89-
reason='https://bugs.chromium.org/p/chromedriver/issues/detail?id=1542')
90-
@pytest.mark.xfail_chromiumedge(
91-
reason='https://bugs.chromium.org/p/chromedriver/issues/detail?id=1542')
92-
@pytest.mark.xfail_marionette
93-
@pytest.mark.xfail_remote
9488
def testShouldNotScrollIfAlreadyScrolledAndElementIsInView(driver, pages):
9589
pages.load("scroll3.html")
96-
driver.find_element(By.ID, "button1").click()
97-
scrollTop = getScrollTop(driver)
9890
driver.find_element(By.ID, "button2").click()
91+
scrollTop = getScrollTop(driver)
92+
driver.find_element(By.ID, "button1").click()
9993
assert scrollTop == getScrollTop(driver)
10094

10195

0 commit comments

Comments
 (0)