From 3bbf16e22860452d6fd34ccc127b42a3a2baac04 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sauli=20T=C3=A4hk=C3=A4p=C3=A4=C3=A4?= Date: Fri, 12 Sep 2014 15:54:22 +0300 Subject: [PATCH] Convert TableInFormLayoutCausesScrollingTest to TB4. Change-Id: I9f2cec6ad77b05e7175de390240977d881530ded --- .../TableInFormLayoutCausesScrolling.html | 32 ------------------- .../TableInFormLayoutCausesScrolling.java | 21 +++++------- .../TableInFormLayoutCausesScrollingTest.java | 23 +++++++++++++ 3 files changed, 31 insertions(+), 45 deletions(-) delete mode 100644 uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.html create mode 100644 uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java 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 index 8795ad12dc..0000000000 --- a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - -New Test - - - - - - - - - - - - - - - - - - - - - - -
New Test
open/run/com.vaadin.tests.components.formlayout.TableInFormLayoutCausesScrolling?restartApplication
mouseClickvaadin=runcomvaadintestscomponentsformlayoutTableInFormLayoutCausesScrolling::/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]12,13
screenCaptureshould-be-scrolled-up
- - diff --git a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java index 3978c49b09..9ba6f0ea94 100644 --- a/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java +++ b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrolling.java @@ -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 index 0000000000..dc10217efb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/formlayout/TableInFormLayoutCausesScrollingTest.java @@ -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 -- 2.39.5