diff options
author | Artur Signell <artur@vaadin.com> | 2016-01-01 12:02:06 +0200 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-01-08 13:48:14 +0200 |
commit | c5c07da2193208fddb3e1bd7aa8b0b72722b9f88 (patch) | |
tree | 8d91a5d3e5a2fed203e0e404d2c263112d493764 /uitest/src/com | |
parent | d847a4ad09e136894a45ab2a175c26fc139e2a93 (diff) | |
download | vaadin-framework-c5c07da2193208fddb3e1bd7aa8b0b72722b9f88.tar.gz vaadin-framework-c5c07da2193208fddb3e1bd7aa8b0b72722b9f88.zip |
Fixes exception when enter is pressed and there is nothing to select (#19149)
Change-Id: Ib6fd1d02b15f738a34b91adbb50c8d70844e5bad
Diffstat (limited to 'uitest/src/com')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java index c5cbc5eea6..ebf6ba4773 100644 --- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxEmptyItemsKeyboardNavigationTest.java @@ -10,10 +10,11 @@ import org.openqa.selenium.Keys; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; -import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.SingleBrowserTestPhantomJS2; import com.vaadin.tests.tb3.newelements.ComboBoxElement; -public class ComboBoxEmptyItemsKeyboardNavigationTest extends MultiBrowserTest { +public class ComboBoxEmptyItemsKeyboardNavigationTest extends + SingleBrowserTestPhantomJS2 { @Test public void navigatingUpOnAnEmptyMenuDoesntThrowErrors() { @@ -27,4 +28,43 @@ public class ComboBoxEmptyItemsKeyboardNavigationTest extends MultiBrowserTest { assertThat(errors, empty()); } + + @Test + public void selectingUsingEnterInAnEmptyMenu() { + setDebug(true); + openTestURL(); + + ComboBoxElement combobox = $(ComboBoxElement.class).first(); + combobox.sendKeys("a", Keys.ENTER); + + List<WebElement> errors = findElements(By.className("SEVERE")); + + assertThat(errors, empty()); + + assertPopupClosed(combobox); + } + + @Test + public void selectingUsingTabInAnEmptyMenu() { + setDebug(true); + openTestURL(); + + ComboBoxElement combobox = $(ComboBoxElement.class).first(); + // The joy of testing, one tab should be enough but is not (it is + // locally), two tabs does the trick for PhantomJS on the cluster... + combobox.sendKeys("abc", Keys.TAB, Keys.TAB); + + List<WebElement> errors = findElements(By.className("SEVERE")); + + assertThat(errors, empty()); + assertPopupClosed(combobox); + } + + private void assertPopupClosed(ComboBoxElement combobox) { + org.openqa.selenium.By bySuggestionPopup = By.vaadin("#popup"); + + assertThat("ComboBox popup should not be open", + combobox.findElements(bySuggestionPopup).isEmpty()); + + } }
\ No newline at end of file |