diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-03-06 14:55:37 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-03-13 06:44:22 +0000 |
commit | acb12abcf93396168f6edfc34b2bccf75d34ee19 (patch) | |
tree | 974cc38610eaa04eb1b0f8b2d0849ec8684c8898 /uitest/src | |
parent | c08b0238e0aebcd167c15624c9f1188c871139b5 (diff) | |
download | vaadin-framework-acb12abcf93396168f6edfc34b2bccf75d34ee19.tar.gz vaadin-framework-acb12abcf93396168f6edfc34b2bccf75d34ee19.zip |
Convert browserframe, flash and requesthandler tests to TB4
Change-Id: Ic2089570fcfc9ec81f3d95722adc75ff75e8293f
Diffstat (limited to 'uitest/src')
3 files changed, 105 insertions, 0 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(); + } + } +} |