nixpkgs/nixos/tests/lomiri-system-settings.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

166 lines
4.6 KiB
Nix
Raw Normal View History

2024-02-15 08:59:39 +00:00
import ./make-test-python.nix (
{ pkgs, lib, ... }:
{
name = "lomiri-system-settings-standalone";
meta.maintainers = lib.teams.lomiri.members;
2024-02-15 08:59:39 +00:00
nodes.machine =
{ config, pkgs, ... }:
{
imports = [
./common/x11.nix
];
2024-02-15 08:59:39 +00:00
services.xserver.enable = true;
2024-02-15 08:59:39 +00:00
environment = {
systemPackages = with pkgs.lomiri; [
suru-icon-theme
lomiri-system-settings
];
variables = {
UITK_ICON_THEME = "suru";
};
};
2024-02-15 08:59:39 +00:00
i18n.supportedLocales = [ "all" ];
2024-02-15 08:59:39 +00:00
fonts.packages = with pkgs; [
# Intended font & helps with OCR
ubuntu-classic
];
2024-02-15 08:59:39 +00:00
services.upower.enable = true;
};
2024-02-15 08:59:39 +00:00
enableOCR = true;
2024-02-15 08:59:39 +00:00
testScript =
let
2024-02-15 08:59:39 +00:00
settingsPages = [
# Base pages
{
2024-02-15 08:59:39 +00:00
name = "wifi";
type = "internal";
element = "networks";
}
{
name = "bluetooth";
type = "internal";
element = "discoverable|None detected";
}
# only text we can really look for with VPN is on a button, OCR on CI struggles with it
{
name = "vpn";
type = "internal";
element = "Add|Manual|Configuration";
skipOCR = true;
}
{
name = "appearance";
type = "internal";
element = "Background image|blur effects";
}
{
name = "desktop";
type = "internal";
element = "workspaces|Icon size";
}
{
name = "sound";
type = "internal";
element = "Silent Mode|Message sound";
}
{
name = "language";
type = "internal";
element = "Display language|External keyboard";
}
{
name = "notification";
type = "internal";
element = "Apps that notify";
}
{
name = "gestures";
type = "internal";
element = "Edge drag";
}
{
name = "mouse";
type = "internal";
element = "Cursor speed|Wheel scrolling speed";
}
{
name = "timedate";
type = "internal";
element = "Time zone|Set the time and date";
}
2024-02-15 08:59:39 +00:00
# External plugins
{
name = "security-privacy";
type = "external";
element = "Locking|unlocking|permissions";
elementLocalised = "Sperren|Entsperren|Berechtigungen";
}
];
in
''
2024-02-15 08:59:39 +00:00
machine.wait_for_x()
2024-02-15 08:59:39 +00:00
with subtest("lomiri system settings launches"):
machine.execute("lomiri-system-settings >&2 &")
machine.wait_for_text("System Settings")
machine.screenshot("lss_open")
2024-02-15 08:59:39 +00:00
# Move focus to start of plugins list for following list of tests
machine.send_key("tab")
machine.send_key("tab")
machine.screenshot("lss_focus")
2024-02-15 08:59:39 +00:00
# tab through & open all sub-menus, to make sure none of them fail
''
+ (lib.strings.concatMapStringsSep "\n" (
page:
''
machine.send_key("tab")
machine.send_key("kp_enter")
''
+ lib.optionalString (!(page.skipOCR or false)) ''
with subtest("lomiri system settings ${page.name} works"):
machine.wait_for_text(r"(${page.element})")
machine.screenshot("lss_page_${page.name}")
''
) settingsPages)
+ ''
2024-02-15 08:59:39 +00:00
machine.execute("pkill -f lomiri-system-settings")
2024-02-15 08:59:39 +00:00
with subtest("lomiri system settings localisation works"):
machine.execute("env LANG=de_DE.UTF-8 lomiri-system-settings >&2 &")
machine.wait_for_text("Systemeinstellungen")
machine.screenshot("lss_localised_open")
2024-02-15 08:59:39 +00:00
# Move focus to start of plugins list for following list of tests
machine.send_key("tab")
machine.send_key("tab")
machine.screenshot("lss_focus_localised")
2024-02-15 08:59:39 +00:00
''
+ (lib.strings.concatMapStringsSep "\n" (
page:
''
machine.send_key("tab")
machine.send_key("kp_enter")
''
+ lib.optionalString (page.type == "external") ''
with subtest("lomiri system settings ${page.name} localisation works"):
machine.wait_for_text(r"(${page.elementLocalised})")
machine.screenshot("lss_localised_page_${page.name}")
''
) settingsPages)
+ '''';
}
)