tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
nixosTests.cinnamon: Extend the test
Bobby Rong
2 years ago
2408e613
dfcfab99
+38
-22
1 changed file
expand all
collapse all
unified
split
nixos
tests
cinnamon.nix
+38
-22
nixos/tests/cinnamon.nix
···
14
14
testScript = { nodes, ... }:
15
15
let
16
16
user = nodes.machine.users.users.alice;
17
17
-
uid = toString user.uid;
18
18
-
bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus";
19
19
-
display = "DISPLAY=:0.0";
20
20
-
env = "${bus} ${display}";
21
21
-
gdbus = "${env} gdbus";
17
17
+
env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0";
22
18
su = command: "su - ${user.name} -c '${env} ${command}'";
23
19
24
20
# Call javascript in cinnamon (the shell), returns a tuple (success, output),
25
21
# where `success` is true if the dbus call was successful and `output` is what
26
22
# the javascript evaluates to.
27
27
-
eval = "call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval";
28
28
-
29
29
-
# Should be 2 (RunState.RUNNING) when startup is done.
30
30
-
# https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187
31
31
-
getRunState = su "${gdbus} ${eval} Main.runState";
32
32
-
33
33
-
# Start gnome-terminal.
34
34
-
gnomeTerminalCommand = su "gnome-terminal";
35
35
-
36
36
-
# Hopefully gnome-terminal's wm class.
37
37
-
wmClass = su "${gdbus} ${eval} global.display.focus_window.wm_class";
23
23
+
eval = name: su "gdbus call --session -d org.Cinnamon -o /org/Cinnamon -m org.Cinnamon.Eval ${name}";
38
24
in
39
25
''
40
26
machine.wait_for_unit("display-manager.service")
···
54
40
55
41
with subtest("Wait for the Cinnamon shell"):
56
42
# Correct output should be (true, '2')
57
57
-
machine.wait_until_succeeds("${getRunState} | grep -q 'true,..2'")
43
43
+
# https://github.com/linuxmint/cinnamon/blob/5.4.0/js/ui/main.js#L183-L187
44
44
+
machine.wait_until_succeeds("${eval "Main.runState"} | grep -q 'true,..2'")
45
45
+
46
46
+
with subtest("Check if Cinnamon components actually start"):
47
47
+
for i in ["csd-media-keys", "cinnamon-killer-daemon", "xapp-sn-watcher", "nemo-desktop"]:
48
48
+
machine.wait_until_succeeds(f"pgrep -f {i}")
49
49
+
machine.wait_until_succeeds("journalctl -b --grep 'Loaded applet menu@cinnamon.org'")
50
50
+
machine.wait_until_succeeds("journalctl -b --grep 'calendar@cinnamon.org: Calendar events supported'")
51
51
+
52
52
+
with subtest("Open Cinnamon Settings"):
53
53
+
machine.succeed("${su "cinnamon-settings themes >&2 &"}")
54
54
+
machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'cinnamon-settings'")
55
55
+
machine.wait_for_text('(Style|Appearance|Color)')
56
56
+
machine.sleep(2)
57
57
+
machine.screenshot("cinnamon_settings")
58
58
+
59
59
+
with subtest("Lock the screen"):
60
60
+
machine.succeed("${su "cinnamon-screensaver-command -l >&2 &"}")
61
61
+
machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is active'")
62
62
+
machine.sleep(2)
63
63
+
machine.screenshot("cinnamon_screensaver")
64
64
+
machine.send_chars("${user.password}\n", delay=0.2)
65
65
+
machine.wait_until_succeeds("${su "cinnamon-screensaver-command -q"} | grep 'The screensaver is inactive'")
66
66
+
machine.sleep(2)
58
67
59
68
with subtest("Open GNOME Terminal"):
60
60
-
machine.succeed("${gnomeTerminalCommand}")
61
61
-
# Correct output should be (true, '"Gnome-terminal"')
62
62
-
machine.wait_until_succeeds("${wmClass} | grep -q 'true,...Gnome-terminal'")
63
63
-
machine.sleep(20)
64
64
-
machine.screenshot("screen")
69
69
+
machine.succeed("${su "gnome-terminal"}")
70
70
+
machine.wait_until_succeeds("${eval "global.display.focus_window.wm_class"} | grep -i 'gnome-terminal'")
71
71
+
machine.sleep(2)
72
72
+
73
73
+
with subtest("Open virtual keyboard"):
74
74
+
machine.succeed("${su "dbus-send --print-reply --dest=org.Cinnamon /org/Cinnamon org.Cinnamon.ToggleKeyboard"}")
75
75
+
machine.wait_for_text('(Ctrl|Alt)')
76
76
+
machine.sleep(2)
77
77
+
machine.screenshot("cinnamon_virtual_keyboard")
78
78
+
79
79
+
with subtest("Check if Cinnamon has ever coredumped"):
80
80
+
machine.fail("coredumpctl --json=short | grep -E 'cinnamon|nemo'")
65
81
'';
66
82
})