add start of playwright test for audiobookshelf

This commit is contained in:
ibizaman 2025-01-31 16:18:59 +01:00 committed by Pierre Penninckx
parent 6c9f0e50f7
commit 71651bdc0e
2 changed files with 46 additions and 11 deletions

View file

@ -155,15 +155,15 @@ in
options.test.login = {
usernameFieldLabelRegex = mkOption {
type = str;
default = "username";
default = "[Uu]sername";
};
passwordFieldLabelRegex = mkOption {
type = str;
default = "password";
default = "[Pp]assword";
};
loginButtonNameRegex = mkOption {
type = str;
default = "login";
default = "[Ll]ogin";
};
testLoginWith = mkOption {
type = listOf (submodule {

View file

@ -17,6 +17,11 @@ let
};
basic = { config, ... }: {
imports = [
testLib.baseModule
../../modules/services/audiobookshelf.nix
];
test = {
subdomain = "a";
};
@ -26,6 +31,36 @@ let
};
};
clientLogin = { config, ... }: {
imports = [
testLib.baseModule
testLib.clientLoginModule
];
virtualisation.memorySize = 4096;
test = {
subdomain = "a";
};
test.login = {
startUrl = "http://${config.test.fqdn}";
usernameFieldLabelRegex = "[Uu]sername";
passwordFieldLabelRegex = "[Pp]assword";
loginButtonNameRegex = "[Ll]og [Ii]n";
testLoginWith = [
# Failure is after so we're not throttled too much.
{ username = "root"; password = "rootpw"; nextPageExpect = [
"expect(page.get_by_text('Wrong username or password')).to_be_visible()"
]; }
# { username = adminUser; password = adminPass; nextPageExpect = [
# "expect(page.get_by_text('Wrong username or password')).not_to_be_visible()"
# "expect(page.get_by_role('button', name=re.compile('[Ll]og [Ii]n'))).not_to_be_visible()"
# "expect(page).to_have_title(re.compile('Dashboard'))"
# ]; }
];
};
};
https = { config, ... }: {
shb.audiobookshelf = {
ssl = config.shb.certs.certs.selfsigned.n;
@ -48,10 +83,14 @@ in
basic = pkgs.testers.runNixOSTest {
name = "audiobookshelf-basic";
nodes.client = {
imports = [
# TODO: enable this when declarative user management is possible.
# clientLogin
];
};
nodes.server = {
imports = [
testLib.baseModule
../../modules/services/audiobookshelf.nix
basic
];
};
@ -66,10 +105,8 @@ in
nodes.server = {
imports = [
testLib.baseModule
../../modules/services/audiobookshelf.nix
testLib.certs
basic
testLib.certs
https
];
};
@ -84,10 +121,8 @@ in
nodes.server = { config, ... }: {
imports = [
testLib.baseModule
../../modules/services/audiobookshelf.nix
testLib.certs
basic
testLib.certs
https
testLib.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n)