Files
nixpkgs/nixos/tests/homepage-dashboard.nix
Jon Seager 520f14f89c nixos/tests/homepage-dashboard: fix failing tests
This commit adjusts the test suite slightly
to request a more "static" asset to ensure that
the configuration is reflected.

Rather than request the full page, which requires
Javascript to be accurate, we request from the
API the configured bookmarks and the site
manifest which contains the configured title.
2025-08-05 14:11:19 +01:00

45 lines
1.3 KiB
Nix

{ lib, ... }:
{
name = "homepage-dashboard";
meta.maintainers = with lib.maintainers; [ jnsgruk ];
nodes.machine = _: {
services.homepage-dashboard = {
enable = true;
settings.title = "test title rodUsEagid"; # something random/unique
bookmarks = [
{
Developer = [
{
nixpkgs = [
{
abbr = "NX";
href = "https://github.com/nixos/nixpkgs";
}
];
}
];
}
];
};
};
testScript = ''
# Ensure the services are started on managed machine
machine.wait_for_unit("homepage-dashboard.service")
machine.wait_for_open_port(8082)
machine.succeed("curl --fail http://localhost:8082/")
# Ensure /etc/homepage-dashboard is created.
machine.succeed("test -d /etc/homepage-dashboard")
# Ensure that we see the custom title reflected in the manifest
page = machine.succeed("curl --fail http://localhost:8082/site.webmanifest?v=4")
assert "test title rodUsEagid" in page, "Custom title not found"
# Ensure that we see the custom bookmarks on the page
page = machine.succeed("curl --fail http://127.0.0.1:8082/api/bookmarks")
assert "nixpkgs" in page, "Custom bookmarks not found"
'';
}