2 * Copyright 2000-2018 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.integration.websocket;
18 import static org.junit.Assert.assertEquals;
20 import java.util.HashSet;
22 import java.util.stream.Stream;
24 import org.junit.Assume;
25 import org.junit.Test;
26 import org.openqa.selenium.WebElement;
28 import com.vaadin.testbench.By;
29 import com.vaadin.tests.integration.AbstractServletIntegrationTest;
31 public class ServletIntegrationWebsocketIT
32 extends AbstractServletIntegrationTest {
33 // Uses the test method declared in the super class
35 private static final Set<String> nonWebsocketServers = new HashSet<>();
38 nonWebsocketServers.add("liberty-microprofile");
42 public void setup() throws Exception {
43 Assume.assumeFalse("This server does not support Websockets",
45 .contains(System.getProperty("server-name")));
51 protected String getTestPath() {
52 return "/run/ServletIntegrationWebsocketUI";
56 public void testWebsockedUsed() {
57 // Reopen the page with debug window
59 Stream.concat(getParameters(), Stream.of("debug")).distinct());
61 // Make sure the correct debug window tab is open.
62 findElements(By.className("v-debugwindow-tab")).get(1).click();
65 // Wait to make sure correct tab is shown.
67 } catch (InterruptedException e) {
70 WebElement row = findElements(By.className("v-debugwindow-row")).get(7);
71 assertEquals("Communication method",
72 row.findElement(By.className("caption")).getText());
73 assertEquals("Client to server: websocket, server to client: websocket",
74 row.findElement(By.className("value")).getText());