From c1149079c85ef989006fb76cafda8495e5be4faf Mon Sep 17 00:00:00 2001 From: cruizba Date: Mon, 9 Dec 2024 18:15:32 +0100 Subject: [PATCH] e2e-tests: Fix composed quick start test --- .../test/e2e/OpenViduTestAppE2eTest.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java index 73e7a5ede3..f855bb5587 100644 --- a/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java +++ b/openvidu-test-e2e/src/test/java/io/openvidu/test/e2e/OpenViduTestAppE2eTest.java @@ -1533,11 +1533,19 @@ void composedQuickStartRecordTest() throws Exception { event = CustomWebhook.waitForEvent("recordingStatusChanged", 5); // started Assertions.assertEquals("started", event.get("status").getAsString(), "Wrong status in recordingStatusChanged event"); - event = CustomWebhook.waitForEvent("recordingStatusChanged", 10); // failed - Assertions.assertEquals("failed", event.get("status").getAsString(), - "Wrong status in recordingStatusChanged event"); - Assertions.assertEquals(Recording.Status.failed, OV.getRecording(sessionName + "~2").getStatus(), - "Wrong recording status"); + try { + // Wait first for a failed event + event = CustomWebhook.waitForEvent("recordingStatusChanged", 10); // failed + Assertions.assertEquals("failed", event.get("status").getAsString(), + "Wrong status in recordingStatusChanged event"); + Assertions.assertEquals(Recording.Status.failed, OV.getRecording(sessionName + "~2").getStatus(), + "Wrong recording status"); + } catch (Exception e) { + // If the failed event is not received, it's because the session has been destroyed + // before the recording started + // Check for sessionDestroyed event + event = CustomWebhook.waitForEvent("sessionDestroyed", 5); + } } else { // Recording did have time to start. Should trigger started, stopped, ready event = CustomWebhook.waitForEvent("recordingStatusChanged", 5); // started