summary refs log tree commit diff
diff options
context:
space:
mode:
authorTim Steinbach <tim@nequissimus.com>2020-11-28 12:42:10 -0500
committerTim Steinbach <tim@nequissimus.com>2020-11-28 12:43:17 -0500
commit0dc74a15ad55f0882895319eb16b0aa9a9f4f82d (patch)
treeaf5c1dd2fa3a9ef05c1864bf65aa828410b9ee9e
parenteb2a3a040cefc6649a117925832b23059fc79b7c (diff)
downloadnixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.tar
nixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.tar.gz
nixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.tar.bz2
nixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.tar.lz
nixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.tar.xz
nixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.tar.zst
nixpkgs-0dc74a15ad55f0882895319eb16b0aa9a9f4f82d.zip
minecraft: Add test
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/minecraft.nix28
-rw-r--r--pkgs/games/minecraft/default.nix6
3 files changed, 34 insertions, 1 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 771ee9bdbd3..f6c0c248392 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -208,6 +208,7 @@ in
   mediawiki = handleTest ./mediawiki.nix {};
   memcached = handleTest ./memcached.nix {};
   metabase = handleTest ./metabase.nix {};
+  minecraft = handleTest ./minecraft.nix {};
   miniflux = handleTest ./miniflux.nix {};
   minio = handleTest ./minio.nix {};
   minidlna = handleTest ./minidlna.nix {};
diff --git a/nixos/tests/minecraft.nix b/nixos/tests/minecraft.nix
new file mode 100644
index 00000000000..e0c35f2d276
--- /dev/null
+++ b/nixos/tests/minecraft.nix
@@ -0,0 +1,28 @@
+import ./make-test-python.nix ({ pkgs, lib, ... }: {
+  name = "minecraft";
+  meta = with lib.maintainers; { maintainers = [ nequissimus ]; };
+
+  nodes.client = { nodes, ... }:
+      let user = nodes.client.config.users.users.alice;
+      in {
+        imports = [ ./common/user-account.nix ./common/x11.nix ];
+
+        environment.systemPackages = [ pkgs.minecraft ];
+
+        nixpkgs.config.allowUnfree = true;
+
+        test-support.displayManager.auto.user = user.name;
+      };
+
+  enableOCR = true;
+
+  testScript = { nodes, ... }:
+    let user = nodes.client.config.users.users.alice;
+    in ''
+      client.wait_for_x()
+      client.execute("su - alice -c minecraft-launcher &")
+      client.wait_for_text("CONTINUE WITHOUT LOGIN")
+      client.sleep(10)
+      client.screenshot("launcher")
+    '';
+})
diff --git a/pkgs/games/minecraft/default.nix b/pkgs/games/minecraft/default.nix
index 7ef2f533476..1b4cf319721 100644
--- a/pkgs/games/minecraft/default.nix
+++ b/pkgs/games/minecraft/default.nix
@@ -1,5 +1,6 @@
 { stdenv
 , fetchurl
+, nixosTests
 , makeDesktopItem
 , makeWrapper
 , wrapGAppsHook
@@ -147,5 +148,8 @@ stdenv.mkDerivation rec {
     platforms = [ "x86_64-linux" ];
   };
 
-  passthru.updateScript = ./update.sh;
+  passthru = {
+    tests = { inherit (nixosTests) minecraft; };
+    updateScript = ./update.sh;
+  };
 }