1import ./make-test-python.nix ({ pkgs, ...} :
2
3{
4 name = "plasma5";
5 meta = with pkgs.lib.maintainers; {
6 maintainers = [ ttuegel ];
7 };
8
9 machine = { ... }:
10
11 {
12 imports = [ ./common/user-account.nix ];
13 services.xserver.enable = true;
14 services.xserver.displayManager.sddm.enable = true;
15 services.xserver.displayManager.defaultSession = "plasma5";
16 services.xserver.desktopManager.plasma5.enable = true;
17 services.xserver.displayManager.autoLogin = {
18 enable = true;
19 user = "alice";
20 };
21 hardware.pulseaudio.enable = true; # needed for the factl test, /dev/snd/* exists without them but udev doesn't care then
22 virtualisation.memorySize = 1024;
23 };
24
25 testScript = { nodes, ... }: let
26 user = nodes.machine.config.users.users.alice;
27 xdo = "${pkgs.xdotool}/bin/xdotool";
28 in ''
29 with subtest("Wait for login"):
30 start_all()
31 machine.wait_for_file("${user.home}/.Xauthority")
32 machine.succeed("xauth merge ${user.home}/.Xauthority")
33
34 with subtest("Check plasmashell started"):
35 machine.wait_until_succeeds("pgrep plasmashell")
36 machine.wait_for_window("^Desktop ")
37
38 with subtest("Check that KDED is running"):
39 machine.succeed("pgrep kded5")
40
41 with subtest("Check that logging in has given the user ownership of devices"):
42 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}")
43
44 with subtest("Run Dolphin"):
45 machine.execute("su - ${user.name} -c 'DISPLAY=:0.0 dolphin &'")
46 machine.wait_for_window(" Dolphin")
47
48 with subtest("Run Konsole"):
49 machine.execute("su - ${user.name} -c 'DISPLAY=:0.0 konsole &'")
50 machine.wait_for_window("Konsole")
51
52 with subtest("Run systemsettings"):
53 machine.execute("su - ${user.name} -c 'DISPLAY=:0.0 systemsettings5 &'")
54 machine.wait_for_window("Settings")
55
56 with subtest("Wait to get a screenshot"):
57 machine.execute(
58 "${xdo} key Alt+F1 sleep 10"
59 )
60 machine.screenshot("screen")
61 '';
62})