diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-10-18 12:06:24 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-10-18 12:06:24 +0200 |
| commit | a2db73cd2032a9212c933a2591e0a93e6cffc9fa (patch) | |
| tree | f74d2deaae399afe99c1054b878096963777d4bb /test | |
| parent | 620a6cf767ff39b7afecbf2c607bbbdba840b6ac (diff) | |
| parent | 95c0f9b0392802ee64a7c8a0f42ac0da3f94bed4 (diff) | |
| download | mullvadvpn-a2db73cd2032a9212c933a2591e0a93e6cffc9fa.tar.xz mullvadvpn-a2db73cd2032a9212c933a2591e0a93e6cffc9fa.zip | |
Merge branch 'write-gui-tests-for-auto-connect-lan-settings-des-275'
Diffstat (limited to 'test')
| -rw-r--r-- | test/Cargo.lock | 1 | ||||
| -rw-r--r-- | test/scripts/ssh-setup.sh | 5 | ||||
| -rw-r--r-- | test/test-manager/src/tests/ui.rs | 8 | ||||
| -rw-r--r-- | test/test-runner/Cargo.toml | 1 | ||||
| -rw-r--r-- | test/test-runner/src/main.rs | 18 |
5 files changed, 28 insertions, 5 deletions
diff --git a/test/Cargo.lock b/test/Cargo.lock index 6209028fde..67f538e39a 100644 --- a/test/Cargo.lock +++ b/test/Cargo.lock @@ -3409,6 +3409,7 @@ version = "0.0.0" dependencies = [ "bytes", "chrono", + "dirs", "futures", "libc", "log", diff --git a/test/scripts/ssh-setup.sh b/test/scripts/ssh-setup.sh index 08887d4aba..66809407d8 100644 --- a/test/scripts/ssh-setup.sh +++ b/test/scripts/ssh-setup.sh @@ -22,8 +22,9 @@ for file in test-runner connection-checker $APP_PACKAGE $PREVIOUS_APP $UI_RUNNER cp -f "$SCRIPT_DIR/$file" "$RUNNER_DIR" done -# Unprivileged users need execute rights for connection checker -chmod 551 "${RUNNER_DIR}/connection-checker" +# Unprivileged users need execute rights for some executables +chmod 775 "${RUNNER_DIR}/connection-checker" +chmod 775 "${RUNNER_DIR}/$UI_RUNNER" chown -R root "$RUNNER_DIR/" diff --git a/test/test-manager/src/tests/ui.rs b/test/test-manager/src/tests/ui.rs index 234fe77065..d4758d9ced 100644 --- a/test/test-manager/src/tests/ui.rs +++ b/test/test-manager/src/tests/ui.rs @@ -284,3 +284,11 @@ pub async fn test_obfuscation_settings_ui(_: TestContext, rpc: ServiceClient) -> assert!(ui_result.success()); Ok(()) } + +/// Test settings in the GUI +#[test_function] +pub async fn test_settings_ui(_: TestContext, rpc: ServiceClient) -> Result<(), Error> { + let ui_result = run_test(&rpc, &["settings.spec"]).await?; + assert!(ui_result.success()); + Ok(()) +} diff --git a/test/test-runner/Cargo.toml b/test/test-runner/Cargo.toml index 7206cb394a..8df61e7164 100644 --- a/test/test-runner/Cargo.toml +++ b/test/test-runner/Cargo.toml @@ -11,6 +11,7 @@ rust-version.workspace = true workspace = true [dependencies] +dirs = "5.0.1" futures = { workspace = true } tarpc = { workspace = true } tokio = { workspace = true } diff --git a/test/test-runner/src/main.rs b/test/test-runner/src/main.rs index 79bc17b4ef..735e61360e 100644 --- a/test/test-runner/src/main.rs +++ b/test/test-runner/src/main.rs @@ -92,12 +92,24 @@ impl Service for TestServer { log::debug!("Exec {} (args: {args:?})", path); let mut cmd = Command::new(&path); + cmd.stdout(Stdio::piped()); + cmd.stderr(Stdio::piped()); + cmd.stdin(Stdio::piped()); cmd.args(args); - // Make sure that PATH is updated - // TODO: We currently do not need this on non-Windows #[cfg(target_os = "windows")] - cmd.env("PATH", sys::get_system_path_var()?); + { + // Make sure that PATH is updated + cmd.env("PATH", sys::get_system_path_var()?); + if let Some(home_dir) = dirs::home_dir() { + cmd.env("USERPROFILE", home_dir); + } + } + + #[cfg(unix)] + if let Some(home_dir) = dirs::home_dir() { + cmd.env("HOME", home_dir); + } cmd.envs(env); |
