openvidu-test-e2e extended to 7 scenarios. Active MediaTracks checked

pull/20/head
pabloFuente 2017-10-10 15:51:33 +02:00
parent 835050db6c
commit e2e32b18cd
11 changed files with 484 additions and 274 deletions

View File

@ -1,162 +0,0 @@
package io.openvidu.test.e2e;
/*
* (C) Copyright 2017-2019 OpenVideo (http://openvidu.io/)
*
* 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.
*
*/
import static java.lang.invoke.MethodHandles.lookup;
import static org.slf4j.LoggerFactory.getLogger;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.junit.platform.runner.JUnitPlatform;
import org.openqa.selenium.By;
import org.slf4j.Logger;
import io.github.bonigarcia.SeleniumExtension;
import io.openvidu.test.e2e.browser.ChromeUser;
import io.openvidu.test.e2e.browser.FirefoxUser;
/**
* E2E test for openvidu-testapp.
*
* @author Pablo Fuente (pablo.fuente@urjc.es)
* @since 1.1.1
*/
@Tag("e2e")
@DisplayName("E2E tests for OpenVidu TestApp")
@ExtendWith(SeleniumExtension.class)
@RunWith(JUnitPlatform.class)
public class OpenViduTestAppE2eTest {
final Logger log = getLogger(lookup().lookupClass());
final String DEFAULT_SESSION_NAME = "TestSession";
String testAppUrl = "http://localhost:4200/"; // default value (local)
@BeforeEach
void setup() {
}
@Test
@DisplayName("One2One [Video + Audio] session")
void oneToOneVideoAudioSession() throws InterruptedException {
FirefoxUser user = new FirefoxUser("TestUser", 10);
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and click on 1:1 scenario");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
user.getDriver().findElement(By.id("one2one-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 4);
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 1);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 2);
user.dispose();
}
@Test
@DisplayName("One2Many [Video + Audio] session")
void oneToManyVideoAudioSession() throws InterruptedException {
ChromeUser user = new ChromeUser("TestUser", 10);
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and click on 1:N scenario");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
user.getDriver().findElement(By.id("one2many-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 4);
user.getDriver().findElements(By.className(("leave-btn"))).get(0).click();
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 3);
user.dispose();
}
@Test
@DisplayName("Unique user remote subscription [Video + Audio]")
void oneRemoteSubscription() throws InterruptedException {
ChromeUser user = new ChromeUser("TestUser", 10);
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and join one user with remote subscription");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.className("subscribe-remote-check")).click();
user.getDriver().findElement(By.id("join-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 1);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("remoteVideoPlaying", 1);
user.getDriver().findElement(By.className(("leave-btn"))).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.dispose();
}
@Test
@DisplayName("Unique user remote subscription [ScreenShare + Audio]")
void oneRemoteSubscriptionScreen() throws InterruptedException {
ChromeUser user = new ChromeUser("TestUser", 10);
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and join one user with remote subscription");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.className("screen-radio")).click();
user.getDriver().findElement(By.className("subscribe-remote-check")).click();
user.getDriver().findElement(By.id("join-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 1);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("remoteVideoPlaying", 1);
user.getDriver().findElement(By.className(("leave-btn"))).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.dispose();
}
}

View File

@ -1,54 +0,0 @@
package io.openvidu.test.e2e.browser;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import io.openvidu.test.e2e.OpenViduEventManager;
public class BrowserUser {
protected WebDriver driver;
protected WebDriverWait waiter;
protected String clientData;
protected int timeOfWait;
protected OpenViduEventManager eventManager;
public BrowserUser(String clientData, int timeOfWait) {
this.clientData = clientData;
this.timeOfWait = timeOfWait;
}
public WebDriver getDriver() {
return this.driver;
}
public WebDriverWait getWaiter() {
return this.waiter;
}
public OpenViduEventManager getEventManager() {
return this.eventManager;
}
public String getClientData() {
return this.clientData;
}
protected void newWaiter(int timeOfWait) {
this.waiter = new WebDriverWait(this.driver, timeOfWait);
}
protected void configureDriver() {
this.waiter = new WebDriverWait(this.driver, this.timeOfWait);
this.driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
this.eventManager = new OpenViduEventManager(this.driver, this.waiter);
}
public void dispose() {
this.eventManager.stopPolling();
this.driver.quit();
}
}

View File

@ -1,3 +1,20 @@
/*
* (C) Copyright 2017 OpenVidu (http://openvidu.io/)
*
* 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 io.openvidu.test.e2e; package io.openvidu.test.e2e;
import java.util.Map; import java.util.Map;
@ -16,12 +33,22 @@ import java.util.function.Consumer;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException; import org.json.simple.parser.ParseException;
import org.junit.Assert;
import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
public class OpenViduEventManager {
/**
* Manager event class for BrowserUser. Collects, cleans and stores
* events from openvidu-testapp
*
* @author Pablo Fuente (pablo.fuente@urjc.es)
* @since 1.1.1
*/
public class OpenViduEventManager {
private static class RunnableCallback implements Runnable { private static class RunnableCallback implements Runnable {
private final Consumer<JSONObject> callback; private final Consumer<JSONObject> callback;
@ -43,32 +70,40 @@ public class OpenViduEventManager {
private Thread pollingThread; private Thread pollingThread;
private ExecutorService execService = Executors.newCachedThreadPool(); private ExecutorService execService = Executors.newCachedThreadPool();
private final int LATCH_TIMEOUT = 10000;
private WebDriver driver; private WebDriver driver;
private WebDriverWait waiter;
private Queue<JSONObject> eventQueue; private Queue<JSONObject> eventQueue;
private Map<String, RunnableCallback> eventCallbacks; private Map<String, RunnableCallback> eventCallbacks;
private Map<String, AtomicInteger> eventNumbers; private Map<String, AtomicInteger> eventNumbers;
private Map<String, CountDownLatch> eventCountdowns; private Map<String, CountDownLatch> eventCountdowns;
private AtomicBoolean isInterrupted = new AtomicBoolean(false); private AtomicBoolean isInterrupted = new AtomicBoolean(false);
private int timeOfWaitInSeconds;
public OpenViduEventManager(WebDriver driver, WebDriverWait waiter) { public OpenViduEventManager(WebDriver driver, WebDriverWait waiter, int timeOfWaitInSeconds) {
this.driver = driver; this.driver = driver;
this.waiter = waiter;
this.eventQueue = new ConcurrentLinkedQueue<JSONObject>(); this.eventQueue = new ConcurrentLinkedQueue<JSONObject>();
this.eventCallbacks = new ConcurrentHashMap<>(); this.eventCallbacks = new ConcurrentHashMap<>();
this.eventNumbers = new ConcurrentHashMap<>(); this.eventNumbers = new ConcurrentHashMap<>();
this.eventCountdowns = new ConcurrentHashMap<>(); this.eventCountdowns = new ConcurrentHashMap<>();
this.timeOfWaitInSeconds = timeOfWaitInSeconds;
} }
public void startPolling() { public void startPolling() {
Thread.UncaughtExceptionHandler h = new Thread.UncaughtExceptionHandler() {
public void uncaughtException(Thread th, Throwable ex) {
if (ex.getClass().getSimpleName().equals("NoSuchSessionException")) {
System.err.println("Disposing driver when running 'executeScript'");
}
}
};
this.pollingThread = new Thread(() -> { this.pollingThread = new Thread(() -> {
while (!this.isInterrupted.get()) { while (!this.isInterrupted.get()) {
this.getEventsFromBrowser(); this.getEventsFromBrowser();
this.emitEvents(); this.emitEvents();
} }
}); });
this.pollingThread.setUncaughtExceptionHandler(h);
this.pollingThread.start(); this.pollingThread.start();
} }
@ -88,7 +123,7 @@ public class OpenViduEventManager {
CountDownLatch eventSignal = new CountDownLatch(eventNumber); CountDownLatch eventSignal = new CountDownLatch(eventNumber);
this.setCountDown(eventName, eventSignal); this.setCountDown(eventName, eventSignal);
try { try {
if (!eventSignal.await(LATCH_TIMEOUT, TimeUnit.MILLISECONDS)) { if (!eventSignal.await(this.timeOfWaitInSeconds*1000, TimeUnit.MILLISECONDS)) {
throw(new TimeoutException()); throw(new TimeoutException());
} }
} catch (InterruptedException | TimeoutException e) { } catch (InterruptedException | TimeoutException e) {
@ -152,5 +187,26 @@ public class OpenViduEventManager {
.executeScript("var e = window.myEvents; window.myEvents = ''; return e;"); .executeScript("var e = window.myEvents; window.myEvents = ''; return e;");
return events; return events;
} }
public boolean assertMediaTracks(Iterable<WebElement> videoElements, boolean audioTransmission, boolean videoTransmission) {
boolean success = true;
for (WebElement video : videoElements) {
success = success && (audioTransmission == this.hasAudioTracks(video)) && (videoTransmission == this.hasVideoTracks(video));
if (!success) break;
}
return success;
}
public boolean hasAudioTracks(WebElement videoElement) {
long numberAudioTracks = (long) ((JavascriptExecutor) driver)
.executeScript("return $('#" + videoElement.getAttribute("id") + "').prop('srcObject').getAudioTracks().length;");
return (numberAudioTracks > 0);
}
public boolean hasVideoTracks(WebElement videoElement) {
long numberAudioTracks = (long) ((JavascriptExecutor) driver)
.executeScript("return $('#" + videoElement.getAttribute("id") + "').prop('srcObject').getVideoTracks().length;");
return (numberAudioTracks > 0);
}
} }

View File

@ -0,0 +1,295 @@
/*
* (C) Copyright 2017 OpenVidu (http://openvidu.io/)
*
* 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 io.openvidu.test.e2e;
import static java.lang.invoke.MethodHandles.lookup;
import static org.slf4j.LoggerFactory.getLogger;
import java.util.List;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.runner.RunWith;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import io.github.bonigarcia.SeleniumExtension;
import io.openvidu.test.e2e.browser.BrowserUser;
import io.openvidu.test.e2e.browser.ChromeUser;
import io.openvidu.test.e2e.browser.FirefoxUser;
/**
* E2E tests for openvidu-testapp.
*
* @author Pablo Fuente (pablo.fuente@urjc.es)
* @since 1.1.1
*/
@Tag("e2e")
@DisplayName("E2E tests for OpenVidu TestApp")
@ExtendWith(SeleniumExtension.class)
@RunWith(JUnitPlatform.class)
public class OpenViduTestAppE2eTest {
final Logger log = getLogger(lookup().lookupClass());
final String DEFAULT_SESSION_NAME = "TestSession";
String testAppUrl = "http://localhost:4200/"; // default value (local)
BrowserUser user;
@BeforeEach
void setup() {
this.user = new FirefoxUser("TestUser", 30);
}
@Test
@DisplayName("One2One [Video + Audio]")
void oneToOneVideoAudioSession() throws InterruptedException {
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and click on 1:1 scenario");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
user.getDriver().findElement(By.id("one2one-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 4);
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 1);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 2);
user.dispose();
}
@Test
@DisplayName("One2One [Audio]")
void oneToOneAudioSession() throws InterruptedException {
user.getEventManager().startPolling();
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("one2one-btn")).click();
List<WebElement> l1 = user.getDriver().findElements(By.className("send-video-checkbox"));
for (WebElement el : l1) {
el.click();
}
List<WebElement> l2 = user.getDriver().findElements(By.className("join-btn"));
for (WebElement el : l2) {
el.click();
}
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 4);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 2);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 4);
user.getEventManager().waitUntilNumberOfEvent("streamCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 4);
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, false));
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 1);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 2);
user.dispose();
}
@Test
@DisplayName("One2One [Video]")
void oneToOneVideoSession() throws InterruptedException {
user.getEventManager().startPolling();
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("one2one-btn")).click();
List<WebElement> l1 = user.getDriver().findElements(By.className("send-audio-checkbox"));
for (WebElement el : l1) {
el.click();
}
List<WebElement> l2 = user.getDriver().findElements(By.className("join-btn"));
for (WebElement el : l2) {
el.click();
}
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 4);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 2);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 4);
user.getEventManager().waitUntilNumberOfEvent("streamCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 4);
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), false, true));
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 1);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.getDriver().findElement(By.id("remove-user-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 2);
user.dispose();
}
@Test
@DisplayName("One2Many [Video + Audio]")
void oneToManyVideoAudioSession() throws InterruptedException {
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and click on 1:N scenario");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("auto-join-checkbox")).click();
user.getDriver().findElement(By.id("one2many-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 4);
user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true);
user.getDriver().findElements(By.className(("leave-btn"))).get(0).click();
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 3);
user.dispose();
}
@Test
@DisplayName("Unique user remote subscription [Video + Audio]")
void oneRemoteSubscription() throws InterruptedException {
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and join one user with remote subscription");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.className("subscribe-remote-check")).click();
user.getDriver().findElement(By.className("join-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 1);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("remoteVideoPlaying", 1);
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
user.getDriver().findElement(By.className(("leave-btn"))).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.dispose();
}
@Test
@DisplayName("Unique user remote subscription [ScreenShare + Audio]")
void oneRemoteSubscriptionScreen() throws InterruptedException {
user.getEventManager().startPolling();
log.debug("Navigate to openvidu-testapp and join one user with remote subscription");
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.className("screen-radio")).click();
user.getDriver().findElement(By.className("subscribe-remote-check")).click();
user.getDriver().findElement(By.className("join-btn")).click();
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 1);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 1);
user.getEventManager().waitUntilNumberOfEvent("remoteVideoPlaying", 1);
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
user.getDriver().findElement(By.className(("leave-btn"))).click();
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.dispose();
}
@Test
@DisplayName("Many2Many [Video + Audio]")
void manyToManyVideoAudioSession() throws InterruptedException {
user.getEventManager().startPolling();
user.getDriver().get(testAppUrl);
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.id("add-user-btn")).click();
user.getDriver().findElement(By.id("add-user-btn")).click();
List<WebElement> l = user.getDriver().findElements(By.className("join-btn"));
for (WebElement el : l) {
el.sendKeys(Keys.ENTER);
}
user.getEventManager().waitUntilNumberOfEvent("connectionCreated", 16);
user.getEventManager().waitUntilNumberOfEvent("accessAllowed", 4);
user.getEventManager().waitUntilNumberOfEvent("videoElementCreated", 16);
user.getEventManager().waitUntilNumberOfEvent("streamCreated", 6);
user.getEventManager().waitUntilNumberOfEvent("videoPlaying", 16);
Assert.assertTrue(user.getEventManager().assertMediaTracks(user.getDriver().findElements(By.tagName("video")), true, true));
user.getDriver().findElement(By.id(("remove-user-btn"))).sendKeys(Keys.ENTER);
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 3);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 1);
user.getDriver().findElement(By.id(("remove-user-btn"))).sendKeys(Keys.ENTER);
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 4);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 2);
user.getDriver().findElement(By.id(("remove-user-btn"))).sendKeys(Keys.ENTER);
user.getEventManager().waitUntilNumberOfEvent("streamDestroyed", 5);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 3);
user.getDriver().findElement(By.id(("remove-user-btn"))).sendKeys(Keys.ENTER);
user.getEventManager().waitUntilNumberOfEvent("sessionDisconnected", 4);
user.dispose();
}
}

