Browse Source

Convert browserframe, flash and requesthandler tests to TB4

Change-Id: Ic2089570fcfc9ec81f3d95722adc75ff75e8293f
tags/7.5.0.alpha1
Teemu Suo-Anttila 9 years ago
parent
commit
acb12abcf9

+ 22
- 0
uitest/src/com/vaadin/tests/components/browserframe/BrowserFrameIsVisibleTest.java View File

@@ -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");
}
}

+ 25
- 0
uitest/src/com/vaadin/tests/components/flash/FlashIsVisibleTest.java View File

@@ -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");
}
}

+ 58
- 0
uitest/src/com/vaadin/tests/requesthandlers/AppResource404Test.java View File

@@ -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();
}
}
}

+ 0
- 67
uitest/tb2/com/vaadin/tests/components/browserframe/BrowserFrameIsVisible.html View File

@@ -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>

+ 0
- 33
uitest/tb2/com/vaadin/tests/components/flash/FlashIsVisible.html View File

@@ -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>

+ 0
- 81
uitest/tb2/com/vaadin/tests/requesthandlers/AppResource404.html View File

@@ -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>

Loading…
Cancel
Save