]> source.dussan.org Git - vaadin-framework.git/commitdiff
Convert ComboBoxLargeIconsTest from TB2 to TB4
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Fri, 17 Jul 2015 08:52:17 +0000 (11:52 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 17 Jul 2015 09:56:27 +0000 (09:56 +0000)
This patch also adds some subpart awareness as well as deferred worker
interface to VFilterSelect to support running TB4 tests reliably.

Change-Id: I41f2af38f7eba2194aa49c8d7a0d13073166cddf

client/src/com/vaadin/client/ui/VFilterSelect.java
uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java [new file with mode: 0644]
uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.html [deleted file]

index 1e474d3a1f9549035de97bbf9867fbf0dfd9476c..8d9e30ac6e0dd9c8ae2be9d7b1d23dd64fc78c7e 100644 (file)
@@ -65,6 +65,7 @@ import com.vaadin.client.BrowserInfo;
 import com.vaadin.client.ComponentConnector;
 import com.vaadin.client.ComputedStyle;
 import com.vaadin.client.ConnectorMap;
+import com.vaadin.client.DeferredWorker;
 import com.vaadin.client.Focusable;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.VConsole;
@@ -90,7 +91,7 @@ import com.vaadin.shared.util.SharedUtil;
 public class VFilterSelect extends Composite implements Field, KeyDownHandler,
         KeyUpHandler, ClickHandler, FocusHandler, BlurHandler, Focusable,
         SubPartAware, HandlesAriaCaption, HandlesAriaInvalid,
-        HandlesAriaRequired {
+        HandlesAriaRequired, DeferredWorker {
 
     /**
      * Represents a suggestion in the suggestion popup box
@@ -417,7 +418,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
                 selectPrevPage();
 
             } else {
-                if(!menu.getItems().isEmpty()) {
+                if (!menu.getItems().isEmpty()) {
                     selectLastItem();
                 }
             }
@@ -2187,11 +2188,15 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
 
     @Override
     public com.google.gwt.user.client.Element getSubPartElement(String subPart) {
-        if ("textbox".equals(subPart)) {
+        String[] parts = subPart.split("/");
+        if ("textbox".equals(parts[0])) {
             return tb.getElement();
-        } else if ("button".equals(subPart)) {
+        } else if ("button".equals(parts[0])) {
             return popupOpener.getElement();
-        } else if ("popup".equals(subPart) && suggestionPopup.isAttached()) {
+        } else if ("popup".equals(parts[0]) && suggestionPopup.isAttached()) {
+            if (parts.length == 2) {
+                return suggestionPopup.menu.getSubPartElement(parts[1]);
+            }
             return suggestionPopup.getElement();
         }
         return null;
@@ -2235,4 +2240,10 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
         selectPopupItemWhenResponseIsReceived = Select.NONE;
     }
 
+    @Override
+    public boolean isWorkPending() {
+        return waitingForFilteringResponse
+                || suggestionPopup.lazyPageScroller.isRunning();
+    }
+
 }
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxLargeIconsTest.java
new file mode 100644 (file)
index 0000000..407ab7a
--- /dev/null
@@ -0,0 +1,58 @@
+package com.vaadin.tests.components.combobox;
+
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.NativeSelectElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import com.vaadin.tests.tb3.newelements.ComboBoxElement;
+
+public class ComboBoxLargeIconsTest extends MultiBrowserTest {
+    @Override
+    protected Class<?> getUIClass() {
+        return com.vaadin.tests.components.combobox.Comboboxes.class;
+    }
+
+    @Test
+    public void testComboBoxIcons() throws Exception {
+        openTestURL();
+        NativeSelectElement iconSelect = $(NativeSelectElement.class).first();
+        iconSelect.selectByText("16x16");
+
+        ComboBoxElement cb = $(ComboBoxElement.class).caption(
+                "Undefined wide select with 50 items").first();
+        cb.openPopup();
+        compareScreen("icons-16x16-page1");
+        cb.openNextPage();
+        compareScreen("icons-16x16-page2");
+        cb.findElement(By.vaadin("#popup/item0")).click();
+        compareScreen("icons-16x16-selected-1-3-5-9");
+
+        iconSelect.selectByText("32x32");
+        cb.openPopup();
+        compareScreen("icons-32x32-page2");
+
+        // Closes the popup
+        cb.openPopup();
+
+        iconSelect.selectByText("64x64");
+
+        ComboBoxElement pageLength0cb = $(ComboBoxElement.class).caption(
+                "Pagelength 0").first();
+        pageLength0cb.openPopup();
+        pageLength0cb.findElement(By.vaadin("#popup/item1")).click();
+
+        ComboBoxElement cb200px = $(ComboBoxElement.class).caption(
+                "200px wide select with 50 items").first();
+        cb200px.openPopup();
+        cb200px.findElement(By.vaadin("#popup/item1")).click();
+
+        ComboBoxElement cb150px = $(ComboBoxElement.class).caption(
+                "150px wide select with 5 items").first();
+        new Actions(driver).sendKeys(cb150px, Keys.DOWN).perform();
+
+        compareScreen("icons-64x64-page1-highlight-first");
+    }
+}
diff --git a/uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.html b/uitest/tb2/com/vaadin/tests/components/combobox/ComboBoxLargeIcons.html
deleted file mode 100644 (file)
index ff6c82d..0000000
+++ /dev/null
@@ -1,152 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head profile="http://selenium-ide.openqa.org/profiles/test-case">
-<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-<link rel="selenium.base" href="" />
-<title>New Test</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">New Test</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.components.combobox.Comboboxes?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>select</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::PID_Sselectaction-Icon/domChild[0]</td>
-       <td>label=16x16</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VFilterSelect[0]/domChild[1]</td>
-       <td>13,8</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td>
-       <td>116,6</td>
-</tr>
-<!--  Open twice to avoid IE6 css issues -->
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.components.combobox.Comboboxes?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>select</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::PID_Sselectaction-Icon/domChild[0]</td>
-       <td>label=16x16</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VFilterSelect[0]/domChild[1]</td>
-       <td>13,8</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>icons-16x16-page1</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::Root/VFilterSelect$SuggestionPopup[0]/domChild[0]/domChild[2]/domChild[0]</td>
-       <td>116,6</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>icons-16x16-page2</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item0</td>
-       <td>378,1</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>icons-16x16-selected-1-3-5-9</td>
-</tr>
-<tr>
-       <td>select</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::PID_Sselectaction-Icon/domChild[0]</td>
-       <td>label=32x32</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VFilterSelect[0]/domChild[2]</td>
-       <td>8,13</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>icons-32x32-page2</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[1]</td>
-       <td>409,27</td>
-</tr>
-<tr>
-       <td>select</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::PID_Sselectaction-Icon/domChild[0]</td>
-       <td>label=64x64</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[9]/VFilterSelect[0]/domChild[1]</td>
-       <td>11,13</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
-       <td>213,57</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[4]</td>
-       <td>535,43</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[8]/VFilterSelect[0]/domChild[1]</td>
-       <td>7,12</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item1</td>
-       <td>158,25</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VFilterSelect[0]/domChild[0]</td>
-       <td>16,9</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VFilterSelect[0]/domChild[0]</td>
-       <td>80,7</td>
-</tr>
-<tr>
-       <td>pressSpecialKey</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[7]/VFilterSelect[0]/domChild[0]</td>
-       <td>down</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>icons-64x64-page1-highlight-first</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentscomboboxComboboxes::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[6]/domChild[0]</td>
-       <td>510,1</td>
-</tr>
-</tbody></table>
-</body>
-</html>