summaryrefslogtreecommitdiffstats
path: root/uitest/src/test
diff options
context:
space:
mode:
authorOlli Tietäväinen <ollit@vaadin.com>2017-11-13 10:18:46 +0200
committerGitHub <noreply@github.com>2017-11-13 10:18:46 +0200
commit7bb07cc56dea861c468be6d39fb62bcdd740d394 (patch)
tree780c3c59485342b7e2d20c2543e749bdcfc7c36e /uitest/src/test
parent1051b3c326db84dad9242356fab251676618314b (diff)
downloadvaadin-framework-7bb07cc56dea861c468be6d39fb62bcdd740d394.tar.gz
vaadin-framework-7bb07cc56dea861c468be6d39fb62bcdd740d394.zip
hand-picked fix to #5043 combobox suggestion popup on scroll (#10307)
* hand-picked fix to #5043 combobox suggestion popup on scroll * cleanup
Diffstat (limited to 'uitest/src/test')
-rw-r--r--uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
index 28fd9f4206..6c8a4cc298 100644
--- a/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
+++ b/uitest/src/test/java/com/vaadin/tests/components/combobox/ComboboxPopupScrollingTest.java
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright 2000-2014 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
@@ -15,11 +15,17 @@
*/
package com.vaadin.tests.components.combobox;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
import org.junit.Test;
import org.openqa.selenium.By;
+import org.openqa.selenium.Point;
import org.openqa.selenium.WebElement;
+import com.vaadin.testbench.elements.UIElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.ComboBoxElement;
public class ComboboxPopupScrollingTest extends MultiBrowserTest {
@@ -43,6 +49,35 @@ public class ComboboxPopupScrollingTest extends MultiBrowserTest {
testNoScrollbars("reindeer");
}
+ @Test
+ public void testComboBoxTracksScrolledPage() {
+ openTestURL("theme=valo");
+
+ ComboBoxElement cb = $(ComboBoxElement.class).first();
+ cb.openPopup();
+ WebElement popup = cb.getSuggestionPopup();
+ Point comboLocation = cb.getLocation();
+ Point popupLocation = popup.getLocation();
+
+ // scroll page
+ $(UIElement.class).first().scroll(100);
+
+ // make sure animation frame is handled
+ try {
+ sleep(500);
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+
+ Point newComboLocation = cb.getLocation();
+ Point newPopupLocation = popup.getLocation();
+ assertNotEquals("ComboBox didn't move on the page", 0,
+ newComboLocation.y - comboLocation.y);
+ assertEquals("Popup didn't move with the combo box",
+ newComboLocation.y - comboLocation.y,
+ newPopupLocation.y - popupLocation.y);
+ }
+
private void testNoScrollbars(String theme) {
openTestURL("theme=" + theme);