aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/integration
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-09-26 09:28:50 +0300
committerArtur Signell <artur@vaadin.com>2013-09-26 09:28:50 +0300
commitc18b20050d6b04a2c69b3fdfc75ca901b78edc0a (patch)
tree1d91200782aa20a4fcf331bb0f773070c7cd080a /uitest/src/com/vaadin/tests/integration
parent7c5bdce3b4c76e7f19bc46bcaed135d67a94f06a (diff)
parentbd0ae0581f265be57374b236cfe1b71043ab69aa (diff)
downloadvaadin-framework-c18b20050d6b04a2c69b3fdfc75ca901b78edc0a.tar.gz
vaadin-framework-c18b20050d6b04a2c69b3fdfc75ca901b78edc0a.zip
Merge changes from origin/7.1
7f7dc31 Base files for TB3 tests (#12572) 6b17abe Make it possible to override web driver in tests (#12572) a682e3b Refactored build scripts to support TB2, TB3 + integration tests (#12572) e556642 Converted servlet integration tests to TB3 (#12573) 21af0c3 Updated TB3 tests to use Firefox 24 (#12604) a7583c6 TB3 test for browsers (#12572) 37b8543 Do not add empty package javadoc for new classes 0248b8f Fixes browser detection for IE11 (#12638) 1df28c3 Run TB3 tests also on IE11 (#12631) a2daf65 Converted TB2 push tests to TB3 (#12580) d3261d7 Fixes issue with Table not scrolling completely to the end #12651 bd0ae05 Limit the number of tests run concurrently (#12572) Change-Id: Idb4389aac388b728490a4ffd57d30aee20ea9fe8
Diffstat (limited to 'uitest/src/com/vaadin/tests/integration')
-rw-r--r--uitest/src/com/vaadin/tests/integration/AbstractIntegrationTestTB3.java53
-rw-r--r--uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java54
-rw-r--r--uitest/src/com/vaadin/tests/integration/IntegrationTestStreaming.java35
-rwxr-xr-xuitest/src/com/vaadin/tests/integration/IntegrationTestUI.java5
-rw-r--r--uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocket.java49
-rw-r--r--uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java62
6 files changed, 258 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTestTB3.java b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTestTB3.java
new file mode 100644
index 0000000000..e170450619
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/integration/AbstractIntegrationTestTB3.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2013 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.integration;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized.Parameters;
+import org.openqa.selenium.remote.DesiredCapabilities;
+
+import com.vaadin.tests.tb3.PrivateTB3Configuration;
+
+/**
+ * Base class for integration tests. Integration tests use the
+ * {@literal deployment.url} parameter to determine the base deployment url
+ * (http://hostname:123)
+ *
+ * @author Vaadin Ltd
+ */
+@RunWith(IntegrationTestRunner.class)
+public abstract class AbstractIntegrationTestTB3 extends
+ PrivateTB3Configuration {
+ @Override
+ protected String getBaseURL() {
+ String deploymentUrl = System.getProperty("deployment.url");
+ if (deploymentUrl == null || deploymentUrl.equals("")) {
+ throw new RuntimeException(
+ "Deployment url must be given as deployment.url");
+ }
+
+ return deploymentUrl;
+ }
+
+ @Parameters
+ public static Collection<DesiredCapabilities> getBrowsersForTest() {
+ return Collections.singleton(BrowserUtil.firefox(17));
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java
new file mode 100644
index 0000000000..29ee4e6023
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestRunner.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2000-2013 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.integration;
+
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+
+import com.vaadin.tests.tb3.TB3Runner;
+
+/**
+ * JUnit runner for integration tests. Replaces the actual method name with the
+ * server-name property when generating the test name.
+ *
+ * @author Vaadin Ltd
+ */
+public class IntegrationTestRunner extends TB3Runner {
+
+ private Class<?> testClass;
+
+ public IntegrationTestRunner(Class<?> klass) throws InitializationError {
+ super(klass);
+ testClass = klass;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.junit.runners.BlockJUnit4ClassRunner#testName(org.junit.runners.model
+ * .FrameworkMethod)
+ */
+ @Override
+ protected String testName(FrameworkMethod method) {
+ if (AbstractIntegrationTestTB3.class.isAssignableFrom(testClass)) {
+ return System.getProperty("server-name");
+ } else {
+ return super.testName(method);
+ }
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestStreaming.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestStreaming.java
new file mode 100644
index 0000000000..20ddac9dd1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestStreaming.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2000-2013 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.integration;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.shared.ui.ui.Transport;
+
+/**
+ * Server test which uses streaming
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+@Push(transport = Transport.STREAMING)
+public class IntegrationTestStreaming extends IntegrationTestUI {
+
+ public static class IntegrationTestStreamingTB3 extends
+ ServletIntegrationTestTB3 {
+ // Uses the test method declared in the super class
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java
index 0e6cb19b30..3d0a338bba 100755
--- a/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java
+++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestUI.java
@@ -12,6 +12,11 @@ import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
public class IntegrationTestUI extends UI {
+
+ public class IntegrationTestXhrTB3 extends ServletIntegrationTestTB3 {
+ // Uses the test method declared in the super class
+ }
+
@Override
protected void init(VaadinRequest request) {
VerticalLayout layout = new VerticalLayout();
diff --git a/uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocket.java b/uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocket.java
new file mode 100644
index 0000000000..eaa23de3cf
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/integration/IntegrationTestWebsocket.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2013 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.integration;
+
+import com.vaadin.annotations.Push;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.ui.Transport;
+
+/**
+ * Server test which uses websockets
+ *
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+@Push(transport = Transport.WEBSOCKET)
+public class IntegrationTestWebsocket extends IntegrationTestUI {
+
+ public class IntegrationTestWebsocketTB3 extends ServletIntegrationTestTB3 {
+ // Uses the test method declared in the super class
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.vaadin.tests.integration.IntegrationTestUI#init(com.vaadin.server
+ * .VaadinRequest)
+ */
+ @Override
+ protected void init(VaadinRequest request) {
+ super.init(request);
+ // Ensure no fallback is used
+ getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java b/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java
new file mode 100644
index 0000000000..ae83083d85
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/integration/ServletIntegrationTestTB3.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright 2000-2013 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.integration;
+
+import java.io.IOException;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+/**
+ * Base class for servlet integration tests. Automatically prepends "/demo" to
+ * the deployment path
+ *
+ * @author Vaadin Ltd
+ */
+public abstract class ServletIntegrationTestTB3 extends
+ AbstractIntegrationTestTB3 {
+
+ @Test
+ public void runTest() throws IOException, AssertionError {
+ compareScreen("initial");
+
+ WebElement cell = vaadinElement(getTableCell(getTable(), 0, 1));
+ testBenchElement(cell).click(51, 13);
+
+ compareScreen("finland");
+ }
+
+ private String getTableCell(String tableLocator, int row, int col) {
+ return tableLocator
+ + "/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild["
+ + row + "]/domChild[" + col + "]/domChild[0]";
+ }
+
+ protected String getTable() {
+ return "/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]";
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.vaadin.tests.tb3.AbstractTB3Test#getDeploymentPath()
+ */
+ @Override
+ protected String getDeploymentPath() {
+ return "/demo" + super.getDeploymentPath();
+ }
+
+}