]> source.dussan.org Git - vaadin-framework.git/blob
cc27555638b37d2ee071f94b8d552f53195721a7
[vaadin-framework.git] /
1 package com.vaadin.tests.containers.sqlcontainer;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import org.junit.Assert;
7 import org.junit.Test;
8 import org.openqa.selenium.Keys;
9 import org.openqa.selenium.WebElement;
10
11 import com.vaadin.testbench.By;
12 import com.vaadin.tests.tb3.MultiBrowserTest;
13 import com.vaadin.v7.testbench.customelements.ComboBoxElement;
14
15 public class TableQueryWithNonUniqueFirstPrimaryKeyTest
16         extends MultiBrowserTest {
17
18     private static final String[] DATA = { "TARUSCIO GIOVANNI",
19             "RUSSO GAETANO AUTORICAMBI", "AMORUSO LUIGI SRL", "CARUSO ROCCO",
20             "F.LLI RUSSO DI GAETANO RUSSO & C", "RUSSO GIUSEPPE",
21             "TRUSCELLI ANTONIO", "CARUSO CALOGERO" };
22
23     @Test
24     public void testComboBoxSuggestionsListedCorrectly() throws Exception {
25         openTestURL();
26         $(ComboBoxElement.class).first().findElement(By.vaadin("#textbox"))
27                 .sendKeys("rus", Keys.ENTER);
28
29         List<String> result = new ArrayList<String>();
30
31         // pick list items that are shown in suggestion popup
32         List<WebElement> elems = findElements(
33                 By.cssSelector("td[role=\"listitem\"]"));
34         Assert.assertEquals("not enough suggestions shown", DATA.length,
35                 elems.size());
36
37         for (WebElement elem : elems) {
38             result.add(elem.getText());
39         }
40
41         Assert.assertArrayEquals("popup items not what they should be", DATA,
42                 result.toArray());
43
44     }
45 }