1{ pkgs, lib, ... }:
2{
3 name = "lomiri-system-settings-standalone";
4 meta.maintainers = lib.teams.lomiri.members;
5
6 nodes.machine =
7 { config, pkgs, ... }:
8 {
9 imports = [
10 ./common/x11.nix
11 ];
12
13 services.xserver.enable = true;
14
15 environment = {
16 systemPackages = with pkgs.lomiri; [
17 suru-icon-theme
18 lomiri-system-settings
19 ];
20 variables = {
21 UITK_ICON_THEME = "suru";
22 };
23 };
24
25 i18n.supportedLocales = [ "all" ];
26
27 fonts.packages = with pkgs; [
28 # Intended font & helps with OCR
29 ubuntu-classic
30 ];
31
32 services.upower.enable = true;
33 };
34
35 enableOCR = true;
36
37 testScript =
38 let
39 settingsPages = [
40 # Base pages
41 {
42 name = "wifi";
43 type = "internal";
44 element = "networks";
45 }
46 {
47 name = "bluetooth";
48 type = "internal";
49 element = "discoverable|None detected";
50 }
51 # only text we can really look for with VPN is on a button, OCR on CI struggles with it
52 {
53 name = "vpn";
54 type = "internal";
55 element = "Add|Manual|Configuration";
56 skipOCR = true;
57 }
58 {
59 name = "appearance";
60 type = "internal";
61 element = "Background image|blur effects";
62 }
63 {
64 name = "desktop";
65 type = "internal";
66 element = "workspaces|Icon size";
67 }
68 {
69 name = "sound";
70 type = "internal";
71 element = "Silent Mode|Message sound";
72 }
73 {
74 name = "language";
75 type = "internal";
76 element = "Display language|External keyboard";
77 }
78 {
79 name = "notification";
80 type = "internal";
81 element = "Apps that notify";
82 }
83 {
84 name = "gestures";
85 type = "internal";
86 element = "Edge drag";
87 }
88 {
89 name = "mouse";
90 type = "internal";
91 element = "Cursor speed|Wheel scrolling speed";
92 }
93 {
94 name = "timedate";
95 type = "internal";
96 element = "Time zone|Set the time and date";
97 }
98
99 # External plugins
100 {
101 name = "security-privacy";
102 type = "external";
103 element = "Locking|unlocking|permissions";
104 elementLocalised = "Sperren|Entsperren|Berechtigungen";
105 }
106 ];
107 in
108 ''
109 machine.wait_for_x()
110
111 with subtest("lomiri system settings launches"):
112 machine.succeed("lomiri-system-settings >&2 &")
113 machine.wait_for_console_text("qml: Plugin about does not exist")
114 machine.sleep(10)
115 machine.send_key("alt-f10")
116 machine.sleep(5)
117 machine.wait_for_text("System Settings")
118 machine.screenshot("lss_open")
119
120 # Move focus to start of plugins list for following list of tests
121 machine.send_key("tab")
122 machine.send_key("tab")
123 machine.screenshot("lss_focus")
124
125 # tab through & open all sub-menus, to make sure none of them fail
126 ''
127 + (lib.strings.concatMapStringsSep "\n" (
128 page:
129 ''
130 machine.send_key("tab")
131 machine.send_key("kp_enter")
132 ''
133 + lib.optionalString (!(page.skipOCR or false)) ''
134 with subtest("lomiri system settings ${page.name} works"):
135 machine.wait_for_text(r"(${page.element})")
136 machine.screenshot("lss_page_${page.name}")
137 ''
138 ) settingsPages)
139 + ''
140
141 machine.execute("pkill -f lomiri-system-settings")
142
143 with subtest("lomiri system settings localisation works"):
144 machine.succeed("env LANG=de_DE.UTF-8 lomiri-system-settings >&2 &")
145 machine.wait_for_console_text("qml: Plugin about does not exist")
146 machine.sleep(10)
147 machine.send_key("alt-f10")
148 machine.sleep(5)
149 machine.wait_for_text("Systemeinstellungen")
150 machine.screenshot("lss_localised_open")
151
152 # Move focus to start of plugins list for following list of tests
153 machine.send_key("tab")
154 machine.send_key("tab")
155 machine.screenshot("lss_focus_localised")
156
157 ''
158 + (lib.strings.concatMapStringsSep "\n" (
159 page:
160 ''
161 machine.send_key("tab")
162 machine.send_key("kp_enter")
163 ''
164 + lib.optionalString (page.type == "external") ''
165 with subtest("lomiri system settings ${page.name} localisation works"):
166 machine.wait_for_text(r"(${page.elementLocalised})")
167 machine.screenshot("lss_localised_page_${page.name}")
168 ''
169 ) settingsPages)
170 + '''';
171}