mirror of https://github.com/OpenVidu/openvidu.git
openvidu-test-e2e: close other users after each
parent
cf49bf8fff
commit
2f5cb2261a
|
@ -29,7 +29,9 @@ import java.math.RoundingMode;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -108,6 +110,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
private static final Logger log = LoggerFactory.getLogger(OpenViduTestAppE2eTest.class);
|
private static final Logger log = LoggerFactory.getLogger(OpenViduTestAppE2eTest.class);
|
||||||
|
|
||||||
BrowserUser user;
|
BrowserUser user;
|
||||||
|
Collection<BrowserUser> otherUsers = new ArrayList<>();
|
||||||
volatile static boolean isRecordingTest;
|
volatile static boolean isRecordingTest;
|
||||||
|
|
||||||
@BeforeAll()
|
@BeforeAll()
|
||||||
|
@ -200,6 +203,12 @@ public class OpenViduTestAppE2eTest {
|
||||||
@AfterEach
|
@AfterEach
|
||||||
void dispose() {
|
void dispose() {
|
||||||
user.dispose();
|
user.dispose();
|
||||||
|
Iterator<BrowserUser> it = otherUsers.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
BrowserUser other = it.next();
|
||||||
|
other.dispose();
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
if (isRecordingTest) {
|
if (isRecordingTest) {
|
||||||
try {
|
try {
|
||||||
FileUtils.cleanDirectory(new File("/opt/openvidu/recordings"));
|
FileUtils.cleanDirectory(new File("/opt/openvidu/recordings"));
|
||||||
|
@ -443,6 +452,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Thread t = new Thread(() -> {
|
Thread t = new Thread(() -> {
|
||||||
BrowserUser user2 = new FirefoxUser("TestUser", 30);
|
BrowserUser user2 = new FirefoxUser("TestUser", 30);
|
||||||
|
otherUsers.add(user2);
|
||||||
user2.getDriver().get(APP_URL);
|
user2.getDriver().get(APP_URL);
|
||||||
WebElement urlInput = user2.getDriver().findElement(By.id("openvidu-url"));
|
WebElement urlInput = user2.getDriver().findElement(By.id("openvidu-url"));
|
||||||
urlInput.clear();
|
urlInput.clear();
|
||||||
|
@ -1255,6 +1265,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
|
|
||||||
Thread t = new Thread(() -> {
|
Thread t = new Thread(() -> {
|
||||||
BrowserUser user2 = new FirefoxUser("FirefoxUser", 30);
|
BrowserUser user2 = new FirefoxUser("FirefoxUser", 30);
|
||||||
|
otherUsers.add(user2);
|
||||||
user2.getDriver().get(APP_URL);
|
user2.getDriver().get(APP_URL);
|
||||||
WebElement urlInput = user2.getDriver().findElement(By.id("openvidu-url"));
|
WebElement urlInput = user2.getDriver().findElement(By.id("openvidu-url"));
|
||||||
urlInput.clear();
|
urlInput.clear();
|
||||||
|
@ -1424,8 +1435,8 @@ public class OpenViduTestAppE2eTest {
|
||||||
// Check video-only COMPOSED recording
|
// Check video-only COMPOSED recording
|
||||||
String recPath = recordingsPath + SESSION_NAME + "/";
|
String recPath = recordingsPath + SESSION_NAME + "/";
|
||||||
Recording recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME);
|
Recording recording = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET).getRecording(SESSION_NAME);
|
||||||
this.checkMultimediaFile(new File(recPath + recording.getName() + ".mp4"), false, true,
|
this.checkMultimediaFile(new File(recPath + recording.getName() + ".mp4"), false, true, recording.getDuration(),
|
||||||
recording.getDuration(), recording.getResolution(), null, "h264");
|
recording.getResolution(), null, "h264");
|
||||||
|
|
||||||
// Check audio-only COMPOSED recording
|
// Check audio-only COMPOSED recording
|
||||||
recPath = recordingsPath + SESSION_NAME + "-1/";
|
recPath = recordingsPath + SESSION_NAME + "-1/";
|
||||||
|
@ -1864,8 +1875,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean recordedFileFine(File file, Recording recording) {
|
private boolean recordedFileFine(File file, Recording recording) {
|
||||||
this.checkMultimediaFile(file, true, true, recording.getDuration(), recording.getResolution(), "aac",
|
this.checkMultimediaFile(file, true, true, recording.getDuration(), recording.getResolution(), "aac", "h264");
|
||||||
"h264");
|
|
||||||
|
|
||||||
boolean isFine = false;
|
boolean isFine = false;
|
||||||
Picture frame;
|
Picture frame;
|
||||||
|
@ -1925,13 +1935,15 @@ public class OpenViduTestAppE2eTest {
|
||||||
for (int i = 0; i < syncArray.size(); i++) {
|
for (int i = 0; i < syncArray.size(); i++) {
|
||||||
JsonObject j = syncArray.get(i).getAsJsonObject();
|
JsonObject j = syncArray.get(i).getAsJsonObject();
|
||||||
if (webmFile.getName().contains(j.get("streamId").getAsString())) {
|
if (webmFile.getName().contains(j.get("streamId").getAsString())) {
|
||||||
durationInSeconds = (double) (j.get("endTimeOffset").getAsDouble() - j.get("startTimeOffset").getAsDouble()) / 1000;
|
durationInSeconds = (double) (j.get("endTimeOffset").getAsDouble()
|
||||||
|
- j.get("startTimeOffset").getAsDouble()) / 1000;
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Assert.assertTrue(found);
|
Assert.assertTrue(found);
|
||||||
log.info("Duration of {} according to sync metadata json file: {} s", webmFile.getName(), durationInSeconds);
|
log.info("Duration of {} according to sync metadata json file: {} s", webmFile.getName(),
|
||||||
|
durationInSeconds);
|
||||||
this.checkMultimediaFile(webmFile, recording.hasAudio(), recording.hasVideo(), durationInSeconds,
|
this.checkMultimediaFile(webmFile, recording.hasAudio(), recording.hasVideo(), durationInSeconds,
|
||||||
recording.getResolution(), audioDecoder, videoDecoder);
|
recording.getResolution(), audioDecoder, videoDecoder);
|
||||||
webmFile.delete();
|
webmFile.delete();
|
||||||
|
@ -1971,7 +1983,7 @@ public class OpenViduTestAppE2eTest {
|
||||||
log.info("Duration of {} according to ffmpeg: {} s", file.getName(), metadata.getDuration());
|
log.info("Duration of {} according to ffmpeg: {} s", file.getName(), metadata.getDuration());
|
||||||
log.info("Duration of {} according to 'duration' property: {} s", file.getName(), duration);
|
log.info("Duration of {} according to 'duration' property: {} s", file.getName(), duration);
|
||||||
log.info("Difference in s duration: {}", Math.abs(metadata.getDuration() - duration));
|
log.info("Difference in s duration: {}", Math.abs(metadata.getDuration() - duration));
|
||||||
Assert.assertTrue(Math.abs((metadata.getDuration() - duration)) < 0.25);
|
Assert.assertTrue(Math.abs((metadata.getDuration() - duration)) < 0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean thumbnailIsFine(File file) {
|
private boolean thumbnailIsFine(File file) {
|
||||||
|
|
Loading…
Reference in New Issue