nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 116 lines 5.3 kB view raw
1{ pkgs, lib, ... }: 2 3{ 4 name = "pantheon"; 5 6 meta.maintainers = lib.teams.pantheon.members; 7 8 nodes.machine = 9 { ... }: 10 11 { 12 imports = [ ./common/user-account.nix ]; 13 14 # Workaround ".gala-wrapped invoked oom-killer" 15 virtualisation.memorySize = 2047; 16 17 services.xserver.enable = true; 18 services.xserver.desktopManager.pantheon.enable = true; 19 20 # We ship pantheon.appcenter by default when this is enabled. 21 services.flatpak.enable = true; 22 23 # We don't ship gnome-text-editor in Pantheon module, we add this line mainly 24 # to catch eval issues related to this option. 25 environment.pantheon.excludePackages = [ pkgs.gnome-text-editor ]; 26 27 environment.systemPackages = [ pkgs.xdotool ]; 28 }; 29 30 enableOCR = true; 31 32 testScript = 33 { nodes, ... }: 34 let 35 user = nodes.machine.users.users.alice; 36 bob = nodes.machine.users.users.bob; 37 in 38 '' 39 machine.wait_for_unit("display-manager.service") 40 41 with subtest("Test we can see usernames in elementary-greeter"): 42 machine.wait_for_text("${user.description}") 43 machine.wait_until_succeeds("pgrep -f io.elementary.greeter-compositor") 44 # OCR was struggling with this one. 45 # machine.wait_for_text("${bob.description}") 46 # Ensure the password box is focused by clicking it. 47 # Workaround for https://github.com/NixOS/nixpkgs/issues/211366. 48 machine.succeed("XAUTHORITY=/var/lib/lightdm/.Xauthority DISPLAY=:0 xdotool mousemove 512 505 click 1") 49 machine.sleep(2) 50 machine.screenshot("elementary_greeter_lightdm") 51 52 with subtest("Login with elementary-greeter"): 53 machine.send_chars("${user.password}\n") 54 machine.wait_for_x() 55 machine.wait_for_file("${user.home}/.Xauthority") 56 machine.succeed("xauth merge ${user.home}/.Xauthority") 57 machine.wait_until_succeeds('journalctl -t gnome-session-binary --grep "Entering running state"') 58 59 with subtest("Check that logging in has given the user ownership of devices"): 60 machine.succeed("getfacl -p /dev/snd/timer | grep -q ${user.name}") 61 62 with subtest("Check if Pantheon components actually start"): 63 for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock", "gsd-media-keys", "io.elementary.desktop.agent-polkit"]: 64 machine.wait_until_succeeds(f"pgrep -f {i}") 65 for i in ["gala", "io.elementary.wingpanel", "io.elementary.dock"]: 66 machine.wait_for_window(i) 67 machine.wait_until_succeeds("pgrep -xf ${pkgs.pantheon.elementary-files}/libexec/io.elementary.files.xdg-desktop-portal") 68 69 with subtest("Check if various environment variables are set"): 70 cmd = "xargs --null --max-args=1 echo < /proc/$(pgrep -xf ${pkgs.pantheon.gala}/bin/gala)/environ" 71 machine.succeed(f"{cmd} | grep 'XDG_CURRENT_DESKTOP' | grep 'Pantheon'") 72 # Hopefully from the sessionPath option. 73 machine.succeed(f"{cmd} | grep 'XDG_DATA_DIRS' | grep 'gsettings-schemas/pantheon-agent-geoclue2'") 74 # Hopefully from login shell. 75 machine.succeed(f"{cmd} | grep '__NIXOS_SET_ENVIRONMENT_DONE' | grep '1'") 76 # Hopefully from gcr-ssh-agent. 77 machine.succeed(f"{cmd} | grep 'SSH_AUTH_SOCK' | grep 'gcr'") 78 79 with subtest("Open elementary videos"): 80 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.videos >&2 &'") 81 machine.sleep(2) 82 machine.wait_for_window("io.elementary.videos") 83 machine.wait_for_text("No Videos Open") 84 85 with subtest("Open elementary calendar"): 86 machine.wait_until_succeeds("pgrep -f evolution-calendar-factory") 87 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.calendar >&2 &'") 88 machine.sleep(2) 89 machine.wait_for_window("io.elementary.calendar") 90 91 with subtest("Open system settings"): 92 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.settings >&2 &'") 93 # Wait for all plugins to be loaded before we check if the window is still there. 94 machine.sleep(5) 95 machine.wait_for_window("io.elementary.settings") 96 97 with subtest("Open elementary terminal"): 98 machine.execute("su - ${user.name} -c 'DISPLAY=:0 io.elementary.terminal >&2 &'") 99 machine.wait_for_window("io.elementary.terminal") 100 101 with subtest("Trigger multitasking view"): 102 cmd = "dbus-send --session --dest=org.pantheon.gala --print-reply /org/pantheon/gala org.pantheon.gala.PerformAction int32:1" 103 env = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus DISPLAY=:0" 104 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 105 machine.sleep(5) 106 machine.screenshot("multitasking") 107 machine.succeed(f"su - ${user.name} -c '{env} {cmd}'") 108 109 with subtest("Check if gala has ever coredumped"): 110 machine.fail("coredumpctl --json=short | grep gala") 111 # So you can see the dock in the below screenshot. 112 machine.succeed("su - ${user.name} -c 'DISPLAY=:0 xdotool mousemove 450 1000 >&2 &'") 113 machine.sleep(10) 114 machine.screenshot("screen") 115 ''; 116}