]> source.dussan.org Git - vaadin-framework.git/commitdiff
Convert browserframe, flash and requesthandler tests to TB4
authorTeemu Suo-Anttila <teemusa@vaadin.com>
Fri, 6 Mar 2015 12:55:37 +0000 (14:55 +0200)
committerVaadin Code Review <review@vaadin.com>
Fri, 13 Mar 2015 06:44:22 +0000 (06:44 +0000)
Change-Id: Ic2089570fcfc9ec81f3d95722adc75ff75e8293f

uitest/src/com/vaadin/tests/components/browserframe/BrowserFrameIsVisibleTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/components/flash/FlashIsVisibleTest.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/requesthandlers/AppResource404Test.java [new file with mode: 0644]
uitest/tb2/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.html [deleted file]
uitest/tb2/com/vaadin/tests/components/flash/FlashIsVisible.html [deleted file]
uitest/tb2/com/vaadin/tests/requesthandlers/AppResource404.html [deleted file]

diff --git a/uitest/src/com/vaadin/tests/components/browserframe/BrowserFrameIsVisibleTest.java b/uitest/src/com/vaadin/tests/components/browserframe/BrowserFrameIsVisibleTest.java
new file mode 100644 (file)
index 0000000..927b76d
--- /dev/null
@@ -0,0 +1,22 @@
+package com.vaadin.tests.components.browserframe;
+
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class BrowserFrameIsVisibleTest extends MultiBrowserTest {
+    @Test
+    public void testBrowserFrameDisplaysFiles() throws Exception {
+        openTestURL();
+        compareScreen("show_initial");
+        $(ButtonElement.class).caption("Hello World").first().click();
+        compareScreen("show_hello");
+        $(ButtonElement.class).caption("Lorem ipsum").first().click();
+        compareScreen("show_lorem");
+        $(ButtonElement.class).caption("null").first().click();
+        compareScreen("show_alternative_text");
+        $(ButtonElement.class).caption("Lorem ipsum").first().click();
+        compareScreen("show_lorem");
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/flash/FlashIsVisibleTest.java b/uitest/src/com/vaadin/tests/components/flash/FlashIsVisibleTest.java
new file mode 100644 (file)
index 0000000..4a18d4d
--- /dev/null
@@ -0,0 +1,25 @@
+package com.vaadin.tests.components.flash;
+
+import java.util.List;
+
+import org.junit.Test;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class FlashIsVisibleTest extends MultiBrowserTest {
+
+    @Override
+    public List<DesiredCapabilities> getBrowsersToTest() {
+        // FF and PhantomJS fail at Flash and ShiftClick
+        return getBrowsersSupportingShiftClick();
+    }
+
+    @Test
+    public void testFlashIsCorrectlyDisplayed() throws Exception {
+        openTestURL();
+        /* Allow the flash plugin to load before taking the screenshot */
+        sleep(5000);
+        compareScreen("blue-circle");
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404Test.java b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404Test.java
new file mode 100644 (file)
index 0000000..f762573
--- /dev/null
@@ -0,0 +1,58 @@
+package com.vaadin.tests.requesthandlers;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.vaadin.testbench.elements.LinkElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class AppResource404Test extends MultiBrowserTest {
+    @Test
+    public void testOpenExistingResource() throws Exception {
+        openTestURL();
+        $(LinkElement.class).first().click(5, 5);
+        disableWaitingAndWait();
+        Assert.assertFalse("Page contains the given text", driver
+                .getPageSource().contains("404"));
+    }
+
+    @Test
+    public void testOpenNonExistingResource() {
+        openTestURL();
+        $(LinkElement.class).get(1).click(5, 5);
+        disableWaitingAndWait();
+        Assert.assertTrue(
+                "Page does not contain the given text",
+                driver.getPageSource().contains(
+                        "/APP/connector/0/4/asdfasdf can not be found"));
+    }
+
+    @Test
+    public void testOpenResourceWith404() {
+        openTestURL();
+        $(LinkElement.class).get(2).click(5, 5);
+        disableWaitingAndWait();
+        Assert.assertTrue("Page does not contain the given text", driver
+                .getPageSource().contains("HTTP ERROR 404"));
+        Assert.assertTrue("Page does not contain the given text", driver
+                .getPageSource().contains("Problem accessing /run/APP/"));
+    }
+
+    @Test
+    public void testOpenResourceToUIProvider() {
+        openTestURL();
+        $(LinkElement.class).get(3).click(5, 5);
+        disableWaitingAndWait();
+        Assert.assertFalse("Page contains the given text", driver
+                .getPageSource().contains("can not be found"));
+    }
+
+    protected void disableWaitingAndWait() {
+        testBench().disableWaitForVaadin();
+        try {
+            sleep(500);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/uitest/tb2/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.html b/uitest/tb2/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.html
deleted file mode 100644 (file)
index 93b8558..0000000
+++ /dev/null
@@ -1,67 +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>BrowserFrameIsVisible</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">BrowserFrameIsVisible</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.components.browserframe.BrowserFrameIsVisible?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>show_initial</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentsbrowserframeBrowserFrameIsVisible::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[0]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>show_hello</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentsbrowserframeBrowserFrameIsVisible::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[1]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>show_lorem</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentsbrowserframeBrowserFrameIsVisible::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[2]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>show_alternative_text</td>
-</tr>
-<tr>
-       <td>click</td>
-       <td>vaadin=runcomvaadintestscomponentsbrowserframeBrowserFrameIsVisible::/VVerticalLayout[0]/VVerticalLayout[0]/VHorizontalLayout[0]/VButton[1]/domChild[0]/domChild[0]</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>show_lorem2</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/tb2/com/vaadin/tests/components/flash/FlashIsVisible.html b/uitest/tb2/com/vaadin/tests/components/flash/FlashIsVisible.html
deleted file mode 100644 (file)
index f3f8f50..0000000
+++ /dev/null
@@ -1,33 +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.flash.FlashIsVisible</td>
-       <td></td>
-</tr>
-<!--Allow the flash plugin to load before taking the screenshot-->
-<tr>
-       <td>pause</td>
-       <td>5000</td>
-       <td></td>
-</tr>
-<tr>
-       <td>screenCapture</td>
-       <td></td>
-       <td>blue-circle</td>
-</tr>
-
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/tb2/com/vaadin/tests/requesthandlers/AppResource404.html b/uitest/tb2/com/vaadin/tests/requesthandlers/AppResource404.html
deleted file mode 100644 (file)
index 543faa3..0000000
+++ /dev/null
@@ -1,81 +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:8888/" />
-<title>CloseSubWindow</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">CloseSubWindow</td></tr>
-</thead><tbody>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.requesthandlers.AppResource404?restartApplication</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClickAndWait</td>
-       <td>vaadin=runcomvaadintestsrequesthandlersAppResource404::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VLink[0]/domChild[0]/domChild[0]</td>
-       <td>57,3</td>
-</tr>
-<tr>
-       <td>assertTextNotPresent</td>
-       <td>404</td>
-       <td></td>
-</tr>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.requesthandlers.AppResource404</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClickAndWait</td>
-       <td>vaadin=runcomvaadintestsrequesthandlersAppResource404::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VLink[0]/domChild[0]/domChild[0]</td>
-       <td>72,9</td>
-</tr>
-<tr>
-       <td>assertTextPresent</td>
-       <td>/APP/connector/0/4/asdfasdf can not be found</td>
-       <td></td>
-</tr>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.requesthandlers.AppResource404</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClickAndWait</td>
-       <td>vaadin=runcomvaadintestsrequesthandlersAppResource404::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VLink[0]/domChild[0]/domChild[0]</td>
-       <td>97,5</td>
-</tr>
-<tr>
-       <td>assertTextPresent</td>
-       <td>HTTP ERROR 404</td>
-       <td></td>
-</tr>
-<tr>
-       <td>assertTextPresent</td>
-       <td>Problem accessing /run/APP/</td>
-       <td></td>
-</tr>
-<tr>
-       <td>open</td>
-       <td>/run/com.vaadin.tests.requesthandlers.AppResource404</td>
-       <td></td>
-</tr>
-<tr>
-       <td>mouseClickAndWait</td>
-       <td>vaadin=runcomvaadintestsrequesthandlersAppResource404::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VLink[0]/domChild[0]/domChild[0]</td>
-       <td>99,7</td>
-</tr>
-<tr>
-       <td>assertTextNotPresent</td>
-       <td>can not be found</td>
-       <td></td>
-</tr>
-</tbody></table>
-</body>
-</html>