]> source.dussan.org Git - vaadin-framework.git/commitdiff
Updated ComboboxSelectedItemTextTest to ensure popups have time to open.
authorAnna Koskinen <anna@vaadin.com>
Tue, 23 Sep 2014 11:47:48 +0000 (14:47 +0300)
committerVaadin Code Review <review@vaadin.com>
Tue, 7 Oct 2014 12:42:07 +0000 (12:42 +0000)
Change-Id: I382c3a3d08019658dee6c1013d5da22276c1ab55

uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java

index f82665402231a3300f83531822a97ee179513cd7..ab398035acd04150c5a7fd42ef5a01195f7dd6f3 100644 (file)
@@ -18,9 +18,11 @@ package com.vaadin.tests.components.ui;
 import java.io.IOException;
 
 import org.junit.Test;
-import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
 
+import com.vaadin.testbench.By;
 import com.vaadin.tests.tb3.MultiBrowserTest;
 
 /**
@@ -59,24 +61,26 @@ public class ComboboxSelectedItemTextTest extends MultiBrowserTest {
         WebElement comboBoxFocus = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
                 + indexToFocus + "]/VFilterSelect[0]");
 
-        // Select an element from the first (editable) combobox.
+        // Select an element from the first (to test) combobox.
 
         comboBox.findElement(By.className("v-filterselect-button")).click();
+        waitForPopup(comboBox);
         WebElement comboBoxPopup = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
                 + indexToTest + "]/VFilterSelect[0]#popup");
         comboBoxPopup.findElements(By.tagName("td")).get(2).click();
 
-        // Select an element from the second (non-editable combobox) to remove
+        // Select an element from the second (to focus) combobox to remove
         // focus from the first combobox
 
         comboBoxFocus.findElement(By.className("v-filterselect-button"))
                 .click();
+        waitForPopup(comboBoxFocus);
         comboBoxPopup = vaadinElement("/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot["
                 + indexToFocus + "]/VFilterSelect[0]#popup");
         comboBoxPopup.findElements(By.tagName("td")).get(2).click();
 
-        // click the popup on the first combobox. This would reveal the unwanted
-        // behaviour.
+        // click the button of the first combobox. This would reveal the
+        // unwanted behaviour.
 
         comboBox.findElement(By.className("v-filterselect-button")).click();
 
@@ -87,4 +91,13 @@ public class ComboboxSelectedItemTextTest extends MultiBrowserTest {
 
     }
 
+    private void waitForPopup(final WebElement comboBox) {
+        waitUntilNot(new ExpectedCondition<Boolean>() {
+            @Override
+            public Boolean apply(WebDriver input) {
+                return comboBox.findElements(By.vaadin("#popup")).isEmpty();
+            }
+        }, 10);
+    }
+
 }
\ No newline at end of file