Skip to content

Commit 6d4da24

Browse files
committed
Add gui test to test framework
1 parent f90b202 commit 6d4da24

File tree

1 file changed

+66
-1
lines changed
  • test/test-manager/src/tests

1 file changed

+66
-1
lines changed

test/test-manager/src/tests/ui.rs

+66-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub async fn test_ui_login(_: TestContext, rpc: ServiceClient) -> Result<(), Err
125125
Ok(())
126126
}
127127

128-
#[test_function(priority = 1000, must_succeed = true)]
128+
#[test_function(priority = 1000)]
129129
async fn test_custom_access_methods_gui(
130130
_: TestContext,
131131
rpc: ServiceClient,
@@ -207,6 +207,71 @@ async fn test_custom_access_methods_gui(
207207
Ok(())
208208
}
209209

210+
#[test_function(priority = 1000)]
211+
async fn test_custom_bridge_gui(
212+
_: TestContext,
213+
rpc: ServiceClient,
214+
mut mullvad_client: MullvadProxyClient,
215+
) -> Result<(), Error> {
216+
use mullvad_relay_selector::{RelaySelector, SelectorConfig};
217+
use talpid_types::net::proxy::CustomProxy;
218+
// For this test to work, we need to supply the following env-variables:
219+
//
220+
// * SHADOWSOCKS_SERVER_IP
221+
// * SHADOWSOCKS_SERVER_PORT
222+
// * SHADOWSOCKS_SERVER_CIPHER
223+
// * SHADOWSOCKS_SERVER_PASSWORD
224+
//
225+
// See `gui/test/e2e/installed/state-dependent/custom-bridge.spec.ts`
226+
// for details. The setup should be the same as in
227+
// `test_manager::tests::access_methods::test_shadowsocks`.
228+
229+
let gui_test = "custom-bridge.spec";
230+
let relay_list = mullvad_client.get_relay_locations().await.unwrap();
231+
let relay_selector = RelaySelector::from_list(SelectorConfig::default(), relay_list);
232+
let custom_proxy = relay_selector
233+
.get_bridge_forced()
234+
.and_then(|proxy| match proxy {
235+
CustomProxy::Shadowsocks(s) => Some(s),
236+
_ => None
237+
})
238+
.expect("`test_shadowsocks` needs at least one shadowsocks relay to execute. Found none in relay list.");
239+
240+
let ui_result = run_test_env(
241+
&rpc,
242+
&[gui_test],
243+
[
244+
(
245+
"SHADOWSOCKS_SERVER_IP",
246+
custom_proxy.endpoint.ip().to_string().as_ref(),
247+
),
248+
(
249+
"SHADOWSOCKS_SERVER_PORT",
250+
custom_proxy.endpoint.port().to_string().as_ref(),
251+
),
252+
("SHADOWSOCKS_SERVER_CIPHER", custom_proxy.cipher.as_ref()),
253+
(
254+
"SHADOWSOCKS_SERVER_PASSWORD",
255+
custom_proxy.password.as_ref(),
256+
),
257+
],
258+
)
259+
.await
260+
.unwrap();
261+
262+
assert!(ui_result.success());
263+
264+
// Reset the `api-override` feature.
265+
tokio::time::timeout(
266+
std::time::Duration::from_secs(60),
267+
rpc.set_daemon_environment(helpers::get_app_env()),
268+
)
269+
.await
270+
.map_err(|_| Error::DaemonNotRunning)??;
271+
272+
Ok(())
273+
}
274+
210275
/// Test settings import / IP overrides in the GUI
211276
///
212277
/// # Note

0 commit comments

Comments
 (0)