add playwright test for arr services

This commit is contained in:
ibizaman 2025-01-30 22:14:07 +01:00 committed by Pierre Penninckx
parent c280b57bf5
commit 6c9f0e50f7
2 changed files with 40 additions and 13 deletions

View file

@ -248,8 +248,10 @@ in
print(f"Filling field {testCfg['passwordFieldLabelRegex']} with {u['password']}")
page.get_by_label(re.compile(testCfg['passwordFieldLabelRegex'])).fill(u['password'])
print(f"Clicking button {testCfg['loginButtonNameRegex']}")
page.get_by_role("button", name=re.compile(testCfg['loginButtonNameRegex'])).click()
# Assumes we don't need to login, so skip this.
if u['username'] is not None or u['password'] is not None:
print(f"Clicking button {testCfg['loginButtonNameRegex']}")
page.get_by_role("button", name=re.compile(testCfg['loginButtonNameRegex'])).click()
for line in u['nextPageExpect']:
print(f"Running: {line}")

View file

@ -43,6 +43,11 @@ let
};
basic = appname: { config, ... }: {
imports = [
testLib.baseModule
../../modules/services/arr.nix
];
test = {
subdomain = appname;
};
@ -55,13 +60,39 @@ let
};
};
clientLogin = appname: { config, ... }: {
imports = [
testLib.baseModule
testLib.clientLoginModule
];
test = {
subdomain = appname;
};
test.login = {
startUrl = "http://${config.test.fqdn}";
usernameFieldLabelRegex = "[Uu]sername";
passwordFieldLabelRegex = "^ *[Pp]assword";
loginButtonNameRegex = "[Ll]og [Ii]n";
testLoginWith = [
{ nextPageExpect = [
"expect(page).to_have_title(re.compile('${appname}', re.IGNORECASE))"
]; }
];
};
};
basicTest = appname: cfgPathFn: pkgs.testers.runNixOSTest {
name = "arr_${appname}_basic";
nodes.server = { config, pkgs, ... }: {
nodes.client = {
imports = [
(clientLogin appname)
];
};
nodes.server = {
imports = [
testLib.baseModule
../../modules/services/arr.nix
(basic appname)
];
};
@ -76,8 +107,6 @@ let
nodes.server = { config, ... }: {
imports = [
testLib.baseModule
../../modules/services/arr.nix
(basic appname)
(testLib.backup config.shb.arr.${appname}.backup)
];
@ -99,10 +128,8 @@ let
nodes.server = { config, pkgs, ... }: {
imports = [
testLib.baseModule
../../modules/services/arr.nix
testLib.certs
(basic appname)
testLib.certs
(https appname)
];
};
@ -123,10 +150,8 @@ let
nodes.server = { config, pkgs, ... }: {
imports = [
testLib.baseModule
../../modules/services/arr.nix
testLib.certs
(basic appname)
testLib.certs
(https appname)
testLib.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n)