+++ /dev/null
-<?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>UIScrollTest</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">UIScrollTest</td></tr>
-</thead><tbody>
-<tr>
- <td>open</td>
- <td>/run/com.vaadin.tests.components.uitest.UIScrollTest?restartApplication</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsuitestUIScrollTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>screenCapture</td>
- <td></td>
- <td>Halfway_down_button</td>
-</tr>
-<tr>
- <td>scroll</td>
- <td>vaadin=runcomvaadintestscomponentsuitestUIScrollTest::</td>
- <td>1020</td>
-</tr>
-<tr>
- <td>pause</td>
- <td>300</td>
- <td></td>
-</tr>
-<tr>
- <td>click</td>
- <td>vaadin=runcomvaadintestscomponentsuitestUIScrollTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
- <td></td>
-</tr>
-<tr>
- <td>assertText</td>
- <td>//div[@id='runcomvaadintestscomponentsuitestUIScrollTest-1797389287-overlays']//h1</td>
- <td>Scrolled to 1020 px</td>
-</tr>
-<tr>
- <td>closeNotification</td>
- <td>//div[@id='runcomvaadintestscomponentsuitestUIScrollTest-1797389287-overlays']/div</td>
- <td>0,0</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
+++ /dev/null
-package com.vaadin.tests.components.uitest;
-
-import com.vaadin.tests.components.TestBase;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Button.ClickEvent;
-import com.vaadin.ui.Notification;
-import com.vaadin.ui.UI;
-
-public class UIScrollTest extends TestBase {
-
- @Override
- protected void setup() {
- // Set layout to high enough to get scroll.
- getLayout().setHeight("2250px");
- addComponent(new Button("scoll to 1000px", new Button.ClickListener() {
-
- @Override
- public void buttonClick(ClickEvent event) {
- UI.getCurrent().setScrollTop(1000);
- }
- }));
- addComponent(new Button(
- "This button is halfway down. Click to report scroll position.",
- new Button.ClickListener() {
- @Override
- public void buttonClick(ClickEvent event) {
- Notification.show("Scrolled to "
- + event.getButton().getUI().getScrollTop()
- + " px");
- }
- }));
- }
-
- @Override
- protected String getDescription() {
- return "Windows can be programmatically scrolled";
- }
-
- @Override
- protected Integer getTicketNumber() {
- return 9952;
- }
-
-}
--- /dev/null
+package com.vaadin.tests.components.uitest;
+
+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.Notification;
+import com.vaadin.ui.UI;
+
+public class UIScrolling extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ // Set layout to high enough to get scroll.
+ getLayout().setHeight("2250px");
+ addComponent(new Button("scroll to 1000px", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ UI.getCurrent().setScrollTop(1000);
+ }
+ }));
+ addComponent(new Button(
+ "This button is halfway down. Click to report scroll position.",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ Notification.show("Scrolled to "
+ + event.getButton().getUI().getScrollTop()
+ + " px");
+ }
+ }));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Windows can be programmatically scrolled";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9952;
+ }
+
+}
--- /dev/null
+/*
+ * 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.uitest;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.NotificationElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+/**
+ * Tests UI scrolling.
+ *
+ * @author Vaadin Ltd
+ */
+public class UIScrollingTest extends MultiBrowserTest {
+
+ @Override
+ protected boolean usePersistentHoverForIE() {
+ return false;
+ }
+
+ @Test
+ public void testScrolling() throws IOException, InterruptedException {
+ openTestURL();
+
+ List<ButtonElement> buttons = $(ButtonElement.class).all();
+ buttons.get(0).click();
+ sleep(100);
+
+ buttons.get(1).click();
+
+ waitForElementPresent(By.className("v-Notification"));
+
+ NotificationElement notification = $(NotificationElement.class).first();
+ assertEquals("Scrolled to 1000 px",
+ notification.findElement(By.tagName("h1")).getText());
+
+ // attempt to close the notification
+ try {
+ notification.closeNotification();
+ } catch (StaleElementReferenceException e) {
+ }
+
+ WebElement ui = findElement(By.className("v-ui"));
+ testBenchElement(ui).scroll(1020);
+
+ buttons.get(1).click();
+
+ waitForElementPresent(By.className("v-Notification"));
+
+ notification = $(NotificationElement.class).first();
+ assertEquals("Scrolled to 1020 px",
+ notification.findElement(By.tagName("h1")).getText());
+
+ try {
+ notification.closeNotification();
+ } catch (StaleElementReferenceException e) {
+ }
+ }
+}