View File

@ -0,0 +1,72 @@
/*
* (C) Copyright 2017 OpenVidu (http://openvidu.io/)
*
* 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 io.openvidu.test.e2e.browser;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import io.openvidu.test.e2e.OpenViduEventManager;
public class BrowserUser {
protected WebDriver driver;
protected WebDriverWait waiter;
protected String clientData;
protected int timeOfWaitInSeconds;
protected OpenViduEventManager eventManager;
public BrowserUser(String clientData, int timeOfWaitInSeconds) {
this.clientData = clientData;
this.timeOfWaitInSeconds = timeOfWaitInSeconds;
}
public WebDriver getDriver() {
return this.driver;
}
public WebDriverWait getWaiter() {
return this.waiter;
}
public OpenViduEventManager getEventManager() {
return this.eventManager;
}
public String getClientData() {
return this.clientData;
}
public int getTimeOfWait() {
return this.timeOfWaitInSeconds;
}
protected void newWaiter(int timeOfWait) {
this.waiter = new WebDriverWait(this.driver, timeOfWait);
}
protected void configureDriver() {
this.waiter = new WebDriverWait(this.driver, this.timeOfWaitInSeconds);
this.eventManager = new OpenViduEventManager(this.driver, this.waiter, this.timeOfWaitInSeconds);
}
public void dispose() {
this.eventManager.stopPolling();
this.driver.quit();
}
}

View File

@ -1,3 +1,20 @@
/*
* (C) Copyright 2017 OpenVidu (http://openvidu.io/)
*
* 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 io.openvidu.test.e2e.browser; package io.openvidu.test.e2e.browser;
import java.io.IOException; import java.io.IOException;
@ -8,8 +25,8 @@ import org.springframework.core.io.ClassPathResource;
public class ChromeUser extends BrowserUser { public class ChromeUser extends BrowserUser {
public ChromeUser(String userName, int timeOfWait) { public ChromeUser(String userName, int timeOfWaitInSeconds) {
super(userName, timeOfWait); super(userName, timeOfWaitInSeconds);
System.setProperty("webdriver.chrome.driver", "/home/chromedriver"); System.setProperty("webdriver.chrome.driver", "/home/chromedriver");
@ -29,7 +46,7 @@ public class ChromeUser extends BrowserUser {
} }
this.driver = new ChromeDriver(options); this.driver = new ChromeDriver(options);
this.driver.manage().timeouts().setScriptTimeout(5, TimeUnit.SECONDS); this.driver.manage().timeouts().setScriptTimeout(this.timeOfWaitInSeconds, TimeUnit.SECONDS);
this.configureDriver(); this.configureDriver();
} }

View File

@ -1,3 +1,20 @@
/*
* (C) Copyright 2017 OpenVidu (http://openvidu.io/)
*
* 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 io.openvidu.test.e2e.browser; package io.openvidu.test.e2e.browser;
import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxDriver;
@ -6,8 +23,8 @@ import org.openqa.selenium.remote.DesiredCapabilities;
public class FirefoxUser extends BrowserUser { public class FirefoxUser extends BrowserUser {
public FirefoxUser(String userName, int timeOfWait) { public FirefoxUser(String userName, int timeOfWaitInSeconds) {
super(userName, timeOfWait); super(userName, timeOfWaitInSeconds);
System.setProperty("webdriver.gecko.driver", "/home/geckodriver"); System.setProperty("webdriver.gecko.driver", "/home/geckodriver");

View File

@ -1,38 +0,0 @@
package io.openvidu.test.e2e.tes;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}

View File

@ -17,9 +17,9 @@
</div> </div>
<div> <div>
<button id="join-btn" md-button (click)="joinSession()" [disabled]="session">JOIN</button> <button class="join-btn" md-button (click)="joinSession()" [disabled]="session">JOIN</button>
<md-checkbox name="subscribeTo" (change)="toggleSubscribeTo()" [checked]="subscribeTo && checkSubscribeTo" [disabled]="session">Subscribe</md-checkbox> <md-checkbox class="subscribe-checkbox" name="subscribeTo" (change)="toggleSubscribeTo()" [checked]="subscribeTo && checkSubscribeTo" [disabled]="session">Subscribe</md-checkbox>
<md-checkbox name="publishTo" (change)="togglePublishTo()" [checked]="publishTo && checkPublishTo" [disabled]="session || disablePublishTo">Publish</md-checkbox> <md-checkbox class="publish-checkbox" name="publishTo" (change)="togglePublishTo()" [checked]="publishTo && checkPublishTo" [disabled]="session || disablePublishTo">Publish</md-checkbox>
</div> </div>
<div class="inner-card" fxLayout="row" fxLayoutAlign="start start"> <div class="inner-card" fxLayout="row" fxLayoutAlign="start start">
@ -28,15 +28,15 @@
<div> <div>
<h4>Send</h4> <h4>Send</h4>
<div> <div>
<md-checkbox name="sendAudio" (change)="toggleSendAudio()" [checked]="sendAudio && checkSendAudio" [disabled]="session || disableSendAudio">Audio</md-checkbox> <md-checkbox class="send-audio-checkbox" name="sendAudio" (change)="toggleSendAudio()" [checked]="sendAudio && checkSendAudio" [disabled]="session || disableSendAudio">Audio</md-checkbox>
<md-checkbox name="sendVideo" (change)="toggleSendVideo()" [checked]="sendVideo && checkSendVideo" [disabled]="session || disableSendVideo">Video</md-checkbox> <md-checkbox class="send-video-checkbox" name="sendVideo" (change)="toggleSendVideo()" [checked]="sendVideo && checkSendVideo" [disabled]="session || disableSendVideo">Video</md-checkbox>
</div> </div>
</div> </div>
<div style="padding-top: 5px;"> <div style="padding-top: 5px;">
<h4>Enter active</h4> <h4>Enter active</h4>
<div> <div>
<md-checkbox name="activeAudio" (change)="toggleActiveAudio()" [checked]="activeAudio && checkActiveAudio" [disabled]="session || disableActiveAudio">Audio</md-checkbox> <md-checkbox class="active-audio-checkbox" name="activeAudio" (change)="toggleActiveAudio()" [checked]="activeAudio && checkActiveAudio" [disabled]="session || disableActiveAudio">Audio</md-checkbox>
<md-checkbox name="activeVideo" (change)="toggleActiveVideo()" [checked]="activeVideo && checkActiveVideo" [disabled]="session || disableActiveVideo">Video</md-checkbox> <md-checkbox class="active-video-checkbox" name="activeVideo" (change)="toggleActiveVideo()" [checked]="activeVideo && checkActiveVideo" [disabled]="session || disableActiveVideo">Video</md-checkbox>
</div> </div>
</div> </div>
</div> </div>

View File

@ -14,7 +14,7 @@
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g=" <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script> <script type="text/javascript">
window.myEvents = ''; window.myEvents = '';
</script> </script>

View File

@ -58,7 +58,7 @@
<openvidu.scm.url>https://github.com/OpenVidu/openvidu</openvidu.scm.url> <openvidu.scm.url>https://github.com/OpenVidu/openvidu</openvidu.scm.url>
<openvidu.scm.connection>git@github.com:OpenVidu/openvidu.git</openvidu.scm.connection> <openvidu.scm.connection>git@github.com:OpenVidu/openvidu.git</openvidu.scm.connection>
</properties> </properties>
<distributionManagement> <distributionManagement>
<snapshotRepository> <snapshotRepository>
<id>ossrh</id> <id>ossrh</id>
@ -80,6 +80,7 @@
<module>openvidu-server</module> <module>openvidu-server</module>
<module>openvidu-client</module> <module>openvidu-client</module>
<module>openvidu-test</module> <module>openvidu-test</module>
<module>openvidu-test-e2e</module>
<module>openvidu-java-client</module> <module>openvidu-java-client</module>
</modules> </modules>
</profile> </profile>
@ -89,6 +90,7 @@
<module>openvidu-server</module> <module>openvidu-server</module>
<module>openvidu-client</module> <module>openvidu-client</module>
<module>openvidu-test</module> <module>openvidu-test</module>
<module>openvidu-test-e2e</module>
</modules> </modules>
</profile> </profile>
<profile> <profile>
@ -201,6 +203,11 @@
<artifactId>openvidu-test</artifactId> <artifactId>openvidu-test</artifactId>
<version>${version.openvidu}</version> <version>${version.openvidu}</version>
</dependency> </dependency>
<dependency>
<groupId>io.openvidu</groupId>
<artifactId>openvidu-test-e2e</artifactId>
<version>${version.openvidu}</version>
</dependency>
<dependency> <dependency>
<groupId>io.openvidu</groupId> <groupId>io.openvidu</groupId>
<artifactId>openvidu-java-client</artifactId> <artifactId>openvidu-java-client</artifactId>