]> source.dussan.org Git - vaadin-framework.git/commitdiff
TreeTablePartialUpdatesPageLength0 test upgrade (#14292)
authorAnna Koskinen <anna@vaadin.com>
Thu, 14 Aug 2014 13:58:28 +0000 (16:58 +0300)
committerVaadin Code Review <review@vaadin.com>
Mon, 18 Aug 2014 13:13:40 +0000 (13:13 +0000)
Change-Id: I8f7717138247c46d7b85f4fab46328d5d118dbef

uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html [deleted file]
uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.java
uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0.html
deleted file mode 100644 (file)
index 34ab0c0..0000000
+++ /dev/null
@@ -1,56 +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>DisappearingComponents</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">DisappearingComponents</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.components.treetable.TreeTablePartialUpdatesPageLength0?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-       <td>10,2</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>root1-expanded-10-items</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[12]/domChild[0]/domChild[0]/domChild[0]</td>
-       <td>11,3</td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[11]/domChild[0]/domChild[0]/domChild[0]</td>
-       <td>9,7</td>
-</tr>
-<tr>
-       <td>scroll</td>
-       <td>vaadin=runcomvaadintestscomponentstreetableTreeTablePartialUpdatesPageLength0::</td>
-       <td>12500</td>
-</tr>
-<tr>
-       <td>pause</td>
-       <td>300</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>all-expanded-bottom</td>
-</tr>
-</tbody></table>
-</body>
-</html>
index 20412bf0e2863dbf0bce2dbac7a66a26ecf8e81d..686d86a0dcd1afce021a89bb55a524d7979f2238 100644 (file)
@@ -2,13 +2,14 @@ package com.vaadin.tests.components.treetable;
 
 import com.vaadin.data.Container.Hierarchical;
 import com.vaadin.data.util.HierarchicalContainer;
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.TreeTable;
 
-public class TreeTablePartialUpdatesPageLength0 extends TestBase {
+public class TreeTablePartialUpdatesPageLength0 extends AbstractTestUI {
 
     @Override
-    protected void setup() {
+    protected void setup(VaadinRequest request) {
         setTheme("reindeer-tests");
         TreeTable tt = new TreeTable();
         tt.addStyleName("table-equal-rowheight");
@@ -20,6 +21,7 @@ public class TreeTablePartialUpdatesPageLength0 extends TestBase {
         tt.getParent().getParent().setHeight(null);
     }
 
+    @SuppressWarnings("unchecked")
     private Hierarchical makeHierarchicalContainer() {
         HierarchicalContainer hc = new HierarchicalContainer();
         hc.addContainerProperty("p1", String.class, "");
@@ -47,6 +49,7 @@ public class TreeTablePartialUpdatesPageLength0 extends TestBase {
         return hc;
     }
 
+    @SuppressWarnings("unchecked")
     private void addNodesToRoot(HierarchicalContainer hc, Object root, int count) {
         for (int ix = 0; ix < count; ix++) {
             Object id = hc.addItem();
@@ -56,7 +59,7 @@ public class TreeTablePartialUpdatesPageLength0 extends TestBase {
     }
 
     @Override
-    protected String getDescription() {
+    protected String getTestDescription() {
         return "";
     }
 
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTablePartialUpdatesPageLength0Test.java
new file mode 100644 (file)
index 0000000..d88c6ba
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.treetable;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.TreeTableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests expanding TreeTable rows when page length is zero.
+ * 
+ * @author Vaadin Ltd
+ */
+public class TreeTablePartialUpdatesPageLength0Test extends MultiBrowserTest {
+
+    @Test
+    public void testExpanding() throws IOException {
+        openTestURL();
+
+        TreeTableElement treeTable = $(TreeTableElement.class).first();
+        List<WebElement> rows = treeTable.findElement(
+                By.className("v-table-body")).findElements(By.tagName("tr"));
+        assertEquals("unexpected row count", 4, rows.size());
+        assertEquals("unexpected contents", "root1", treeTable.getCell(0, 0)
+                .getText());
+        assertEquals("unexpected contents", "root2", treeTable.getCell(1, 0)
+                .getText());
+        assertEquals("unexpected contents", "root3", treeTable.getCell(2, 0)
+                .getText());
+        assertEquals("unexpected contents", "END", treeTable.getCell(3, 0)
+                .getText());
+
+        // expand first row, should have 10 children
+        treeTable.getCell(0, 0)
+                .findElement(By.className("v-treetable-treespacer")).click();
+
+        treeTable = $(TreeTableElement.class).first();
+        rows = treeTable.findElement(By.className("v-table-body"))
+                .findElements(By.tagName("tr"));
+        assertEquals("unexpected row count", 14, rows.size());
+
+        // expand root3, should have 200 children
+        assertEquals("unexpected contents", "root3", treeTable.getCell(12, 0)
+                .getText());
+        treeTable.getCell(12, 0)
+                .findElement(By.className("v-treetable-treespacer")).click();
+
+        // expand root2, should have 200 children
+        assertEquals("unexpected contents", "root2", treeTable.getCell(11, 0)
+                .getText());
+        treeTable.getCell(11, 0)
+                .findElement(By.className("v-treetable-treespacer")).click();
+
+        treeTable = $(TreeTableElement.class).first();
+        rows = treeTable.findElement(By.className("v-table-body"))
+                .findElements(By.tagName("tr"));
+        assertEquals("unexpected row count", 414, rows.size());
+
+        // scroll all the way to the bottom
+        WebElement ui = findElement(By.className("v-ui"));
+        testBenchElement(ui).scroll(12500);
+
+        compareScreen("bottom");
+    }
+}