summary refs log tree commit diff
path: root/nixos/tests/gnome3.nix
diff options
context:
space:
mode:
authorworldofpeace <worldofpeace@protonmail.ch>2019-08-06 18:24:21 -0400
committerworldofpeace <worldofpeace@protonmail.ch>2019-08-06 20:51:44 -0400
commit5efe51ccc267095d4c43fc7bab6004dd034746a7 (patch)
treee316ebbbfa9a7ba2318bf2b5def51acf48b56826 /nixos/tests/gnome3.nix
parent087c640e1aa8ae9bf06931ebbf31ad4a91ce7293 (diff)
downloadnixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.tar
nixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.tar.gz
nixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.tar.bz2
nixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.tar.lz
nixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.tar.xz
nixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.tar.zst
nixpkgs-5efe51ccc267095d4c43fc7bab6004dd034746a7.zip
nixosTests.gnome3: rename from gnome3-gdm
The actual only difference from the gnome3-xorg
test is that this tests the wayland session.
It's also more accurate to call it just "gnome3"
since wayland is default here.
Diffstat (limited to 'nixos/tests/gnome3.nix')
-rw-r--r--nixos/tests/gnome3.nix64
1 files changed, 64 insertions, 0 deletions
diff --git a/nixos/tests/gnome3.nix b/nixos/tests/gnome3.nix
new file mode 100644
index 00000000000..da95105aeab
--- /dev/null
+++ b/nixos/tests/gnome3.nix
@@ -0,0 +1,64 @@
+import ./make-test.nix ({ pkgs, ...} : {
+  name = "gnome3";
+  meta = with pkgs.stdenv.lib.maintainers; {
+    maintainers = [ lethalman ];
+  };
+
+  machine =
+    { ... }:
+
+    { imports = [ ./common/user-account.nix ];
+
+      services.xserver.enable = true;
+
+      services.xserver.displayManager.gdm = {
+        enable = true;
+        autoLogin = {
+          enable = true;
+          user = "alice";
+        };
+      };
+
+      services.xserver.desktopManager.gnome3.enable = true;
+
+      virtualisation.memorySize = 1024;
+    };
+
+  testScript = let
+    # Keep line widths somewhat managable
+    bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus";
+    gdbus = "${bus} gdbus";
+    # Call javascript in gnome shell, returns a tuple (success, output), where
+    # `success` is true if the dbus call was successful and output is what the
+    # javascript evaluates to.
+    eval = "call --session -d org.gnome.Shell -o /org/gnome/Shell -m org.gnome.Shell.Eval";
+    # False when startup is done
+    startingUp = "${gdbus} ${eval} Main.layoutManager._startingUp";
+    # Hopefully gnome-terminal's wm class
+    wmClass = "${gdbus} ${eval} global.display.focus_window.wm_class";
+  in ''
+      # wait for gdm to start
+      $machine->waitForUnit("display-manager.service");
+
+      # wait for alice to be logged in
+      $machine->waitForUnit("default.target","alice");
+
+      # Check that logging in has given the user ownership of devices.
+      $machine->succeed("getfacl /dev/snd/timer | grep -q alice");
+
+      # Wait for the wayland server
+      $machine->waitForFile("/run/user/1000/wayland-0");
+
+      # Wait for gnome shell, correct output should be "(true, 'false')"
+      $machine->waitUntilSucceeds("su - alice -c '${startingUp} | grep -q true,..false'");
+
+      # open a terminal
+      $machine->succeed("su - alice -c '${bus} gnome-terminal'");
+      # and check it's there
+      $machine->waitUntilSucceeds("su - alice -c '${wmClass} | grep -q gnome-terminal-server'");
+
+      # wait to get a nice screenshot
+      $machine->sleep(20);
+      $machine->screenshot("screen");
+    '';
+})