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;
/**
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();
}
+ 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