From 0cd9540483262d0cded56fcc8c286c64a0b75631 Mon Sep 17 00:00:00 2001 From: Anna Koskinen Date: Tue, 23 Sep 2014 14:47:48 +0300 Subject: [PATCH] Updated ComboboxSelectedItemTextTest to ensure popups have time to open. Change-Id: I382c3a3d08019658dee6c1013d5da22276c1ab55 --- .../ui/ComboboxSelectedItemTextTest.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java index f826654022..ab398035ac 100644 --- a/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java +++ b/uitest/src/com/vaadin/tests/components/ui/ComboboxSelectedItemTextTest.java @@ -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() { + @Override + public Boolean apply(WebDriver input) { + return comboBox.findElements(By.vaadin("#popup")).isEmpty(); + } + }, 10); + } + } \ No newline at end of file -- 2.39.5