]> source.dussan.org Git - vaadin-framework.git/commitdiff
TableColumnResizeContentsWidth test upgrade (#14292)
authorAnna Koskinen <anna@vaadin.com>
Wed, 30 Jul 2014 12:48:20 +0000 (15:48 +0300)
committerVaadin Code Review <review@vaadin.com>
Wed, 20 Aug 2014 08:14:22 +0000 (08:14 +0000)
Change-Id: I1adc4dfea7bf62191a23a89440eeca677f47e6a6

uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html [deleted file]
uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java
uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html
deleted file mode 100644 (file)
index f2a3a06..0000000
+++ /dev/null
@@ -1,61 +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></title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3"></td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.components.table.TableColumnResizeContentsWidth?restartApplication&amp;debug</td>
-       <td></td>
-</tr>
-<tr>
-       <td>dragAndDrop</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-       <td>-20,+0</td>
-</tr>
-<tr>
-       <td>assertElementWidth</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>80</td>
-</tr>
-<tr>
-       <td>dragAndDrop</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-       <td>+40,+0</td>
-</tr>
-<tr>
-       <td>assertElementWidth</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>120</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>assertElementWidth</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>80</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>assertElementWidth</td>
-       <td>vaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/VScrollTable$FocusableScrollContextPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]</td>
-       <td>100</td>
-</tr>
-</tbody></table>
-</body>
-</html>
index 0b695b41c79ac97a26a83b8a7ec03d272f1e5533..b785f439ea0ac11c8ddee9983ed76054de60930e 100644 (file)
@@ -1,18 +1,19 @@
 package com.vaadin.tests.components.table;
 
-import com.vaadin.tests.components.TestBase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.Table.ColumnGenerator;
 import com.vaadin.ui.TextField;
 
-public class TableColumnResizeContentsWidth extends TestBase {
+public class TableColumnResizeContentsWidth extends AbstractTestUI {
 
     private static final String COL1 = "COL1";
 
     @Override
-    protected void setup() {
+    protected void setup(VaadinRequest request) {
         final Table table = new Table();
         table.addGeneratedColumn(COL1, new ColumnGenerator() {
             @Override
@@ -47,7 +48,7 @@ public class TableColumnResizeContentsWidth extends TestBase {
     }
 
     @Override
-    protected String getDescription() {
+    protected String getTestDescription() {
         return "When a column is resized, it's contents should update to match the new size";
     }
 
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java
new file mode 100644 (file)
index 0000000..0e98e7d
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * 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.table;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.interactions.Actions;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests that components within table cells get resized when their column gets
+ * resized.
+ * 
+ * @author Vaadin Ltd
+ */
+public class TableColumnResizeContentsWidthTest extends MultiBrowserTest {
+
+    @Test
+    public void testResizing() throws InterruptedException {
+        openTestURL();
+
+        TableElement table = $(TableElement.class).first();
+        List<ButtonElement> buttons = $(ButtonElement.class).all();
+
+        WebElement textField = table.findElement(By.className("v-textfield"));
+        WebElement resizer = table.findElement(By.className("v-table-resizer"));
+
+        assertEquals(100, textField.getSize().width);
+
+        // drag resizer to left
+        new Actions(getDriver()).moveToElement(resizer).clickAndHold()
+                .moveByOffset(-20, 0).release().perform();
+
+        assertEquals(80, textField.getSize().width);
+
+        // drag resizer to right
+        new Actions(getDriver()).moveToElement(resizer).clickAndHold()
+                .moveByOffset(40, 0).release().perform();
+
+        assertEquals(120, textField.getSize().width);
+
+        // click the button for decreasing size
+        buttons.get(1).click();
+        sleep(50);
+
+        assertEquals(80, textField.getSize().width);
+
+        // click the button for increasing size
+        buttons.get(0).click();
+        sleep(50);
+
+        assertEquals(100, textField.getSize().width);
+    }
+
+}