at 25.11-pre 4.2 kB view raw
1import ./make-test-python.nix ( 2 { pkgs, lib, ... }: 3 4 { 5 name = "pantheon-wayland"; 6 7 meta.maintainers = lib.teams.pantheon.members; 8 9 nodes.machine = 10 { nodes, ... }: 11 12 let 13 videosAutostart = pkgs.writeTextFile { 14 name = "autostart-elementary-videos"; 15 destination = "/etc/xdg/autostart/io.elementary.videos.desktop"; 16 text = '' 17 [Desktop Entry] 18 Version=1.0 19 Name=Videos 20 Type=Application 21 Terminal=false 22 Exec=io.elementary.videos %U 23 ''; 24 }; 25 in 26 { 27 imports = [ ./common/user-account.nix ]; 28 29 # Workaround ".gala-wrapped invoked oom-killer" 30 virtualisation.memorySize = 2047; 31 32 services.xserver.enable = true; 33 services.xserver.desktopManager.pantheon.enable = true; 34 services.displayManager = { 35 autoLogin.enable = true; 36 autoLogin.user = nodes.machine.users.users.alice.name; 37 defaultSession = "pantheon-wayland"; 38 }; 39 40 # We ship pantheon.appcenter by default when this is enabled. 41 services.flatpak.enable = true; 42 43 # For basic OCR tests. 44 environment.systemPackages = [ videosAutostart ]; 45 46 # We don't ship gnome-text-editor in Pantheon module, we add this line mainly 47 # to catch eval issues related to this option. 48 environment.pantheon.excludePackages = [ pkgs.gnome-text-editor ]; 49 }; 50 51 enableOCR = true; 52 53 testScript = 54 { nodes, ... }: 55 let 56 user = nodes.machine.users.users.alice; 57 in 58 '' 59 machine.wait_for_unit("display-manager.service") 60 61 with subtest("Wait for wayland server"): 62 machine.wait_for_file("/run/user/${toString user.uid}/wayland-0") 63 64 with subtest("Check that logging in has given the user ownership of devices"): 65 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 66 67 with subtest("Check if Pantheon components actually start"): 68 # We specifically check gsd-xsettings here since it is manually pulled up by gala. 69 # https://github.com/elementary/gala/pull/2140 70 for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock", "gsd-media-keys", "gsd-xsettings", "io.elementary.desktop.agent-polkit"]: 71 machine.wait_until_succeeds(f"pgrep -f {i}") 72 machine.wait_until_succeeds("pgrep -xf ${pkgs.pantheon.elementary-files}/libexec/io.elementary.files.xdg-desktop-portal") 73 74 with subtest("Check if various environment variables are set"): 75 cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ" 76 machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'") 77 machine.succeed(f"{cmd} | grep 'XDG_SESSION_TYPE' | grep 'wayland'") 78 # Hopefully from the sessionPath option. 79 machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'") 80 # Hopefully from login shell. 81 machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE' | grep '1'") 82 83 with subtest("Wait for elementary videos autostart"): 84 machine.wait_until_succeeds("pgrep -f io.elementary.videos") 85 machine.wait_for_text("No Videos Open") 86 machine.screenshot("videos") 87 88 with subtest("Trigger multitasking view"): 89 cmd = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1" 90 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus" 91 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 92 machine.sleep(5) 93 machine.screenshot("multitasking") 94 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 95 96 with subtest("Check if gala has ever coredumped"): 97 machine.fail("coredumpctl --json=short | grep gala") 98 # So we can see the dock. 99 machine.execute("pkill -f -9 io.elementary.videos") 100 machine.sleep(10) 101 machine.screenshot("screen") 102 ''; 103 } 104)