]> source.dussan.org Git - vaadin-framework.git/commitdiff
Convert TableInFormLayoutCausesScrollingTest to TB4.
authorSauli Tähkäpää <sauli@vaadin.com>
Fri, 12 Sep 2014 12:54:22 +0000 (15:54 +0300)
committerVaadin Code Review <review@vaadin.com>
Fri, 19 Sep 2014 06:07:29 +0000 (06:07 +0000)
Change-Id: I9f2cec6ad77b05e7175de390240977d881530ded

uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.html [deleted file]
uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java
uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java [new file with mode: 0644]

diff --git a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.html b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.html
deleted file mode 100644 (file)
index 8795ad1..0000000
+++ /dev/null
@@ -1,32 +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.formlayout.TableInFormLayoutCausesScrolling?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClick</td>
-       <td>vaadin=runcomvaadintestscomponentsformlayoutTableInFormLayoutCausesScrolling::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
-       <td>12,13</td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>should-be-scrolled-up</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
index 3978c49b093176f1a17343d9352d4e01ae10565f..9ba6f0ea947c3652d6e31a7b335c268795a0b92d 100644 (file)
@@ -1,40 +1,35 @@
 package com.vaadin.tests.components.formlayout;
 
-import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.FormLayout;
-import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.Table;
 import com.vaadin.ui.TextField;
 
-public class TableInFormLayoutCausesScrolling extends AbstractTestCase {
+public class TableInFormLayoutCausesScrolling extends AbstractTestUI {
 
     @Override
-    public void init() {
-        // Window Initialization.
-        final LegacyWindow window = new LegacyWindow("Main Window");
-        setMainWindow(window);
+    public void setup(VaadinRequest request) {
 
-        // FormLayout creation
         final FormLayout fl = new FormLayout();
-        window.setContent(fl);
+        addComponent(fl);
 
-        // Add 20 TextField
         for (int i = 20; i-- > 0;) {
             fl.addComponent(new TextField());
         }
 
-        // Add 1 selectable table with some items
         final Table table = new Table();
         table.setSelectable(true);
         table.addContainerProperty("item", String.class, "");
         for (int i = 50; i-- > 0;) {
             table.addItem(new String[] { "item" + i }, i);
         }
-        window.addComponent(table);
+
+        fl.addComponent(table);
     }
 
     @Override
-    protected String getDescription() {
+    protected String getTestDescription() {
         return "Clicking in the Table should not cause the page to scroll";
     }
 
diff --git a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java
new file mode 100644 (file)
index 0000000..dc10217
--- /dev/null
@@ -0,0 +1,23 @@
+package com.vaadin.tests.components.formlayout;
+
+import com.vaadin.testbench.elements.TableElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Test;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.interactions.Actions;
+
+import java.io.IOException;
+
+public class TableInFormLayoutCausesScrollingTest extends MultiBrowserTest {
+
+    @Test
+    public void pageIsNotScrolled() throws IOException {
+        openTestURL();
+
+        new Actions(driver).sendKeys(Keys.PAGE_DOWN).perform();
+
+        $(TableElement.class).first().getCell(2, 0).click();
+
+        compareScreen("scrolledDown");
+    }
+}
\ No newline at end of file