nixos/tests/vaultwarden: fix web ui test, disable cli tests as they require internet now

This commit is contained in:
Sandro Jäckel
2026-02-24 18:14:56 +01:00
parent 356d0407b7
commit b6a5bcc792
+20 -10
View File
@@ -30,6 +30,7 @@ let
libraries = [ pkgs.python3Packages.selenium ];
flakeIgnore = [ "E501" ];
}
# python
''
from selenium.webdriver.common.by import By
@@ -80,6 +81,13 @@ let
wait.until_not(EC.title_contains("Set a strong password"))
wait.until_not(EC.title_contains("Join organization"))
# NOTE: When testing this locally, the extensions must not be installed, otherwise this screen does not appear
click_when_unobstructed((By.XPATH, "//button[contains(., 'Add it later')]"))
click_when_unobstructed((By.XPATH, "//a[contains(., 'Skip to web app')]"))
click_when_unobstructed((By.XPATH, "//button[contains(., 'New item')]"))
driver.find_element(By.XPATH, '//input[@formcontrolname="name"]').send_keys(
@@ -205,7 +213,7 @@ let
testScript
else
''
import json
# import json
start_all()
server.wait_for_unit("vaultwarden.service")
@@ -222,18 +230,20 @@ let
with subtest("use the web interface to sign up, log in, and save a password"):
server.succeed("PYTHONUNBUFFERED=1 systemd-cat -t test-runner test-runner")
with subtest("log in with the cli"):
key = client.succeed(
"bw --nointeraction --raw login ${userEmail} ${userPassword}"
).strip()
# Upstreams sees offline usage as a new feature...
# https://github.com/bitwarden/clients/issues/18110
# with subtest("log in with the cli"):
# key = client.succeed(
# "bw --nointeraction --raw login ${userEmail} ${userPassword}"
# ).strip()
with subtest("sync with the cli"):
client.succeed(f"bw --nointeraction --raw --session {key} sync -f")
# with subtest("sync with the cli"):
# client.succeed(f"bw --nointeraction --raw --session {key} sync -f")
with subtest("get the password with the cli"):
output = json.loads(client.succeed(f"bw --nointeraction --raw --session {key} list items"))
# with subtest("get the password with the cli"):
# output = json.loads(client.succeed(f"bw --nointeraction --raw --session {key} list items"))
assert output[0]['login']['password'] == "${storedPassword}"
# assert output[0]['login']['password'] == "${storedPassword}"
'';
}
);