Skip to content

Commit 3742586

Browse files
authored
nixosTests.lomiri-system-settings: Switch to runTest (#386999)
2 parents c2859e8 + 91be6b3 commit 3742586

File tree

2 files changed

+153
-155
lines changed

2 files changed

+153
-155
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ in {
622622
lomiri-mediaplayer-app = runTest ./lomiri-mediaplayer-app.nix;
623623
lomiri-music-app = runTest ./lomiri-music-app.nix;
624624
lomiri-gallery-app = runTest ./lomiri-gallery-app.nix;
625-
lomiri-system-settings = handleTest ./lomiri-system-settings.nix {};
625+
lomiri-system-settings = runTest ./lomiri-system-settings.nix;
626626
lorri = handleTest ./lorri/default.nix {};
627627
lxqt = handleTest ./lxqt.nix {};
628628
ly = handleTest ./ly.nix {};
Lines changed: 152 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,163 @@
1-
import ./make-test-python.nix (
2-
{ pkgs, lib, ... }:
3-
{
4-
name = "lomiri-system-settings-standalone";
5-
meta.maintainers = lib.teams.lomiri.members;
6-
7-
nodes.machine =
8-
{ config, pkgs, ... }:
9-
{
10-
imports = [
11-
./common/x11.nix
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
1219
];
13-
14-
services.xserver.enable = true;
15-
16-
environment = {
17-
systemPackages = with pkgs.lomiri; [
18-
suru-icon-theme
19-
lomiri-system-settings
20-
];
21-
variables = {
22-
UITK_ICON_THEME = "suru";
23-
};
20+
variables = {
21+
UITK_ICON_THEME = "suru";
2422
};
25-
26-
i18n.supportedLocales = [ "all" ];
27-
28-
fonts.packages = with pkgs; [
29-
# Intended font & helps with OCR
30-
ubuntu-classic
31-
];
32-
33-
services.upower.enable = true;
3423
};
3524

36-
enableOCR = true;
37-
38-
testScript =
39-
let
40-
settingsPages = [
41-
# Base pages
42-
{
43-
name = "wifi";
44-
type = "internal";
45-
element = "networks";
46-
}
47-
{
48-
name = "bluetooth";
49-
type = "internal";
50-
element = "discoverable|None detected";
51-
}
52-
# only text we can really look for with VPN is on a button, OCR on CI struggles with it
53-
{
54-
name = "vpn";
55-
type = "internal";
56-
element = "Add|Manual|Configuration";
57-
skipOCR = true;
58-
}
59-
{
60-
name = "appearance";
61-
type = "internal";
62-
element = "Background image|blur effects";
63-
}
64-
{
65-
name = "desktop";
66-
type = "internal";
67-
element = "workspaces|Icon size";
68-
}
69-
{
70-
name = "sound";
71-
type = "internal";
72-
element = "Silent Mode|Message sound";
73-
}
74-
{
75-
name = "language";
76-
type = "internal";
77-
element = "Display language|External keyboard";
78-
}
79-
{
80-
name = "notification";
81-
type = "internal";
82-
element = "Apps that notify";
83-
}
84-
{
85-
name = "gestures";
86-
type = "internal";
87-
element = "Edge drag";
88-
}
89-
{
90-
name = "mouse";
91-
type = "internal";
92-
element = "Cursor speed|Wheel scrolling speed";
93-
}
94-
{
95-
name = "timedate";
96-
type = "internal";
97-
element = "Time zone|Set the time and date";
98-
}
99-
100-
# External plugins
101-
{
102-
name = "security-privacy";
103-
type = "external";
104-
element = "Locking|unlocking|permissions";
105-
elementLocalised = "Sperren|Entsperren|Berechtigungen";
106-
}
107-
];
108-
in
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.execute("lomiri-system-settings >&2 &")
113+
machine.wait_for_text("System Settings")
114+
machine.screenshot("lss_open")
115+
116+
# Move focus to start of plugins list for following list of tests
117+
machine.send_key("tab")
118+
machine.send_key("tab")
119+
machine.screenshot("lss_focus")
120+
121+
# tab through & open all sub-menus, to make sure none of them fail
122+
''
123+
+ (lib.strings.concatMapStringsSep "\n" (
124+
page:
125+
''
126+
machine.send_key("tab")
127+
machine.send_key("kp_enter")
128+
''
129+
+ lib.optionalString (!(page.skipOCR or false)) ''
130+
with subtest("lomiri system settings ${page.name} works"):
131+
machine.wait_for_text(r"(${page.element})")
132+
machine.screenshot("lss_page_${page.name}")
109133
''
110-
machine.wait_for_x()
134+
) settingsPages)
135+
+ ''
111136
112-
with subtest("lomiri system settings launches"):
113-
machine.execute("lomiri-system-settings >&2 &")
114-
machine.wait_for_text("System Settings")
115-
machine.screenshot("lss_open")
137+
machine.execute("pkill -f lomiri-system-settings")
116138
117-
# Move focus to start of plugins list for following list of tests
118-
machine.send_key("tab")
119-
machine.send_key("tab")
120-
machine.screenshot("lss_focus")
139+
with subtest("lomiri system settings localisation works"):
140+
machine.execute("env LANG=de_DE.UTF-8 lomiri-system-settings >&2 &")
141+
machine.wait_for_text("Systemeinstellungen")
142+
machine.screenshot("lss_localised_open")
121143
122-
# tab through & open all sub-menus, to make sure none of them fail
144+
# Move focus to start of plugins list for following list of tests
145+
machine.send_key("tab")
146+
machine.send_key("tab")
147+
machine.screenshot("lss_focus_localised")
148+
149+
''
150+
+ (lib.strings.concatMapStringsSep "\n" (
151+
page:
123152
''
124-
+ (lib.strings.concatMapStringsSep "\n" (
125-
page:
126-
''
127-
machine.send_key("tab")
128-
machine.send_key("kp_enter")
129-
''
130-
+ lib.optionalString (!(page.skipOCR or false)) ''
131-
with subtest("lomiri system settings ${page.name} works"):
132-
machine.wait_for_text(r"(${page.element})")
133-
machine.screenshot("lss_page_${page.name}")
134-
''
135-
) settingsPages)
136-
+ ''
137-
138-
machine.execute("pkill -f lomiri-system-settings")
139-
140-
with subtest("lomiri system settings localisation works"):
141-
machine.execute("env LANG=de_DE.UTF-8 lomiri-system-settings >&2 &")
142-
machine.wait_for_text("Systemeinstellungen")
143-
machine.screenshot("lss_localised_open")
144-
145-
# Move focus to start of plugins list for following list of tests
146-
machine.send_key("tab")
147153
machine.send_key("tab")
148-
machine.screenshot("lss_focus_localised")
149-
154+
machine.send_key("kp_enter")
155+
''
156+
+ lib.optionalString (page.type == "external") ''
157+
with subtest("lomiri system settings ${page.name} localisation works"):
158+
machine.wait_for_text(r"(${page.elementLocalised})")
159+
machine.screenshot("lss_localised_page_${page.name}")
150160
''
151-
+ (lib.strings.concatMapStringsSep "\n" (
152-
page:
153-
''
154-
machine.send_key("tab")
155-
machine.send_key("kp_enter")
156-
''
157-
+ lib.optionalString (page.type == "external") ''
158-
with subtest("lomiri system settings ${page.name} localisation works"):
159-
machine.wait_for_text(r"(${page.elementLocalised})")
160-
machine.screenshot("lss_localised_page_${page.name}")
161-
''
162-
) settingsPages)
163-
+ '''';
164-
}
165-
)
161+
) settingsPages)
162+
+ '''';
163+
}

0 commit comments

Comments
 (0)