summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnna Koskinen <anna@vaadin.com>2014-07-30 15:48:20 +0300
committerVaadin Code Review <review@vaadin.com>2014-08-20 08:14:22 +0000
commit3d77d5fb627976b1419cbcc714e8f2c3b74af39d (patch)
tree4c0e2d71e3cb3d5719c52f46c6e5622c0e83ccea
parent0c09f071d69a678ade7d38389f6291a852fd221a (diff)
downloadvaadin-framework-3d77d5fb627976b1419cbcc714e8f2c3b74af39d.tar.gz
vaadin-framework-3d77d5fb627976b1419cbcc714e8f2c3b74af39d.zip
TableColumnResizeContentsWidth test upgrade (#14292)
Change-Id: I1adc4dfea7bf62191a23a89440eeca677f47e6a6
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html61
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java9
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java76
3 files changed, 81 insertions, 65 deletions
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
index f2a3a06254..0000000000
--- a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html
+++ /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>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java
index 0b695b41c7..b785f439ea 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java
@@ -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
index 0000000000..0e98e7ddec
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidthTest.java
@@ -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);
+ }
+
+}