From: Teemu Suo-Anttila Date: Wed, 2 May 2018 12:28:57 +0000 (+0300) Subject: Add test to verify proper init of websockets (#10865) X-Git-Tag: 8.5.0.alpha1~17 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d59b821bc74569f962f93c9026e3c0088ee4b9e9;p=vaadin-framework.git Add test to verify proper init of websockets (#10865) --- diff --git a/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java b/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java index d1aa26e351..3a722768e4 100644 --- a/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java +++ b/test/servlet-containers/generic-tests/src/main/java/com/vaadin/tests/integration/websocket/ServletIntegrationWebsocketIT.java @@ -15,6 +15,14 @@ */ 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 getParameters() { + return Stream.concat(super.getParameters(), Stream.of("debug")) + .distinct(); + } }