summaryrefslogtreecommitdiffstats
path: root/uitest-common/src/main/java/com
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2016-08-25 12:57:37 +0300
committerVaadin Code Review <review@vaadin.com>2016-09-12 10:26:25 +0000
commit323d43711c572d7d676e044f1720fcc419a3c9d6 (patch)
tree467e42072ef24be00163ea5d2ead4f346fa95ccf /uitest-common/src/main/java/com
parent376a4d5b897327e957483bd43e7075f180a02e8f (diff)
downloadvaadin-framework-323d43711c572d7d676e044f1720fcc419a3c9d6.tar.gz
vaadin-framework-323d43711c572d7d676e044f1720fcc419a3c9d6.zip
Update ComboBox for new DataSource and communication mechanism
This simplifies the client side state machine. This change does not modify the CSS class name v-filterselect. Change-Id: I2f4a6e5252045cb7698d582be90693e00961b342
Diffstat (limited to 'uitest-common/src/main/java/com')
-rw-r--r--uitest-common/src/main/java/com/vaadin/testbench/customelements/ComboBoxElement.java61
1 files changed, 61 insertions, 0 deletions
diff --git a/uitest-common/src/main/java/com/vaadin/testbench/customelements/ComboBoxElement.java b/uitest-common/src/main/java/com/vaadin/testbench/customelements/ComboBoxElement.java
new file mode 100644
index 0000000000..0f3b7b9d42
--- /dev/null
+++ b/uitest-common/src/main/java/com/vaadin/testbench/customelements/ComboBoxElement.java
@@ -0,0 +1,61 @@
+package com.vaadin.testbench.customelements;
+
+import org.junit.Assert;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elementsbase.ServerClass;
+
+@ServerClass("com.vaadin.ui.ComboBox")
+public class ComboBoxElement
+ extends com.vaadin.testbench.elements.ComboBoxElement {
+
+ private static org.openqa.selenium.By bySuggestionPopup = By
+ .vaadin("#popup");
+
+ public WebElement getInputField() {
+ return findElement(By.vaadin("#textbox"));
+ }
+
+ @Override
+ public String getText() {
+ return getInputField().getAttribute("value");
+ }
+
+ @Override
+ public void clear() {
+ getInputField().clear();
+ }
+
+ public WebElement getSuggestionPopup() {
+ return findElement(bySuggestionPopup);
+ }
+
+ @Override
+ public void sendKeys(CharSequence... keysToSend) {
+ sendKeys(50, keysToSend);
+ }
+
+ /**
+ * Use this method to simulate typing into an element, which may set its
+ * value.
+ *
+ * @param delay
+ * delay after sending each individual key (mainly needed for
+ * PhantomJS)
+ * @param keysToSend
+ * keys to type into the element
+ */
+ public void sendKeys(int delay, CharSequence... keysToSend) {
+ WebElement input = getInputField();
+
+ for (CharSequence key : keysToSend) {
+ input.sendKeys(key);
+ try {
+ Thread.sleep(delay);
+ } catch (InterruptedException e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+ }
+}