Skip to content

Commit 0e8a457

Browse files
committed
Sync WebDriver options for E2E and integration tests
1 parent ad168b0 commit 0e8a457

File tree

3 files changed

+26
-21
lines changed

3 files changed

+26
-21
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ docker-up-e2e-env = RUST_BACKTRACE=1 \
11531153
$(CHROME_VERSION) )) \
11541154
COMPOSE_WEBDRIVER_ENTRYPOINT=$(strip \
11551155
$(if $(call eq,$(browser),firefox),\
1156-
"geckodriver --binary=/opt/firefox/firefox" ,\
1156+
"geckodriver --binary=/opt/firefox/firefox --log=debug" ,\
11571157
"sh -c \"/opt/bin/start-xvfb.sh 2>/dev/null & \
11581158
exec chromedriver --port=4444 --allowed-ips='' \
11591159
--allowed-origins='*'\"" ))
@@ -1219,7 +1219,7 @@ ifeq ($(browser),firefox)
12191219
docker run --rm -d --network=host --shm-size 512m \
12201220
--name medea-webdriver-firefox \
12211221
ghcr.io/instrumentisto/geckodriver:$(FIREFOX_VERSION) \
1222-
--binary=/opt/firefox/firefox
1222+
--binary=/opt/firefox/firefox --log=debug
12231223
else
12241224
docker run --rm -d --network=host --shm-size 512m \
12251225
--name medea-webdriver-chrome --entrypoint sh \

e2e/src/browser/client.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,6 @@ use tokio::task;
1818

1919
use super::{js::Statement, Error, Result};
2020

21-
/// Arguments for Chrome browser.
22-
const CHROME_ARGS: &[&str] = &[
23-
"--use-fake-device-for-media-stream",
24-
"--use-fake-ui-for-media-stream",
25-
"--disable-web-security",
26-
"--disable-dev-shm-usage",
27-
"--no-sandbox",
28-
];
29-
30-
/// Arguments for Firefox browser.
31-
const FIREFOX_ARGS: &[&str] = &[];
32-
3321
/// Result returned from all the JS code executed in a browser.
3422
#[derive(Debug, Deserialize)]
3523
#[serde(rename_all = "lowercase")]
@@ -337,30 +325,42 @@ pub struct AutoCapabilities {
337325
impl AutoCapabilities {
338326
/// Returns `moz:firefoxOptions` for a Firefox browser.
339327
fn firefox(self) -> serde_json::Value {
340-
let mut args = FIREFOX_ARGS.to_vec();
328+
let mut args = Vec::new();
341329
if self.headless_firefox {
342330
args.push("--headless");
343331
}
344332
json!({
345333
"prefs": {
346-
"media.navigator.streams.fake": true,
347334
"media.navigator.permission.disabled": true,
348-
"media.autoplay.enabled": true,
349-
"media.autoplay.enabled.user-gestures-needed ": false,
335+
"media.navigator.streams.fake": true,
350336
"media.autoplay.ask-permission": false,
351337
"media.autoplay.default": 0,
338+
"media.autoplay.enabled": true,
339+
"media.autoplay.enabled.user-gestures-needed": false,
352340
},
353341
"args": args,
354342
})
355343
}
356344

357345
/// Returns `goog:chromeOptions` for a Chrome browser.
358346
fn chrome(self) -> serde_json::Value {
359-
let mut args = CHROME_ARGS.to_vec();
347+
let mut args = [
348+
"--disable-browser-side-navigation",
349+
"--disable-dev-shm-usage",
350+
"--disable-extensions",
351+
"--disable-gpu",
352+
"--disable-web-security",
353+
"--dns-prefetch-disable",
354+
"--no-sandbox",
355+
"--use-fake-device-for-media-stream",
356+
"--use-fake-ui-for-media-stream",
357+
"--window-size=1920,1080",
358+
]
359+
.to_vec();
360360
if self.headless_chrome {
361361
args.push("--headless");
362362
}
363-
json!({ "args": args })
363+
json!({"args": args})
364364
}
365365
}
366366

webdriver.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
{
22
"moz:firefoxOptions": {
33
"prefs": {
4+
"media.navigator.permission.disabled": true,
45
"media.navigator.streams.fake": true,
5-
"media.navigator.permission.disabled": true
6+
"media.autoplay.ask-permission": false,
7+
"media.autoplay.default": 0,
8+
"media.autoplay.enabled": true,
9+
"media.autoplay.enabled.user-gestures-needed": false
610
},
711
"args": []
812
},
@@ -12,6 +16,7 @@
1216
"--disable-dev-shm-usage",
1317
"--disable-extensions",
1418
"--disable-gpu",
19+
"--disable-web-security",
1520
"--dns-prefetch-disable",
1621
"--no-sandbox",
1722
"--use-fake-device-for-media-stream",

0 commit comments

Comments
 (0)