Skip to content

Commit

Permalink
openvidu-test-e2e: add enabled/disabled, Server API Mute and simulcas…
Browse files Browse the repository at this point in the history
…t disabled tests
  • Loading branch information
pabloFuente committed Oct 4, 2024
1 parent 0ce0e2a commit 3d60920
Show file tree
Hide file tree
Showing 5 changed files with 380 additions and 120 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ private ChromeUser(String userName, int timeOfWaitInSeconds, ChromeOptions optio
prefs.put("profile.default_content_setting_values.media_stream_camera", 1);
options.setExperimentalOption("prefs", prefs);

if (headless) {
options.addArguments("--headless=new");
options.addArguments("--mute-audio");
}

if (REMOTE_URL != null && !REMOTE_URL.isBlank()) {
if (headless) {
options.addArguments("--headless=new");
}
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
try {
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

public class EdgeUser extends BrowserUser {

public EdgeUser(String userName, int timeOfWaitInSeconds) {
public EdgeUser(String userName, int timeOfWaitInSeconds, boolean headless) {
super(userName, timeOfWaitInSeconds);

String REMOTE_URL = System.getProperty("REMOTE_URL_EDGE");
Expand All @@ -23,8 +23,12 @@ public EdgeUser(String userName, int timeOfWaitInSeconds) {
options.addArguments("--use-fake-device-for-media-stream");
options.addArguments("--disable-infobars");

if (REMOTE_URL != null && !REMOTE_URL.isBlank()) {
if (headless) {
options.addArguments("--headless=new");
options.addArguments("--mute-audio");
}

if (REMOTE_URL != null && !REMOTE_URL.isBlank()) {
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
try {
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class FirefoxUser extends BrowserUser {

public FirefoxUser(String userName, int timeOfWaitInSeconds, boolean disableOpenH264) {
public FirefoxUser(String userName, int timeOfWaitInSeconds, boolean disableOpenH264, boolean headless) {
super(userName, timeOfWaitInSeconds);

String REMOTE_URL = System.getProperty("REMOTE_URL_FIREFOX");
Expand All @@ -47,8 +47,12 @@ public FirefoxUser(String userName, int timeOfWaitInSeconds, boolean disableOpen
options.addPreference("media.gmp-gmpopenh264.enabled", false);
}

if (headless) {
options.addArguments("--headless");
options.addPreference("media.volume_scale", "0.0");
}

if (REMOTE_URL != null && !REMOTE_URL.isBlank()) {
// options.addArguments("--headless");
log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
try {
this.driver = new RemoteWebDriver(new URL(REMOTE_URL), options);
Expand All @@ -57,6 +61,8 @@ public FirefoxUser(String userName, int timeOfWaitInSeconds, boolean disableOpen
}
} else {
log.info("Using local web driver");
System.setProperty("webdriver.gecko.driver",
"/home/pablo/Downloads/geckodriver-v0.35.0-linux64/geckodriver");
this.driver = new FirefoxDriver(options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,10 @@ protected BrowserUser setupBrowser(String browser) throws Exception {
BrowserUser browserUser = null;
GenericContainer<?> container;
Path path;
boolean headless = false;

switch (browser) {
case "chrome":
boolean headless = false;
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, headless);
setupBrowserAux(BrowserNames.CHROME, container, false);
browserUser = new ChromeUser("TestUser", 50, headless);
Expand Down Expand Up @@ -283,7 +283,7 @@ protected BrowserUser setupBrowser(String browser) throws Exception {
System.err.println("exception on: downLoadFile() function: " + e.getMessage());
}
}
browserUser = new ChromeUser("TestUser", 50, null, path);
browserUser = new ChromeUser("TestUser", 50, null, path, headless);
break;
case "chromeVirtualBackgroundFakeVideo":
container = chromeContainer("selenium/standalone-chrome:" + CHROME_VERSION, 2147483648L, 1, false);
Expand All @@ -295,17 +295,17 @@ protected BrowserUser setupBrowser(String browser) throws Exception {
case "firefox":
container = firefoxContainer("selenium/standalone-firefox:" + FIREFOX_VERSION, 2147483648L, 1, false);
setupBrowserAux(BrowserNames.FIREFOX, container, false);
browserUser = new FirefoxUser("TestUser", 50, false);
browserUser = new FirefoxUser("TestUser", 50, false, headless);
break;
case "firefoxDisabledOpenH264":
container = firefoxContainer("selenium/standalone-firefox:" + FIREFOX_VERSION, 2147483648L, 1, true);
setupBrowserAux(BrowserNames.FIREFOX, container, false);
browserUser = new FirefoxUser("TestUser", 50, true);
browserUser = new FirefoxUser("TestUser", 50, true, headless);
break;
case "edge":
container = edgeContainer("selenium/standalone-edge:" + EDGE_VERSION, 2147483648L, 1, false);
setupBrowserAux(BrowserNames.EDGE, container, false);
browserUser = new EdgeUser("TestUser", 50);
browserUser = new EdgeUser("TestUser", 50, headless);
break;
default:
log.error("Browser {} not recognized", browser);
Expand Down
Loading

0 comments on commit 3d60920

Please sign in to comment.