]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add test to verify proper init of websockets (#10865)
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>
Wed, 2 May 2018 12:28:57 +0000 (15:28 +0300)
committerIlia Motornyi <elmot@vaadin.com>
Wed, 2 May 2018 13:19:02 +0000 (16:19 +0300)
test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java

index d1aa26e351412e13cb0a86dc721702889a4cef58..3a722768e4c6178d176273a887663d1948597a6c 100644 (file)
  */
 package com.vaadin.tests.integration.websocket;
 
+import static org.junit.Assert.assertEquals;
+
+import java.util.stream.Stream;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
 import com.vaadin.tests.integration.AbstractServletIntegrationTest;
 
 public class ServletIntegrationWebsocketIT
@@ -25,4 +33,27 @@ public class ServletIntegrationWebsocketIT
     protected String getTestPath() {
         return "/run/ServletIntegrationWebsocketUI";
     }
+
+    @Test
+    public void testWebsockedUsed() {
+        // Make sure the correct debug window tab is open.
+        findElements(By.className("v-debugwindow-tab")).get(1).click();
+
+        try {
+            // Wait to make sure correct tab is shown.
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+        }
+
+        WebElement row = findElements(By.className("v-debugwindow-row")).get(7);
+        assertEquals("Communication method",
+                row.findElement(By.className("caption")).getText());
+        assertEquals("Client to server: websocket, server to client: websocket",
+                row.findElement(By.className("value")).getText());
+    }
+
+    protected Stream<String> getParameters() {
+        return Stream.concat(super.getParameters(), Stream.of("debug"))
+                .distinct();
+    }
 }