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']}") print(f"Filling field {testCfg['passwordFieldLabelRegex']} with {u['password']}")
page.get_by_label(re.compile(testCfg['passwordFieldLabelRegex'])).fill(u['password']) page.get_by_label(re.compile(testCfg['passwordFieldLabelRegex'])).fill(u['password'])
print(f"Clicking button {testCfg['loginButtonNameRegex']}") # Assumes we don't need to login, so skip this.
page.get_by_role("button", name=re.compile(testCfg['loginButtonNameRegex'])).click() 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']: for line in u['nextPageExpect']:
print(f"Running: {line}") print(f"Running: {line}")

View file

@ -43,6 +43,11 @@ let
}; };
basic = appname: { config, ... }: { basic = appname: { config, ... }: {
imports = [
testLib.baseModule
../../modules/services/arr.nix
];
test = { test = {
subdomain = appname; 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 { basicTest = appname: cfgPathFn: pkgs.testers.runNixOSTest {
name = "arr_${appname}_basic"; name = "arr_${appname}_basic";
nodes.server = { config, pkgs, ... }: { nodes.client = {
imports = [
(clientLogin appname)
];
};
nodes.server = {
imports = [ imports = [
testLib.baseModule
../../modules/services/arr.nix
(basic appname) (basic appname)
]; ];
}; };
@ -76,8 +107,6 @@ let
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
testLib.baseModule
../../modules/services/arr.nix
(basic appname) (basic appname)
(testLib.backup config.shb.arr.${appname}.backup) (testLib.backup config.shb.arr.${appname}.backup)
]; ];
@ -99,10 +128,8 @@ let
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
testLib.baseModule
../../modules/services/arr.nix
testLib.certs
(basic appname) (basic appname)
testLib.certs
(https appname) (https appname)
]; ];
}; };
@ -123,10 +150,8 @@ let
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
testLib.baseModule
../../modules/services/arr.nix
testLib.certs
(basic appname) (basic appname)
testLib.certs
(https appname) (https appname)
testLib.ldap testLib.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (testLib.sso config.shb.certs.certs.selfsigned.n)