diff options
author | Artur Signell <artur@vaadin.com> | 2016-01-01 12:02:06 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2016-01-07 08:19:02 +0000 |
commit | af15d54e5a49491ebadb9748381a22239ebf8ff7 (patch) | |
tree | 14875bb93410404ef361faf959d526d6949ae412 /uitest/src/com | |
parent | 86969a99c2c3ac0389912dceaf3bad9477717fb1 (diff) | |
download | vaadin-framework-af15d54e5a49491ebadb9748381a22239ebf8ff7.tar.gz vaadin-framework-af15d54e5a49491ebadb9748381a22239ebf8ff7.zip |
Fixes exception when enter is pressed and there is nothing to select (#19149)
Change-Id: I8ff11e98bb4ec999d369ff5bcde0cb95290ed037
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 |