diff options
author | Anna Koskinen <anna@vaadin.com> | 2014-08-04 14:22:40 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2014-08-19 08:49:03 +0000 |
commit | 1b12dca6368939236ccce69ccba39be453740e52 (patch) | |
tree | 59f3143cc2f300a61f5e59202661b94c94954835 /uitest/src/com | |
parent | 7143c2750c3b503e09b8d801ef73858e0f38f68e (diff) | |
download | vaadin-framework-1b12dca6368939236ccce69ccba39be453740e52.tar.gz vaadin-framework-1b12dca6368939236ccce69ccba39be453740e52.zip |
UIScrollTest test upgrade (#14292)
Change-Id: I5203b69d2f4ad67107ac347bff9b56b6d66c63bd
Diffstat (limited to 'uitest/src/com')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.html | 57 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/uitest/UIScrolling.java (renamed from uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.java) | 11 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/uitest/UIScrollingTest.java | 82 |
3 files changed, 88 insertions, 62 deletions
diff --git a/uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.html b/uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.html deleted file mode 100644 index acbe30c5d2..0000000000 --- a/uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.html +++ /dev/null @@ -1,57 +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>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> diff --git a/uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.java b/uitest/src/com/vaadin/tests/components/uitest/UIScrolling.java index 66b6ef90b1..a6f9d6e752 100644 --- a/uitest/src/com/vaadin/tests/components/uitest/UIScrollTest.java +++ b/uitest/src/com/vaadin/tests/components/uitest/UIScrolling.java @@ -1,18 +1,19 @@ package com.vaadin.tests.components.uitest; -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.Notification; import com.vaadin.ui.UI; -public class UIScrollTest extends TestBase { +public class UIScrolling extends AbstractTestUI { @Override - protected void setup() { + protected void setup(VaadinRequest request) { // Set layout to high enough to get scroll. getLayout().setHeight("2250px"); - addComponent(new Button("scoll to 1000px", new Button.ClickListener() { + addComponent(new Button("scroll to 1000px", new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { @@ -32,7 +33,7 @@ public class UIScrollTest extends TestBase { } @Override - protected String getDescription() { + protected String getTestDescription() { return "Windows can be programmatically scrolled"; } diff --git a/uitest/src/com/vaadin/tests/components/uitest/UIScrollingTest.java b/uitest/src/com/vaadin/tests/components/uitest/UIScrollingTest.java new file mode 100644 index 0000000000..46d79a2ce5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/uitest/UIScrollingTest.java @@ -0,0 +1,82 @@ +/* + * 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) { + } + } +} |