about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOPNA2608 <opna2608@protonmail.com>2024-02-15 09:59:39 +0100
committerOPNA2608 <opna2608@protonmail.com>2024-02-26 10:11:41 +0100
commit66129d5e24575468ad8feca2f035e33c7374e14a (patch)
treedbf3ac7db998ca5b5c80e00b7befad4575cc4ac0
parent08ef9001677d64c88739cbeaa34879901e959ad4 (diff)
downloadnixlib-66129d5e24575468ad8feca2f035e33c7374e14a.tar
nixlib-66129d5e24575468ad8feca2f035e33c7374e14a.tar.gz
nixlib-66129d5e24575468ad8feca2f035e33c7374e14a.tar.bz2
nixlib-66129d5e24575468ad8feca2f035e33c7374e14a.tar.lz
nixlib-66129d5e24575468ad8feca2f035e33c7374e14a.tar.xz
nixlib-66129d5e24575468ad8feca2f035e33c7374e14a.tar.zst
nixlib-66129d5e24575468ad8feca2f035e33c7374e14a.zip
tests/lomiri-system-settings: init
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/lomiri-system-settings.nix99
-rw-r--r--pkgs/desktops/lomiri/applications/lomiri-system-settings/wrapper.nix3
3 files changed, 103 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 1144a5611dcf..aedb20b32a56 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -497,6 +497,7 @@ in {
   lxd = pkgs.recurseIntoAttrs (handleTest ./lxd { inherit handleTestOn; });
   lxd-image-server = handleTest ./lxd-image-server.nix {};
   #logstash = handleTest ./logstash.nix {};
+  lomiri-system-settings = handleTest ./lomiri-system-settings.nix {};
   lorri = handleTest ./lorri/default.nix {};
   maddy = discoverTests (import ./maddy { inherit handleTest; });
   maestral = handleTest ./maestral.nix {};
diff --git a/nixos/tests/lomiri-system-settings.nix b/nixos/tests/lomiri-system-settings.nix
new file mode 100644
index 000000000000..867fc14797e7
--- /dev/null
+++ b/nixos/tests/lomiri-system-settings.nix
@@ -0,0 +1,99 @@
+import ./make-test-python.nix ({ pkgs, lib, ... }: {
+  name = "lomiri-system-settings-standalone";
+  meta.maintainers = lib.teams.lomiri.members;
+
+  nodes.machine = { config, pkgs, ... }: {
+    imports = [
+      ./common/x11.nix
+    ];
+
+    services.xserver.enable = true;
+
+    environment = {
+      systemPackages = with pkgs.lomiri; [
+        suru-icon-theme
+        lomiri-system-settings
+      ];
+      variables = {
+        UITK_ICON_THEME = "suru";
+      };
+    };
+
+    i18n.supportedLocales = [ "all" ];
+
+    fonts.packages = with pkgs; [
+      # Intended font & helps with OCR
+      ubuntu_font_family
+    ];
+
+    services.upower.enable = true;
+  };
+
+  enableOCR = true;
+
+  testScript = let
+    settingsPages = [
+      # Base pages
+      { 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"; }
+
+      # External plugins
+      { name = "security-privacy"; type = "external"; element = "Locking|unlocking|permissions"; elementLocalised = "Sperren|Entsperren|Berechtigungen"; }
+    ];
+  in
+  ''
+    machine.wait_for_x()
+
+    with subtest("lomiri system settings launches"):
+        machine.execute("lomiri-system-settings >&2 &")
+        machine.wait_for_text("System Settings")
+        machine.screenshot("lss_open")
+
+    # Move focus to start of plugins list for following list of tests
+    machine.send_key("tab")
+    machine.send_key("tab")
+    machine.screenshot("lss_focus")
+
+    # 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) + ''
+
+    machine.execute("pkill -f lomiri-system-settings")
+
+    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")
+
+    # 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")
+
+  '' + (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) + ''
+  '';
+})
diff --git a/pkgs/desktops/lomiri/applications/lomiri-system-settings/wrapper.nix b/pkgs/desktops/lomiri/applications/lomiri-system-settings/wrapper.nix
index 40170f4d6366..74767f41d9ec 100644
--- a/pkgs/desktops/lomiri/applications/lomiri-system-settings/wrapper.nix
+++ b/pkgs/desktops/lomiri/applications/lomiri-system-settings/wrapper.nix
@@ -1,5 +1,6 @@
 { stdenvNoCC
 , lib
+, nixosTests
 , glib
 , lndir
 , lomiri-system-settings-unwrapped
@@ -60,6 +61,8 @@ stdenvNoCC.mkDerivation (finalAttrs: {
     )
   '';
 
+  passthru.tests.standalone = nixosTests.lomiri-system-settings;
+
   meta = lomiri-system-settings-unwrapped.meta // {
     description = "System Settings application for Lomiri (wrapped)";
     priority = (lomiri-system-settings-unwrapped.meta.priority or 0) - 1;