add playwright test for hledger

This commit is contained in:
ibizaman 2025-02-11 00:24:45 +01:00
parent 5a6be171b3
commit 3071fcf5da
2 changed files with 36 additions and 13 deletions

View file

@ -2,7 +2,7 @@
let let
testLib = pkgs.callPackage ../common.nix {}; testLib = pkgs.callPackage ../common.nix {};
commonTestScript = lib.makeOverridable testLib.accessScript { commonTestScript = testLib.mkScripts {
hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl); hasSSL = { node, ... }: !(isNull node.config.shb.grocy.ssl);
waitForServices = { ... }: [ waitForServices = { ... }: [
"phpfpm-grocy.service" "phpfpm-grocy.service"
@ -81,7 +81,7 @@ in
nodes.client = {}; nodes.client = {};
testScript = commonTestScript; testScript = commonTestScript.access;
}; };
https = pkgs.testers.runNixOSTest { https = pkgs.testers.runNixOSTest {
@ -97,6 +97,6 @@ in
nodes.client = {}; nodes.client = {};
testScript = commonTestScript; testScript = commonTestScript.access;
}; };
} }

View file

@ -13,6 +13,11 @@ let
}; };
basic = { config, ... }: { basic = { config, ... }: {
imports = [
testLib.baseModule
../../modules/services/hledger.nix
];
test = { test = {
subdomain = "h"; 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, ... }: { https = { config, ... }: {
shb.hledger = { shb.hledger = {
ssl = config.shb.certs.certs.selfsigned.n; ssl = config.shb.certs.certs.selfsigned.n;
@ -39,10 +64,14 @@ in
basic = pkgs.testers.runNixOSTest { basic = pkgs.testers.runNixOSTest {
name = "hledger_basic"; name = "hledger_basic";
nodes.client = {
imports = [
clientLogin
];
};
nodes.server = { nodes.server = {
imports = [ imports = [
testLib.baseModule
../../modules/services/hledger.nix
basic basic
]; ];
}; };
@ -57,8 +86,6 @@ in
nodes.server = { config, ... }: { nodes.server = { config, ... }: {
imports = [ imports = [
testLib.baseModule
../../modules/services/hledger.nix
basic basic
(testLib.backup config.shb.hledger.backup) (testLib.backup config.shb.hledger.backup)
]; ];
@ -74,10 +101,8 @@ in
nodes.server = { nodes.server = {
imports = [ imports = [
testLib.baseModule
../../modules/services/hledger.nix
testLib.certs
basic basic
testLib.certs
https https
]; ];
}; };
@ -92,10 +117,8 @@ in
nodes.server = { config, pkgs, ... }: { nodes.server = { config, pkgs, ... }: {
imports = [ imports = [
testLib.baseModule
../../modules/services/hledger.nix
testLib.certs
basic basic
testLib.certs
https https
testLib.ldap testLib.ldap
(testLib.sso config.shb.certs.certs.selfsigned.n) (testLib.sso config.shb.certs.certs.selfsigned.n)