Skip to content

Commit d9616e3

Browse files
authored
chore: Re-enable ignored ScrollIntoViewIT test for Chrome (#2058)
Prevent running the test on Firefox by an assumeFalse check, since the browser's own auto-scroll features interfere with the test. AssumptionViolatedException marks the test skipped.
1 parent a11bab8 commit d9616e3

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

vaadin-testbench-integration-tests/src/test/java/com/vaadin/tests/elements/ScrollIntoViewIT.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@
1515
import static org.junit.Assert.assertNotEquals;
1616
import static org.junit.Assert.assertTrue;
1717
import static org.junit.Assert.fail;
18+
import static org.junit.Assume.assumeFalse;
1819

1920
import java.util.List;
2021

2122
import org.junit.Before;
22-
import org.junit.Ignore;
2323
import org.junit.Test;
2424
import org.openqa.selenium.ElementNotInteractableException;
2525
import org.openqa.selenium.remote.DesiredCapabilities;
2626

2727
import com.vaadin.testbench.By;
2828
import com.vaadin.testbench.TestBenchElement;
29+
import com.vaadin.testbench.parallel.BrowserUtil;
2930

3031
public class ScrollIntoViewIT extends MultiBrowserTest {
3132
private TestBenchElement lastButton;
@@ -68,8 +69,21 @@ public void getText_scrollIntoViewDisabled_ElementIsNotScrolled() {
6869
}
6970

7071
@Test
71-
@Ignore("This seems to fail on Firefox")
7272
public void click_scrollIntoViewDisabled_ElementIsNotScrolled() {
73+
// Firefox has some auto-scrolling logic of its own that is
74+
// unrelated to the auto-scrolling logic provided by TestBench.
75+
// Disabling the TestBench auto-scrolling doesn't prevent Firefox
76+
// auto-scrolling.
77+
// Without this check, Firefox auto-scrolling can be observed with
78+
// this test both locally (tested on Windows 11) and in the
79+
// validation builds. It cannot be prevented by TestBench except by
80+
// preventing the click altogether, which could give a misleading
81+
// impression on what actually happens when a user clicks an
82+
// element.
83+
// AssumptionViolatedException marks this test skipped on Firefox.
84+
assumeFalse("Firefox does its own auto-scrolling.",
85+
BrowserUtil.isFirefox(getDesiredCapabilities()));
86+
7387
assertFalse(lastButton.isDisplayed());
7488
getCommandExecutor().setAutoScrollIntoView(false);
7589
try {

0 commit comments

Comments
 (0)