tests-e2e: Fixed tests

v2compatibility
Carlos Santos 2024-12-26 12:24:05 +01:00
parent e00a5ae3ca
commit 14682345ed
2 changed files with 14 additions and 8 deletions

View File

@ -314,7 +314,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
CustomWebhook.waitForEvent("participantLeft", 2).get("reason").getAsString()); CustomWebhook.waitForEvent("participantLeft", 2).get("reason").getAsString());
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
Assertions.assertEquals("recordingStoppedByServer", // reason is always "recordingStoppedByServer" in v2Compatibility Assertions.assertEquals("recordingStoppedByServer", // reason is always "recordingStoppedByServer" in v2Compatibility
CustomWebhook.waitForEvent("recordingStatusChanged", 2).get("reason").getAsString()); CustomWebhook.waitForEvent("recordingStatusChanged", 60).get("reason").getAsString());
} }
// broadcastStopped does not exist in the official OpenVidu docs and v2Compatibility does not trigger it // broadcastStopped does not exist in the official OpenVidu docs and v2Compatibility does not trigger it
// Assertions.assertEquals("lastParticipantLeft", // Assertions.assertEquals("lastParticipantLeft",
@ -342,6 +342,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
.filter(con -> con.getAsJsonObject().get("role").getAsString().equals("PUBLISHER")).findFirst() .filter(con -> con.getAsJsonObject().get("role").getAsString().equals("PUBLISHER")).findFirst()
.get().getAsJsonObject().get("publishers").getAsJsonArray().get(0).getAsJsonObject() .get().getAsJsonObject().get("publishers").getAsJsonArray().get(0).getAsJsonObject()
.get("streamId").getAsString(); .get("streamId").getAsString();
restClient.rest(HttpMethod.DELETE, "/openvidu/api/sessions/TestSession/stream/" + streamId, restClient.rest(HttpMethod.DELETE, "/openvidu/api/sessions/TestSession/stream/" + streamId,
HttpURLConnection.HTTP_NO_CONTENT); HttpURLConnection.HTTP_NO_CONTENT);
// webrtcConnectionDestroyed event is only triggered when participant left in v2Compatibility // webrtcConnectionDestroyed event is only triggered when participant left in v2Compatibility
@ -380,7 +381,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// webrtcConnectionDestroyed event is only triggered when participant left in v2Compatibility // webrtcConnectionDestroyed event is only triggered when participant left in v2Compatibility
// for (int i = 0; i < 3; i++) { // for (int i = 0; i < 3; i++) {
Assertions.assertEquals("unpublish", // reason is always "unpublish" in v2Compatibility Assertions.assertEquals("unpublish", // reason is always "unpublish" in v2Compatibility
CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 2).get("reason").getAsString()); CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 60).get("reason").getAsString());
// } // }
Assertions.assertEquals("disconnect", // reason is always "disconnect" in v2Compatibility Assertions.assertEquals("disconnect", // reason is always "disconnect" in v2Compatibility
CustomWebhook.waitForEvent("participantLeft", 2).get("reason").getAsString()); CustomWebhook.waitForEvent("participantLeft", 2).get("reason").getAsString());
@ -3365,7 +3366,7 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
commandLine.executeCommand("docker cp broadcast-nginx:/tmp " + broadcastRecordingPath, 3); commandLine.executeCommand("docker cp broadcast-nginx:/tmp " + broadcastRecordingPath, 3);
// Analyze most recent file (there can be more than one in the path) // Analyze most recent file (there can be more than one in the path)
File[] files = new File(broadcastRecordingPath + "/tmp").listFiles(); File[] files = new File(broadcastRecordingPath + "/tmp").listFiles();
if(files == null || files.length == 0) { if (files == null || files.length == 0) {
log.info("RTMP screenshot could not be generated yet. Trying again"); log.info("RTMP screenshot could not be generated yet. Trying again");
Thread.sleep(1000); Thread.sleep(1000);
continue; continue;
@ -3385,8 +3386,9 @@ public class OpenViduProTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
File screenshot = new File(broadcastRecordingPath + "/tmp/rtmp-screenshot.jpg"); File screenshot = new File(broadcastRecordingPath + "/tmp/rtmp-screenshot.jpg");
if (screenshot.exists() && screenshot.isFile() && screenshot.length() > 0 && screenshot.canRead()) { if (screenshot.exists() && screenshot.isFile() && screenshot.length() > 0 && screenshot.canRead()) {
// The check logic is not working properly // The check logic is not working properly
// Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(screenshot, colorCheckFunction), // Assertions.assertTrue(this.recordingUtils.thumbnailIsFine(screenshot,
// "RTMP screenshot " + screenshot.getAbsolutePath() + " is not fine"); // colorCheckFunction),
// "RTMP screenshot " + screenshot.getAbsolutePath() + " is not fine");
break; break;
} }
log.info("RTMP screenshot could not be generated yet. Trying again"); log.info("RTMP screenshot could not be generated yet. Trying again");

View File

@ -1718,6 +1718,8 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
@Test @Test
@DisplayName("Record cross-browser audio-only and video-only") @DisplayName("Record cross-browser audio-only and video-only")
void audioOnlyVideoOnlyRecordTest() throws Exception { void audioOnlyVideoOnlyRecordTest() throws Exception {
Thread.sleep(4000);
isRecordingTest = true; isRecordingTest = true;
OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chromeAlternateScreenShare"); OpenViduTestappUser user = setupBrowserAndConnectToOpenViduTestapp("chromeAlternateScreenShare");
@ -1909,7 +1911,9 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// Check audio-only INDIVIDUAL recording // Check audio-only INDIVIDUAL recording
recPath = recordingsPath + SESSION_NAME + "~2/"; recPath = recordingsPath + SESSION_NAME + "~2/";
recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME + "~2"); recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME + "~2");
this.recordingUtils.checkIndividualRecording(recPath, recording, 2, "opus",null, true); // As the recording is audio only and there is only one participant publishing its audio
// The zip file only has 1 file (audio file)
this.recordingUtils.checkIndividualRecording(recPath, recording, 1, "opus",null, true);
user.getDriver().findElement(By.id("close-dialog-btn")).click(); user.getDriver().findElement(By.id("close-dialog-btn")).click();
Thread.sleep(500); Thread.sleep(500);
@ -3822,7 +3826,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// server requires additional time after stopping a recording before it can be deleted, // server requires additional time after stopping a recording before it can be deleted,
// causing the beforeEach logic to be bypassed. // causing the beforeEach logic to be bypassed.
// To ensure stability, we add a delay and perform manual cleanup: // To ensure stability, we add a delay and perform manual cleanup:
Thread.sleep(2000); Thread.sleep(5000);
this.closeAllSessions(OV); this.closeAllSessions(OV);
this.deleteAllRecordings(OV); this.deleteAllRecordings(OV);
CustomWebhook.clean(); CustomWebhook.clean();
@ -3962,7 +3966,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
// CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 2); // CustomWebhook.waitForEvent("webrtcConnectionDestroyed", 2);
CustomWebhook.waitForEvent("participantLeft", 2); CustomWebhook.waitForEvent("participantLeft", 2);
CustomWebhook.waitForEvent("participantLeft", 2); CustomWebhook.waitForEvent("participantLeft", 2);
event = CustomWebhook.waitForEvent("recordingStatusChanged", 2); event = CustomWebhook.waitForEvent("recordingStatusChanged", 60);
OV.fetch(); OV.fetch();
List<Recording> recs = OV.listRecordings(); List<Recording> recs = OV.listRecordings();