From 1e791ad33849b10508321a10fa6b2319552f7721 Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Fri, 19 Jan 2024 14:51:43 -0500 Subject: [PATCH] try gnome --- tests/kolide-launcher.nix | 69 ++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/tests/kolide-launcher.nix b/tests/kolide-launcher.nix index 423eb35..b3e7843 100644 --- a/tests/kolide-launcher.nix +++ b/tests/kolide-launcher.nix @@ -23,16 +23,33 @@ pkgs.nixosTest { uid = 1000; }; + # Add Gnome extensions + environment.systemPackages = with pkgs; [ + gnomeExtensions.appindicator + gnome.adwaita-icon-theme + ]; + services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ]; + services.xserver.enable = true; services.xserver.displayManager = { - lightdm.enable = true; + gdm.enable = true; + gdm.debug = true; autoLogin = { enable = true; user = "alice"; }; }; - services.xserver.desktopManager.mate.enable = true; - services.xserver.desktopManager.mate.debug = true; + services.xserver.desktopManager.gnome.enable = true; + systemd.user.services = { + "org.gnome.Shell@wayland" = { + serviceConfig = { + ExecStart = [ + "" + "${pkgs.gnome.gnome-shell}/bin/gnome-shell --unsafe-mode" + ]; + }; + }; + }; # This just quiets some log spam we don't care about hardware.pulseaudio.enable = true; @@ -47,26 +64,46 @@ pkgs.nixosTest { let user = nodes.machine.users.users.alice; uid = toString user.uid; - xauthority = "${user.home}/.Xauthority"; + # xauthority = "${user.home}/.Xauthority"; ci = builtins.getEnv "CI"; + + bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus"; + run = command: "su - ${user.name} -c '${bus} ${command}'"; + eval = command: run "gdbus call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval ${command}"; + startingUp = eval "Main.layoutManager._startingUp"; + launchConsole = run "gapplication launch org.gnome.Console"; + wmClass = eval "global.display.focus_window.wm_class"; in '' if "${ci}": machine.start() - with subtest("log in to MATE"): - machine.wait_for_unit("display-manager.service", timeout=120) - machine.wait_for_file("${xauthority}") - machine.succeed("xauth merge ${xauthority}") - machine.wait_until_succeeds("pgrep marco") - machine.wait_for_window("marco") - machine.wait_until_succeeds("pgrep mate-panel") - machine.wait_for_window("Top Panel") - machine.wait_for_window("Bottom Panel") - machine.wait_until_succeeds("pgrep caja") - machine.wait_for_window("Caja") + with subtest("log in to GNOME"): + machine.wait_for_unit("display-manager.service") + machine.wait_for_file("/run/user/${uid}/wayland-0") + machine.wait_for_unit("default.target", "${user.name}") + assert "alice" in machine.succeed("getfacl -p /dev/snd/timer") + + with subtest("wait for GNOME Shell"): + machine.wait_until_succeeds( + "${startingUp} | grep -q 'true,..false'" + ) + machine.screenshot("test-1.png") + + with subtest("open console"): + machine.send_key("esc") + machine.succeed( + "${launchConsole}" + ) + machine.wait_until_succeeds( + "${wmClass} | grep -q 'true,...org.gnome.Console'" + ) machine.sleep(20) - machine.screenshot("test-screen1.png") + machine.screenshot("test-2.png") + + with subtest("enable appindicator extension"): + machine.succeed("${run "gnome-extensions enable appindicatorsupport@rgcjonas.gmail.com"}") + machine.screenshot("test-3.png") with subtest("set up secret file"): machine.copy_from_host("${./test-secret}", "/etc/kolide-k2/secret")