import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
+import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
comboBoxElement = $(ComboBoxElement.class).first();
}
+ @Test
+ public void ensureOldFilterIsCleared() {
+ comboBoxElement.openPopup();
+ int initialVisibleOptions = countVisibleOptions();
+ clearInputAndType("b11");
+ int visibleOptionsAfterFiltering = countVisibleOptions();
+ Assert.assertEquals(1, visibleOptionsAfterFiltering);
+ clickOnLabel();
+ sleep(1000);
+ // no selection was made, clicking on arrow should show all options
+ // again
+ comboBoxElement.openPopup();
+
+ int visibleOptions = countVisibleOptions();
+ Assert.assertEquals(initialVisibleOptions, visibleOptions);
+ }
+
+ private int countVisibleOptions() {
+ return comboBoxElement.getPopupSuggestions().size();
+ }
+
+ private void clickOnLabel() {
+ getDriver().findElement(By.cssSelector(".v-label")).click();
+ }
+
@Test
public void firstSuggestionIsSelectedWithEnter() {
typeInputAndHitEnter("a");