diff --git a/test/common.nix b/test/common.nix index bbb4cca..4276166 100644 --- a/test/common.nix +++ b/test/common.nix @@ -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}") diff --git a/test/services/arr.nix b/test/services/arr.nix index e991473..2b7c023 100644 --- a/test/services/arr.nix +++ b/test/services/arr.nix @@ -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)