summaryrefslogtreecommitdiffstats
path: root/nixos/tests
diff options
context:
space:
mode:
authorPatrick Hilhorst <git@hilhorst.be>2021-11-19 21:21:20 +0100
committerPatrick Hilhorst <git@hilhorst.be>2021-11-19 21:21:20 +0100
commit7ed2f6e55d9b145169b9e2c020daceb15996c3a2 (patch)
tree704923b070825545be1f7f796a51f4b8d594e38d /nixos/tests
parent6ecb9a352f046013b8d81053678017705a150559 (diff)
nixos/tests/vscodium{,-wayland}: merge tests
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix2
-rw-r--r--nixos/tests/vscodium-wayland.nix54
-rw-r--r--nixos/tests/vscodium.nix88
3 files changed, 52 insertions, 92 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index cd13183ed0a3..b8219416dc42 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -489,7 +489,7 @@ in
victoriametrics = handleTest ./victoriametrics.nix {};
vikunja = handleTest ./vikunja.nix {};
virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
- vscodium = handleTest ./vscodium.nix {};
+ vscodium = discoverTests (import ./vscodium.nix);
wasabibackend = handleTest ./wasabibackend.nix {};
wiki-js = handleTest ./wiki-js.nix {};
wireguard = handleTest ./wireguard {};
diff --git a/nixos/tests/vscodium-wayland.nix b/nixos/tests/vscodium-wayland.nix
deleted file mode 100644
index 1321c8b98274..000000000000
--- a/nixos/tests/vscodium-wayland.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-import ./make-test-python.nix ({ pkgs, ...} :
-
-{
- name = "vscodium-wayland";
- meta = with pkgs.lib.maintainers; {
- maintainers = [ synthetica ];
- };
-
- machine = { ... }:
-
- {
- imports = [
- ./common/wayland-cage.nix
- ];
-
- services.cage.program = ''
- ${pkgs.vscodium}/bin/codium \
- --enable-features=UseOzonePlatform \
- --ozone-platform=wayland
- '';
-
- fonts.fonts = with pkgs; [
- dejavu_fonts
- ];
- };
-
- enableOCR = true;
-
- testScript = { nodes, ... }: ''
- start_all()
- machine.wait_for_unit('graphical.target')
- machine.wait_until_succeeds('pgrep -x codium')
-
- machine.wait_for_text('VSCodium')
- machine.screenshot('start_screen')
-
- test_string = 'testfile'
-
- machine.send_key('ctrl-n')
- machine.wait_for_text('Untitled')
- machine.screenshot('empty_editor')
-
- machine.send_chars(test_string)
- machine.wait_for_text(test_string)
- machine.screenshot('editor')
-
- machine.send_key('ctrl-s')
- machine.wait_for_text('Save')
- machine.screenshot('save_window')
-
- machine.send_key('ret')
- machine.wait_for_file(f'/home/alice/{test_string}')
- '';
-})
diff --git a/nixos/tests/vscodium.nix b/nixos/tests/vscodium.nix
index 033090aa0e3d..e217c1ec80f9 100644
--- a/nixos/tests/vscodium.nix
+++ b/nixos/tests/vscodium.nix
@@ -1,47 +1,61 @@
-import ./make-test-python.nix ({ pkgs, ...} :
-
-{
- name = "vscodium";
- meta = with pkgs.lib.maintainers; {
- maintainers = [ turion ];
+let
+ tests = {
+ vscodium-wayland = { pkgs, ... }: {
+ imports = [ ./common/wayland-cage.nix ];
+
+ services.cage.program = ''
+ ${pkgs.vscodium}/bin/codium \
+ --enable-features=UseOzonePlatform \
+ --ozone-platform=wayland
+ '';
+
+ fonts.fonts = with pkgs; [ dejavu_fonts ];
+ };
+ vscodium-xorg = { pkgs, ... }: {
+ imports = [ ./common/user-account.nix ./common/x11.nix ];
+
+ virtualisation.memorySize = 2047;
+ services.xserver.enable = true;
+ services.xserver.displayManager.sessionCommands = ''
+ ${pkgs.vscodium}/bin/codium
+ '';
+ test-support.displayManager.auto.user = "alice";
+ };
};
- machine = { ... }:
-
- {
- imports = [
- ./common/user-account.nix
- ./common/x11.nix
- ];
+ mkTest = name: machine:
+ import ./make-test-python.nix ({ pkgs, ... }: {
+ inherit name machine;
+ meta = with pkgs.lib.maintainers; {
+ maintainers = [ synthetica turion ];
+ };
+ enableOCR = true;
+ testScript = ''
+ start_all()
- virtualisation.memorySize = 2047;
- services.xserver.enable = true;
- test-support.displayManager.auto.user = "alice";
- environment.systemPackages = with pkgs; [
- vscodium
- ];
- };
+ machine.wait_for_unit('graphical.target')
+ machine.wait_until_succeeds('pgrep -x codium')
- enableOCR = true;
+ machine.wait_for_text('VSCodium')
+ machine.screenshot('start_screen')
- testScript = { nodes, ... }: ''
- # Start up X
- start_all()
- machine.wait_for_x()
+ test_string = 'testfile'
- # Start VSCodium with a file that doesn't exist yet
- machine.fail("ls /home/alice/foo.txt")
- machine.succeed("su - alice -c 'codium foo.txt' >&2 &")
+ machine.send_key('ctrl-n')
+ machine.wait_for_text('Untitled')
+ machine.screenshot('empty_editor')
- # Wait for the window to appear
- machine.wait_for_text("VSCodium")
+ machine.send_chars(test_string)
+ machine.wait_for_text(test_string)
+ machine.screenshot('editor')
- # Save file
- machine.send_key("ctrl-s")
+ machine.send_key('ctrl-s')
+ machine.wait_for_text('Save')
+ machine.screenshot('save_window')
- # Wait until the file has been saved
- machine.wait_for_file("/home/alice/foo.txt")
+ machine.send_key('ret')
+ machine.wait_for_file(f'/home/alice/{test_string}')
+ '';
+ });
- machine.screenshot("VSCodium")
- '';
-})
+in builtins.mapAttrs (k: v: mkTest k v { }) tests