]> source.dussan.org Git - vaadin-framework.git/commitdiff
Replace a TB2 test of Table column reordering.
authorMika Murtojarvi <mika@vaadin.com>
Fri, 12 Jun 2015 08:20:49 +0000 (11:20 +0300)
committerVaadin Code Review <review@vaadin.com>
Mon, 15 Jun 2015 14:04:31 +0000 (14:04 +0000)
Change-Id: I31649d5bf5a5463bea5f8f1689100ad8b69b5205

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

diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java b/uitest/src/com/vaadin/tests/components/table/ColumnReorderingWithManyColumnsTest.java
new file mode 100644 (file)
index 0000000..4a5947c
--- /dev/null
@@ -0,0 +1,38 @@
+package com.vaadin.tests.components.table;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+
+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.TableElement;
+import com.vaadin.testbench.elements.TableHeaderElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class ColumnReorderingWithManyColumnsTest extends MultiBrowserTest {
+    @Test
+    public void testReordering() throws IOException {
+        openTestURL();
+        TableElement table = $(TableElement.class).first();
+        TableHeaderElement sourceCell = table.getHeaderCell(0);
+        TableHeaderElement targetCell = table.getHeaderCell(10);
+        drag(sourceCell, targetCell);
+        WebElement markedElement = table.findElement(By
+                .className("v-table-focus-slot-right"));
+        String markedColumnName = markedElement.findElement(By.xpath(".."))
+                .getText();
+        assertEquals("col-9", markedColumnName.toLowerCase());
+    }
+
+    private void drag(WebElement source, WebElement target) {
+        Actions actions = new Actions(getDriver());
+        actions.moveToElement(source, 10, 10);
+        actions.clickAndHold(source);
+        actions.moveToElement(target, 10, 10);
+        actions.perform();
+    }
+}
\ No newline at end of file
diff --git a/uitest/tb2/com/vaadin/tests/components/table/ColumnReorderingWithManyColumns.html b/uitest/tb2/com/vaadin/tests/components/table/ColumnReorderingWithManyColumns.html
deleted file mode 100644 (file)
index 5b5c83e..0000000
+++ /dev/null
@@ -1,42 +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="http://localhost:8068/" />
-<title>ColumnReorderingWithManyColumns</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">ColumnReorderingWithManyColumns</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/ColumnReorderingWithManyColumns?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>drag</td>
-       <td>vaadin=runColumnReorderingWithManyColumns::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/</td>
-       <td>10,10</td>
-</tr>
-<tr>
-       <td>mouseMoveAt</td>
-       <td>vaadin=runColumnReorderingWithManyColumns::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[10]/domChild[2]</td>
-       <td>10,10</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td></td>
-</tr>
-<tr>
-       <td>drop</td>
-       <td>vaadin=runColumnReorderingWithManyColumns::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[10]/domChild[2]</td>
-       <td>10,10</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>