From 51cc563fe819ce08ba7a3f757e0243882b3121a5 Mon Sep 17 00:00:00 2001 From: ibizaman Date: Tue, 11 Feb 2025 00:24:45 +0100 Subject: [PATCH] add playwright test for hledger --- test/services/grocy.nix | 6 +++--- test/services/hledger.nix | 43 ++++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/test/services/grocy.nix b/test/services/grocy.nix index 52c43d2..a1f9bf3 100644 --- a/test/services/grocy.nix +++ b/test/services/grocy.nix @@ -2,7 +2,7 @@ let testLib = pkgs.callPackage ../common.nix {}; - commonTestScript = lib.makeOverridable testLib.accessScript { + commonTestScript = testLib.mkScripts { hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl); waitForServices = { ... }: [ "phpfpm-grocy.service" @@ -81,7 +81,7 @@ in nodes.client = {}; - testScript = commonTestScript; + testScript = commonTestScript.access; }; https = pkgs.testers.runNixOSTest { @@ -97,6 +97,6 @@ in nodes.client = {}; - testScript = commonTestScript; + testScript = commonTestScript.access; }; } diff --git a/test/services/hledger.nix b/test/services/hledger.nix index 905543f..de709d8 100644 --- a/test/services/hledger.nix +++ b/test/services/hledger.nix @@ -13,6 +13,11 @@ let }; basic = { config, ... }: { + imports = [ + testLib.baseModule + ../../modules/services/hledger.nix + ]; + test = { subdomain = "h"; }; @@ -23,6 +28,26 @@ let }; }; + clientLogin = { config, ... }: { + imports = [ + testLib.baseModule + testLib.clientLoginModule + ]; + + test = { + subdomain = "h"; + }; + + test.login = { + startUrl = "http://${config.test.fqdn}"; + testLoginWith = [ + { nextPageExpect = [ + "expect(page).to_have_title('journal - hledger-web')" + ]; } + ]; + }; + }; + https = { config, ... }: { shb.hledger = { ssl = config.shb.certs.certs.selfsigned.n; @@ -39,10 +64,14 @@ in basic = pkgs.testers.runNixOSTest { name = "hledger_basic"; + nodes.client = { + imports = [ + clientLogin + ]; + }; + nodes.server = { imports = [ - testLib.baseModule - ../../modules/services/hledger.nix basic ]; }; @@ -57,8 +86,6 @@ in nodes.server = { config, ... }: { imports = [ - testLib.baseModule - ../../modules/services/hledger.nix basic (testLib.backup config.shb.hledger.backup) ]; @@ -74,10 +101,8 @@ in nodes.server = { imports = [ - testLib.baseModule - ../../modules/services/hledger.nix - testLib.certs basic + testLib.certs https ]; }; @@ -92,10 +117,8 @@ in nodes.server = { config, pkgs, ... }: { imports = [ - testLib.baseModule - ../../modules/services/hledger.nix - testLib.certs basic + testLib.certs https testLib.ldap (testLib.sso config.shb.certs.certs.selfsigned.n)