openvidu-test-e2e: fix new response of POST /api/sessions

pull/600/head
pabloFuente 2020-09-10 14:47:09 +02:00
parent c6019394ec
commit 1a8733b2ea
1 changed files with 37 additions and 35 deletions

View File

@ -46,14 +46,6 @@ import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
import com.mashape.unirest.http.HttpMethod;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import org.jcodec.api.FrameGrab; import org.jcodec.api.FrameGrab;
@ -80,6 +72,14 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.junit.jupiter.SpringExtension;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonReader;
import com.mashape.unirest.http.HttpMethod;
import io.github.bonigarcia.wdm.WebDriverManager; import io.github.bonigarcia.wdm.WebDriverManager;
import io.openvidu.java.client.Connection; import io.openvidu.java.client.Connection;
import io.openvidu.java.client.KurentoOptions; import io.openvidu.java.client.KurentoOptions;
@ -183,26 +183,26 @@ public class OpenViduTestAppE2eTest {
BrowserUser browserUser; BrowserUser browserUser;
switch (browser) { switch (browser) {
case "chrome": case "chrome":
browserUser = new ChromeUser("TestUser", 50, false); browserUser = new ChromeUser("TestUser", 50, false);
break; break;
case "firefox": case "firefox":
browserUser = new FirefoxUser("TestUser", 50); browserUser = new FirefoxUser("TestUser", 50);
break; break;
case "opera": case "opera":
browserUser = new OperaUser("TestUser", 50); browserUser = new OperaUser("TestUser", 50);
break; break;
case "chromeAndroid": case "chromeAndroid":
browserUser = new ChromeAndroidUser("TestUser", 50); browserUser = new ChromeAndroidUser("TestUser", 50);
break; break;
case "chromeAlternateScreenShare": case "chromeAlternateScreenShare":
browserUser = new ChromeUser("TestUser", 50, "OpenVidu TestApp", false); browserUser = new ChromeUser("TestUser", 50, "OpenVidu TestApp", false);
break; break;
case "chromeAsRoot": case "chromeAsRoot":
browserUser = new ChromeUser("TestUser", 50, true); browserUser = new ChromeUser("TestUser", 50, true);
break; break;
default: default:
browserUser = new ChromeUser("TestUser", 50, false); browserUser = new ChromeUser("TestUser", 50, false);
} }
this.user = new MyUser(browserUser); this.user = new MyUser(browserUser);
@ -341,7 +341,7 @@ public class OpenViduTestAppE2eTest {
// Check codecs // Check codecs
List<WebElement> statsButtons = user.getDriver().findElements(By.className("stats-button")); List<WebElement> statsButtons = user.getDriver().findElements(By.className("stats-button"));
for(WebElement statButton: statsButtons) { for (WebElement statButton : statsButtons) {
statButton.click(); statButton.click();
Thread.sleep(1000); Thread.sleep(1000);
String videoCodecUsed = user.getDriver().findElement(By.id("video-codec-used")).getText(); String videoCodecUsed = user.getDriver().findElement(By.id("video-codec-used")).getText();
@ -2585,10 +2585,11 @@ public class OpenViduTestAppE2eTest {
// 200 // 200
body = "{'mediaMode': 'ROUTED', 'recordingMode': 'MANUAL', 'customSessionId': 'CUSTOM_SESSION_ID', 'defaultOutputMode': 'COMPOSED', 'defaultRecordingLayout': 'BEST_FIT'}"; body = "{'mediaMode': 'ROUTED', 'recordingMode': 'MANUAL', 'customSessionId': 'CUSTOM_SESSION_ID', 'defaultOutputMode': 'COMPOSED', 'defaultRecordingLayout': 'BEST_FIT'}";
restClient.rest(HttpMethod.POST, "/api/sessions", body, HttpStatus.SC_OK, true, restClient.rest(HttpMethod.POST, "/api/sessions", body, HttpStatus.SC_OK, true,
"{'id': 'STR', 'createdAt': 0}"); "{'id':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultOutputMode':'STR','defaultRecordingLayout':'STR','customSessionId':'STR','forcedVideoCodec':'STR','allowTranscoding':false,'connections':{'numberOfElements':0,'content':[]},'recording':true}");
// Default values // Default values
JsonObject res = restClient.rest(HttpMethod.POST, "/api/sessions", "{}", HttpStatus.SC_OK, true, JsonObject res = restClient.rest(HttpMethod.POST, "/api/sessions", "{}", HttpStatus.SC_OK, true,
"{'id': 'STR', 'createdAt': 0}"); "{'id':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultOutputMode':'STR','defaultRecordingLayout':'STR','customSessionId':'STR','forcedVideoCodec':'STR','allowTranscoding':false,'connections':{'numberOfElements':0,'content':[]},'recording':true}");
restClient.rest(HttpMethod.DELETE, "/api/sessions/" + res.get("id").getAsString(), HttpStatus.SC_NO_CONTENT); restClient.rest(HttpMethod.DELETE, "/api/sessions/" + res.get("id").getAsString(), HttpStatus.SC_NO_CONTENT);
// 409 // 409
@ -2676,7 +2677,7 @@ public class OpenViduTestAppE2eTest {
// 409 (RELAYED media mode) // 409 (RELAYED media mode)
res = restClient.rest(HttpMethod.POST, "/api/sessions", "{'mediaMode':'RELAYED'}", HttpStatus.SC_OK, true, res = restClient.rest(HttpMethod.POST, "/api/sessions", "{'mediaMode':'RELAYED'}", HttpStatus.SC_OK, true,
"{'id': 'STR', 'createdAt': 0}"); "{'id':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultOutputMode':'STR','defaultRecordingLayout':'STR','customSessionId':'STR','forcedVideoCodec':'STR','allowTranscoding':false,'connections':{'numberOfElements':0,'content':[]},'recording':true}");
body = "{'session':'" + res.get("id").getAsString() + "'}"; body = "{'session':'" + res.get("id").getAsString() + "'}";
restClient.rest(HttpMethod.POST, "/api/recordings/start", body, HttpStatus.SC_CONFLICT); restClient.rest(HttpMethod.POST, "/api/recordings/start", body, HttpStatus.SC_CONFLICT);
restClient.rest(HttpMethod.DELETE, "/api/sessions/" + res.get("id").getAsString(), HttpStatus.SC_NO_CONTENT); restClient.rest(HttpMethod.DELETE, "/api/sessions/" + res.get("id").getAsString(), HttpStatus.SC_NO_CONTENT);
@ -3154,7 +3155,8 @@ public class OpenViduTestAppE2eTest {
// Init a session and publish IP camera AS FIRST PARTICIPANT // Init a session and publish IP camera AS FIRST PARTICIPANT
restClient.rest(HttpMethod.POST, "/api/sessions", "{'customSessionId':'IP_CAM_SESSION'}", HttpStatus.SC_OK, restClient.rest(HttpMethod.POST, "/api/sessions", "{'customSessionId':'IP_CAM_SESSION'}", HttpStatus.SC_OK,
true, "{'id': 'STR', 'createdAt': 0}"); true,
"{'id':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultOutputMode':'STR','defaultRecordingLayout':'STR','customSessionId':'STR','forcedVideoCodec':'STR','allowTranscoding':false,'connections':{'numberOfElements':0,'content':[]},'recording':true}");
// No rtspUri [400] // No rtspUri [400]
restClient.rest(HttpMethod.POST, "/api/sessions/IP_CAM_SESSION/connection", "{}", restClient.rest(HttpMethod.POST, "/api/sessions/IP_CAM_SESSION/connection", "{}",