diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/push')
16 files changed, 140 insertions, 29 deletions
diff --git a/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java b/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java index 4013494c49..7bd1de5803 100644 --- a/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java +++ b/uitest/src/com/vaadin/tests/push/BarInUIDLTest.java @@ -19,7 +19,7 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/BasicPushTest.java b/uitest/src/com/vaadin/tests/push/BasicPushTest.java index fd34a1f192..5bac54f0f7 100644 --- a/uitest/src/com/vaadin/tests/push/BasicPushTest.java +++ b/uitest/src/com/vaadin/tests/push/BasicPushTest.java @@ -20,7 +20,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.AbstractTB3Test; import com.vaadin.tests.tb3.MultiBrowserTest; diff --git a/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java index 03b34655a1..654108f8f9 100644 --- a/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java +++ b/uitest/src/com/vaadin/tests/push/EnableDisablePushTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.openqa.selenium.WebElement; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java b/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java index 4b142500f7..344f551f00 100644 --- a/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java +++ b/uitest/src/com/vaadin/tests/push/IdlePushChannelTest.java @@ -18,7 +18,7 @@ package com.vaadin.tests.push; import org.junit.Assert; import org.junit.Test; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java index 396160cc7d..14ef9e1144 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationTest.java @@ -22,26 +22,26 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedCondition; import com.vaadin.testbench.elements.NativeSelectElement; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") abstract class PushConfigurationTest extends MultiBrowserTest { @Override + protected Class<?> getUIClass() { + return PushConfiguration.class; + } + + @Override public void setup() throws Exception { super.setup(); + setDebug(true); - openTestURL(); + openTestURL("restartApplication"); disablePush(); } - @Override - protected String getDeploymentPath() { - return "/run/" + PushConfiguration.class.getCanonicalName() - + "?restartApplication&debug"; - } - protected String getStatusText() { WebElement statusLabel = vaadinElementById("status"); diff --git a/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java b/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java index 475fa2165f..501d946fcc 100644 --- a/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java +++ b/uitest/src/com/vaadin/tests/push/PushConfigurationWebSocketTest.java @@ -28,13 +28,7 @@ public class PushConfigurationWebSocketTest extends PushConfigurationTest { @Override public List<DesiredCapabilities> getBrowsersToTest() { - - List<DesiredCapabilities> browsers = super.getBrowsersToTest(); - browsers.remove(Browser.IE8.getDesiredCapabilities()); - browsers.remove(Browser.IE9.getDesiredCapabilities()); - browsers.remove(Browser.PHANTOMJS.getDesiredCapabilities()); - - return browsers; + return getBrowsersSupportingWebSocket(); } @Test diff --git a/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java b/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java index 1f6e181c89..2683868db5 100644 --- a/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java +++ b/uitest/src/com/vaadin/tests/push/PushErrorHandlingTest.java @@ -21,7 +21,8 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import com.vaadin.testbench.elements.LabelElement; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.BrowserUtil; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/PushFromInitTest.java b/uitest/src/com/vaadin/tests/push/PushFromInitTest.java index a285d91e92..fe7ebebef1 100644 --- a/uitest/src/com/vaadin/tests/push/PushFromInitTest.java +++ b/uitest/src/com/vaadin/tests/push/PushFromInitTest.java @@ -19,7 +19,7 @@ import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedCondition; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java index e37bd32832..23255aadea 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeDataLongPollingTest.java @@ -19,7 +19,7 @@ import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java index 058ac6cc92..0c00cf116f 100644 --- a/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java +++ b/uitest/src/com/vaadin/tests/push/PushLargeDataStreamingTest.java @@ -19,7 +19,7 @@ import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.support.ui.ExpectedConditions; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/PushPath.java b/uitest/src/com/vaadin/tests/push/PushPath.java new file mode 100644 index 0000000000..20771bd84f --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushPath.java @@ -0,0 +1,77 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.push; + +import com.vaadin.annotations.Push; +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.ui.Transport; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Label; + +@Push(transport = Transport.WEBSOCKET) +public class PushPath extends AbstractTestUI { + + public static final String PUSH_PATH_LABEL_ID = "push-path-label-id"; + public static final String PUSH_PATH_LABEL_TEXT = "Label by push"; + + @Override + protected void setup(VaadinRequest request) { + // use only websockets + getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET); + + String pushPath = request.getService().getDeploymentConfiguration() + .getPushPath(); + String transport = getPushConfiguration().getTransport().name(); + Label pushPathLabel = new Label(String.format( + "Waiting for push from path '%s' using %s in 3 seconds.", + pushPath, transport)); + addComponent(pushPathLabel); + + new PushThread().start(); + } + + public class PushThread extends Thread { + + @Override + public void run() { + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + } + access(new Runnable() { + + @Override + public void run() { + Label pushLabel = new Label(PUSH_PATH_LABEL_TEXT); + pushLabel.setId(PUSH_PATH_LABEL_ID); + addComponent(pushLabel); + } + }); + + } + } + + @Override + public Integer getTicketNumber() { + return 14432; + } + + @Override + public String getDescription() { + return "Push path should be configurable since some servers can't serve both websockets and long polling from same URL."; + } + +} diff --git a/uitest/src/com/vaadin/tests/push/PushPathTest.java b/uitest/src/com/vaadin/tests/push/PushPathTest.java new file mode 100644 index 0000000000..0af9c8d3a7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/push/PushPathTest.java @@ -0,0 +1,39 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.push; + +import org.junit.Assert; +import org.junit.Test; + +import com.vaadin.tests.tb3.WebsocketTest; + +public class PushPathTest extends WebsocketTest { + + private static final int TEN_SECONDS_IN_MS = 10 * 1000; + + @Test + public void testCustomPushPath() throws InterruptedException { + openTestURL(); + sleep(TEN_SECONDS_IN_MS); + Assert.assertEquals(vaadinElementById(PushPath.PUSH_PATH_LABEL_ID) + .getText(), PushPath.PUSH_PATH_LABEL_TEXT); + } + + @Override + protected String getDeploymentPath(Class<?> uiClass) { + return "/run-pushpath/" + uiClass.getCanonicalName(); + } +} diff --git a/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java index 42babb00d0..47773b87b6 100644 --- a/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java +++ b/uitest/src/com/vaadin/tests/push/RefreshCloseConnectionTest.java @@ -17,13 +17,12 @@ package com.vaadin.tests.push; import java.util.List; -import com.vaadin.tests.annotations.TestCategory; import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.remote.DesiredCapabilities; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; -import com.vaadin.tests.tb3.WebsocketTest; @TestCategory("push") public class RefreshCloseConnectionTest extends MultiBrowserTest { diff --git a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java index a639f7dbe3..69e5de960a 100644 --- a/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java +++ b/uitest/src/com/vaadin/tests/push/SendMultibyteCharactersTest.java @@ -1,10 +1,11 @@ package com.vaadin.tests.push; +import org.junit.Test; + import com.vaadin.testbench.By; import com.vaadin.testbench.elements.TextAreaElement; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; -import org.junit.Test; @TestCategory("push") public abstract class SendMultibyteCharactersTest extends MultiBrowserTest { diff --git a/uitest/src/com/vaadin/tests/push/TogglePushTest.java b/uitest/src/com/vaadin/tests/push/TogglePushTest.java index 3ca12fdd84..d93802125c 100644 --- a/uitest/src/com/vaadin/tests/push/TogglePushTest.java +++ b/uitest/src/com/vaadin/tests/push/TogglePushTest.java @@ -19,7 +19,7 @@ import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.WebElement; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") diff --git a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java b/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java index b4af11b864..35d0f0ad5f 100644 --- a/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java +++ b/uitest/src/com/vaadin/tests/push/TrackMessageSizeUITest.java @@ -18,7 +18,7 @@ package com.vaadin.tests.push; import org.junit.Assert; import org.junit.Test; -import com.vaadin.tests.annotations.TestCategory; +import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.tests.tb3.MultiBrowserTest; @TestCategory("push") |