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