openvidu-test-e2e: Chrome initialization fix

pull/255/head
pabloFuente 2019-02-25 13:28:16 +01:00
parent 6145a49423
commit b3eb140150
2 changed files with 10 additions and 6 deletions

View File

@ -176,7 +176,7 @@ public class OpenViduTestAppE2eTest {
switch (browser) {
case "chrome":
this.user = new ChromeUser("TestUser", 50);
this.user = new ChromeUser("TestUser", 50, false);
break;
case "firefox":
this.user = new FirefoxUser("TestUser", 50);
@ -191,10 +191,10 @@ public class OpenViduTestAppE2eTest {
this.user = new ChromeUser("TestUser", 50, "OpenVidu TestApp", false);
break;
case "chromeAsRoot":
this.user = new ChromeUser("TestUser", 50, "Entire screen", true);
this.user = new ChromeUser("TestUser", 50, true);
break;
default:
this.user = new ChromeUser("TestUser", 50);
this.user = new ChromeUser("TestUser", 50, false);
}
user.getDriver().get(APP_URL);

View File

@ -30,8 +30,8 @@ import org.openqa.selenium.remote.RemoteWebDriver;
public class ChromeUser extends BrowserUser {
public ChromeUser(String userName, int timeOfWaitInSeconds) {
this(userName, timeOfWaitInSeconds, generateDefaultScreenChromeOptions());
public ChromeUser(String userName, int timeOfWaitInSeconds, boolean runningAsRoot) {
this(userName, timeOfWaitInSeconds, generateDefaultScreenChromeOptions(runningAsRoot));
}
public ChromeUser(String userName, int timeOfWaitInSeconds, String screenToCapture, boolean runningAsRoot) {
@ -68,7 +68,7 @@ public class ChromeUser extends BrowserUser {
this.configureDriver();
}
private static ChromeOptions generateDefaultScreenChromeOptions() {
private static ChromeOptions generateDefaultScreenChromeOptions(boolean runningAsRoot) {
ChromeOptions options = new ChromeOptions();
// This flag avoids to grant the user media
options.addArguments("--use-fake-ui-for-media-stream");
@ -77,6 +77,10 @@ public class ChromeUser extends BrowserUser {
// This flag selects the entire screen as video source when screen sharing
options.addArguments("--auto-select-desktop-capture-source=Entire screen");
if (runningAsRoot) {
options.addArguments("--no-sandbox");
}
return options;
}