mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: fix Pro e2e tests
parent
5e5d886e59
commit
dfa12ffbb8
|
@ -28,7 +28,7 @@ public class MyUser {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
this.eventManager.stopPolling(true);
|
this.eventManager.stopPolling(true, true);
|
||||||
this.browserUser.dispose();
|
this.browserUser.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class OpenViduEventManager {
|
||||||
public void uncaughtException(Thread th, Throwable ex) {
|
public void uncaughtException(Thread th, Throwable ex) {
|
||||||
if (ex.getClass().getSimpleName().equals("UnhandledAlertException")
|
if (ex.getClass().getSimpleName().equals("UnhandledAlertException")
|
||||||
&& ex.getMessage().contains("unexpected alert open")) {
|
&& ex.getMessage().contains("unexpected alert open")) {
|
||||||
stopPolling(false);
|
stopPolling(false, false);
|
||||||
System.err
|
System.err
|
||||||
.println("Alert opened (" + ex.getMessage() + "). Waiting 1 second and restarting polling");
|
.println("Alert opened (" + ex.getMessage() + "). Waiting 1 second and restarting polling");
|
||||||
try {
|
try {
|
||||||
|
@ -138,14 +138,16 @@ public class OpenViduEventManager {
|
||||||
this.pollingThread.start();
|
this.pollingThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopPolling(boolean stopThread) {
|
public void stopPolling(boolean stopThread, boolean cleanExistingEvents) {
|
||||||
if (stopThread) {
|
if (stopThread) {
|
||||||
this.isInterrupted.set(true);
|
this.isInterrupted.set(true);
|
||||||
this.pollingThread.interrupt();
|
this.pollingThread.interrupt();
|
||||||
}
|
}
|
||||||
this.eventCallbacks.clear();
|
if (cleanExistingEvents) {
|
||||||
this.eventCountdowns.clear();
|
this.eventCallbacks.clear();
|
||||||
this.eventNumbers.clear();
|
this.eventCountdowns.clear();
|
||||||
|
this.eventNumbers.clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on(String eventName, Consumer<JsonObject> callback) {
|
public void on(String eventName, Consumer<JsonObject> callback) {
|
||||||
|
@ -195,12 +197,12 @@ public class OpenViduEventManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetEventThread() throws InterruptedException {
|
public void resetEventThread() throws InterruptedException {
|
||||||
this.stopPolling(true);
|
this.stopPolling(true, true);
|
||||||
this.pollingLatch.await();
|
this.pollingLatch.await();
|
||||||
this.execService.shutdownNow();
|
this.execService.shutdownNow();
|
||||||
this.execService.awaitTermination(10, TimeUnit.SECONDS);
|
this.execService.awaitTermination(10, TimeUnit.SECONDS);
|
||||||
this.execService = Executors.newCachedThreadPool();
|
this.execService = Executors.newCachedThreadPool();
|
||||||
this.stopPolling(false);
|
this.stopPolling(false, true);
|
||||||
this.clearAllCurrentEvents();
|
this.clearAllCurrentEvents();
|
||||||
this.isInterrupted.set(false);
|
this.isInterrupted.set(false);
|
||||||
this.pollingLatch = new CountDownLatch(1);
|
this.pollingLatch = new CountDownLatch(1);
|
||||||
|
|
|
@ -38,6 +38,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
||||||
|
|
||||||
@BeforeAll()
|
@BeforeAll()
|
||||||
protected static void setupAll() {
|
protected static void setupAll() {
|
||||||
|
checkFfmpegInstallation();
|
||||||
loadEnvironmentVariables();
|
loadEnvironmentVariables();
|
||||||
setupBrowserDrivers();
|
setupBrowserDrivers();
|
||||||
cleanFoldersAndSetUpOpenViduJavaClient();
|
cleanFoldersAndSetUpOpenViduJavaClient();
|
||||||
|
@ -252,14 +253,6 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
||||||
|
|
||||||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).sendKeys(Keys.ENTER);
|
user.getDriver().findElement(By.cssSelector("#openvidu-instance-0 .join-btn")).sendKeys(Keys.ENTER);
|
||||||
|
|
||||||
user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
|
|
||||||
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
|
||||||
|
|
||||||
Assert.assertTrue("Session object should have changed", session.fetch());
|
|
||||||
connection = session.getActiveConnections().get(0);
|
|
||||||
Assert.assertEquals("Wrong role in Connection object", OpenViduRole.SUBSCRIBER, connection.getRole());
|
|
||||||
Assert.assertFalse("Wrong record in Connection object", connection.record());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
user.getWaiter().until(ExpectedConditions.alertIsPresent());
|
user.getWaiter().until(ExpectedConditions.alertIsPresent());
|
||||||
Alert alert = user.getDriver().switchTo().alert();
|
Alert alert = user.getDriver().switchTo().alert();
|
||||||
|
@ -271,6 +264,14 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
|
|
||||||
|
user.getEventManager().waitUntilEventReaches("connectionCreated", 1);
|
||||||
|
user.getEventManager().waitUntilEventReaches("accessAllowed", 1);
|
||||||
|
|
||||||
|
Assert.assertTrue("Session object should have changed", session.fetch());
|
||||||
|
connection = session.getActiveConnections().get(0);
|
||||||
|
Assert.assertEquals("Wrong role in Connection object", OpenViduRole.SUBSCRIBER, connection.getRole());
|
||||||
|
Assert.assertFalse("Wrong record in Connection object", connection.record());
|
||||||
|
|
||||||
/** UPDATE CONNECTION **/
|
/** UPDATE CONNECTION **/
|
||||||
|
|
||||||
// Test with REST API
|
// Test with REST API
|
||||||
|
|
Loading…
Reference in New Issue