diff options
author | Artur Signell <artur@vaadin.com> | 2014-02-22 01:17:44 +0200 |
---|---|---|
committer | Johannes Dahlström <johannesd@vaadin.com> | 2014-02-21 23:47:44 +0000 |
commit | 28a0b2e1cb7157ab43cd940aca5ce3e30caafab5 (patch) | |
tree | 1931c4381de31a10abbdda63182652fdf0ab005c /uitest/src/com/vaadin/tests/push/PushConfigurationTest.java | |
parent | 58129946d0c190ec1e9228abb013e75fe134496e (diff) | |
download | vaadin-framework-28a0b2e1cb7157ab43cd940aca5ce3e30caafab5.tar.gz vaadin-framework-28a0b2e1cb7157ab43cd940aca5ce3e30caafab5.zip |
Missing long polling tests (#13164)
Change-Id: If0a7ff0f6736853e9a5e8de417a435cf474a335b
Diffstat (limited to 'uitest/src/com/vaadin/tests/push/PushConfigurationTest.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/push/PushConfigurationTest.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java index 1f8c4c0e38..1c33293d55 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java @@ -93,6 +93,40 @@ public class PushConfigurationTest extends WebsocketTest { } + @Test + public void testLongPolling() { + setDebug(true); + openTestURL(); + int counter = getServerCounter(); + assertGreaterOrEqual("Counter should be >= 1. Was: " + counter, + counter, 1); + new Select(getTransportSelect()).selectByVisibleText("LONG_POLLING"); + new Select(getPushModeSelect()).selectByVisibleText("AUTOMATIC"); + Assert.assertTrue(vaadinElement( + "/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[5]/VLabel[0]/domChild[0]") + .getText() + .matches( + "^[\\s\\S]*fallbackTransport: streaming[\\s\\S]*transport: long-polling[\\s\\S]*$")); + counter = getServerCounter(); + final int waitCounter = counter + 2; + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + return (getServerCounter() >= waitCounter); + } + }); + + // Use debug console to verify we used the correct transport type + Assert.assertTrue(driver.getPageSource().contains( + "Push connection established using longpolling")); + Assert.assertFalse(driver.getPageSource().contains( + "Push connection established using streaming")); + + new Select(getPushModeSelect()).selectByVisibleText("DISABLED"); + + } + private WebElement getPushModeSelect() { return vaadinElement("/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VNativeSelect[0]/domChild[0]"); } |