summary refs log tree commit diff
path: root/nixos/tests/vscodium.nix
diff options
context:
space:
mode:
authorManuel Bärenz <programming@manuelbaerenz.de>2021-02-08 13:54:24 +0100
committerManuel Bärenz <programming@manuelbaerenz.de>2021-02-08 13:59:37 +0100
commit10b3773db0582651572088a401510ad486d78826 (patch)
tree91817914aaa0ef46cd9cea90ab410212bcd147b3 /nixos/tests/vscodium.nix
parent3ed5570514429b1d32c59dc4a82e74a249d8818a (diff)
downloadnixpkgs-10b3773db0582651572088a401510ad486d78826.tar
nixpkgs-10b3773db0582651572088a401510ad486d78826.tar.gz
nixpkgs-10b3773db0582651572088a401510ad486d78826.tar.bz2
nixpkgs-10b3773db0582651572088a401510ad486d78826.tar.lz
nixpkgs-10b3773db0582651572088a401510ad486d78826.tar.xz
nixpkgs-10b3773db0582651572088a401510ad486d78826.tar.zst
nixpkgs-10b3773db0582651572088a401510ad486d78826.zip
vscode/vscodium: Add integration test
Diffstat (limited to 'nixos/tests/vscodium.nix')
-rw-r--r--nixos/tests/vscodium.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/nixos/tests/vscodium.nix b/nixos/tests/vscodium.nix
new file mode 100644
index 00000000000..398896540ee
--- /dev/null
+++ b/nixos/tests/vscodium.nix
@@ -0,0 +1,62 @@
+import ./make-test-python.nix ({ pkgs, ...} :
+
+{
+  name = "vscodium";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ turion ];
+  };
+
+  machine = { ... }:
+
+  {
+    imports = [
+      ./common/user-account.nix
+      ./common/x11.nix
+    ];
+
+    virtualisation.memorySize = 2047;
+    services.xserver.enable = true;
+    test-support.displayManager.auto.user = "alice";
+    environment.systemPackages = with pkgs; [
+      vscodium
+    ];
+  };
+
+  enableOCR = true;
+
+  testScript = { nodes, ... }: ''
+    # Start up X
+    start_all()
+    machine.wait_for_x()
+
+    # Create a file that we'll open
+    machine.succeed("su - alice -c 'echo \"   Hello World\" > foo.txt'")
+
+    # It's one line long
+    assert "1 foo.txt" in machine.succeed(
+        "su - alice -c 'wc foo.txt -l'"
+    ), "File has wrong length"
+
+    # Start VSCodium with that file
+    machine.succeed("su - alice -c 'codium foo.txt' &")
+
+    # Wait for the window to appear
+    machine.wait_for_text("VSCodium")
+
+    # Add a line
+    machine.send_key("ret")
+
+    # Save file
+    machine.send_key("ctrl-s")
+
+    # Wait until the file has been saved
+    machine.sleep(1)
+
+    # Now the file is 2 lines long
+    assert "2 foo.txt" in machine.succeed(
+        "su - alice -c 'wc foo.txt -l'"
+    ), "File has wrong length"
+
+    machine.screenshot("VSCodium")
+  '';
+})