mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: more time for events in wehookTest
parent
90b075cc7f
commit
5cfdd5d039
|
@ -23,6 +23,7 @@ import java.util.concurrent.ConcurrentMap;
|
|||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
|
@ -63,13 +64,13 @@ public class CustomWebhook {
|
|||
CustomWebhook.events.clear();
|
||||
}
|
||||
|
||||
public synchronized static JsonObject waitForEvent(String eventName, int maxSecondsWait) throws Exception {
|
||||
public synchronized static JsonObject waitForEvent(String eventName, int maxSecondsWait) throws TimeoutException, InterruptedException {
|
||||
if (events.get(eventName) == null) {
|
||||
events.put(eventName, new LinkedBlockingDeque<>());
|
||||
}
|
||||
JsonObject event = CustomWebhook.events.get(eventName).poll(maxSecondsWait, TimeUnit.SECONDS);
|
||||
if (event == null) {
|
||||
throw new Exception("Timeout waiting for Webhook " + eventName);
|
||||
throw new TimeoutException("Timeout waiting for Webhook " + eventName);
|
||||
} else {
|
||||
return event;
|
||||
}
|
||||
|
|
|
@ -3790,9 +3790,9 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
user.getDriver().findElement(By.cssSelector("#openvidu-instance-1 .join-btn")).click();
|
||||
|
||||
event = CustomWebhook.waitForEvent("participantJoined", 2);
|
||||
CustomWebhook.waitForEvent("webrtcConnectionCreated", 2);
|
||||
CustomWebhook.waitForEvent("webrtcConnectionCreated", 2);
|
||||
CustomWebhook.waitForEvent("webrtcConnectionCreated", 2);
|
||||
CustomWebhook.waitForEvent("webrtcConnectionCreated", 5);
|
||||
CustomWebhook.waitForEvent("webrtcConnectionCreated", 5);
|
||||
CustomWebhook.waitForEvent("webrtcConnectionCreated", 5);
|
||||
|
||||
String connectionId2 = event.get("connectionId").getAsString();
|
||||
|
||||
|
@ -3888,6 +3888,11 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
|||
Assert.assertEquals("Wrong session destroyed reason in webhook event", "sessionClosedByServer",
|
||||
event.get("reason").getAsString());
|
||||
|
||||
} catch (TimeoutException e) {
|
||||
log.error("Timeout: {}", e.getMessage());
|
||||
e.printStackTrace();
|
||||
System.out.println(getBase64Screenshot(user.getBrowserUser()));
|
||||
Assert.fail(e.getMessage());
|
||||
} finally {
|
||||
CustomWebhook.shutDown();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue