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() {
|
||||
this.eventManager.stopPolling(true);
|
||||
this.eventManager.stopPolling(true, true);
|
||||
this.browserUser.dispose();
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ public class OpenViduEventManager {
|
|||
public void uncaughtException(Thread th, Throwable ex) {
|
||||
if (ex.getClass().getSimpleName().equals("UnhandledAlertException")
|
||||
&& ex.getMessage().contains("unexpected alert open")) {
|
||||
stopPolling(false);
|
||||
stopPolling(false, false);
|
||||
System.err
|
||||
.println("Alert opened (" + ex.getMessage() + "). Waiting 1 second and restarting polling");
|
||||
try {
|
||||
|
@ -138,15 +138,17 @@ public class OpenViduEventManager {
|
|||
this.pollingThread.start();
|
||||
}
|
||||
|
||||
public void stopPolling(boolean stopThread) {
|
||||
public void stopPolling(boolean stopThread, boolean cleanExistingEvents) {
|
||||
if (stopThread) {
|
||||
this.isInterrupted.set(true);
|
||||
this.pollingThread.interrupt();
|
||||
}
|
||||
if (cleanExistingEvents) {
|
||||
this.eventCallbacks.clear();
|
||||
this.eventCountdowns.clear();
|
||||
this.eventNumbers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void on(String eventName, Consumer<JsonObject> callback) {
|
||||
this.eventCallbacks.putIfAbsent(eventName, new HashSet<>());
|
||||
|
@ -195,12 +197,12 @@ public class OpenViduEventManager {
|
|||
}
|
||||
|
||||
public void resetEventThread() throws InterruptedException {
|
||||
this.stopPolling(true);
|
||||
this.stopPolling(true, true);
|
||||
this.pollingLatch.await();
|
||||
this.execService.shutdownNow();
|
||||
this.execService.awaitTermination(10, TimeUnit.SECONDS);
|
||||
this.execService = Executors.newCachedThreadPool();
|
||||
this.stopPolling(false);
|
||||
this.stopPolling(false, true);
|
||||
this.clearAllCurrentEvents();
|
||||
this.isInterrupted.set(false);
|
||||
this.pollingLatch = new CountDownLatch(1);
|
||||
|
|
|
@ -38,6 +38,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
|
||||
@BeforeAll()
|
||||
protected static void setupAll() {
|
||||
checkFfmpegInstallation();
|
||||
loadEnvironmentVariables();
|
||||
setupBrowserDrivers();
|
||||
cleanFoldersAndSetUpOpenViduJavaClient();
|
||||
|
@ -252,14 +253,6 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
|
||||
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 {
|
||||
user.getWaiter().until(ExpectedConditions.alertIsPresent());
|
||||
Alert alert = user.getDriver().switchTo().alert();
|
||||
|
@ -271,6 +264,14 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestAppE2eTest {
|
|||
}
|
||||
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 **/
|
||||
|
||||
// Test with REST API
|
||||
|
|
Loading…
Reference in New Issue