summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-03-06 14:55:37 +0200
committerVaadin Code Review <review@vaadin.com>2015-03-13 06:44:22 +0000
commitacb12abcf93396168f6edfc34b2bccf75d34ee19 (patch)
tree974cc38610eaa04eb1b0f8b2d0849ec8684c8898 /uitest
parentc08b0238e0aebcd167c15624c9f1188c871139b5 (diff)
downloadvaadin-framework-acb12abcf93396168f6edfc34b2bccf75d34ee19.tar.gz
vaadin-framework-acb12abcf93396168f6edfc34b2bccf75d34ee19.zip
Convert browserframe, flash and requesthandler tests to TB4
Change-Id: Ic2089570fcfc9ec81f3d95722adc75ff75e8293f
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/browserframe/BrowserFrameIsVisibleTest.java22
-rw-r--r--uitest/src/com/vaadin/tests/components/flash/FlashIsVisibleTest.java25
-rw-r--r--uitest/src/com/vaadin/tests/requesthandlers/AppResource404Test.java58
-rw-r--r--uitest/tb2/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.html67
-rw-r--r--uitest/tb2/com/vaadin/tests/components/flash/FlashIsVisible.html33
-rw-r--r--uitest/tb2/com/vaadin/tests/requesthandlers/AppResource404.html81
6 files changed, 105 insertions, 181 deletions
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
index 0000000000..927b76d2c3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/browserframe/BrowserFrameIsVisibleTest.java
@@ -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
index 0000000000..4a18d4d8a2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/flash/FlashIsVisibleTest.java
@@ -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
index 0000000000..f762573a09
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404Test.java
@@ -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
index 93b855838c..0000000000
--- a/uitest/tb2/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.html
+++ /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
index f3f8f50526..0000000000
--- a/uitest/tb2/com/vaadin/tests/components/flash/FlashIsVisible.html
+++ /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
index 543faa30dd..0000000000
--- a/uitest/tb2/com/vaadin/tests/requesthandlers/AppResource404.html
+++ /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>