test: add beforeHook option

This commit is contained in:
ibizaman 2025-08-22 23:10:17 +02:00 committed by Pierre Penninckx
parent 7ff2cfa642
commit af968c8163
2 changed files with 11 additions and 0 deletions

View file

@ -254,6 +254,10 @@ in
type = str;
default = "http://${config.test.fqdn}";
};
beforeHook = mkOption {
type = str;
default = "";
};
};
config = {
networking.hosts = {
@ -306,6 +310,9 @@ in
page = context.new_page()
print(f"Going to {testCfg['startUrl']}")
page.goto(testCfg['startUrl'])
if testCfg.get("beforeHook") is not None:
exec(testCfg.get("beforeHook"))
if u['username'] is not None:
print(f"Filling field username with {u['username']}")

View file

@ -205,6 +205,10 @@ let
test.login = {
startUrl = "http://${config.test.fqdn}";
# No need since Nextcloud is auto-redirecting to the SSO sign in page.
# beforeHook = ''
# page.get_by_role("link", name="Sign in with SHB-Authelia").click()
# '';
usernameFieldLabelRegex = "Username";
passwordFieldSelector = "get_by_label(\"Password *\")";
loginButtonNameRegex = "[sS]ign [iI]n";