diff options
author | Patrick Hilhorst <git@hilhorst.be> | 2021-11-19 21:21:20 +0100 |
---|---|---|
committer | Patrick Hilhorst <git@hilhorst.be> | 2021-11-19 21:21:20 +0100 |
commit | 7ed2f6e55d9b145169b9e2c020daceb15996c3a2 (patch) | |
tree | 704923b070825545be1f7f796a51f4b8d594e38d /nixos/tests/vscodium.nix | |
parent | 6ecb9a352f046013b8d81053678017705a150559 (diff) | |
download | nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.tar nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.tar.gz nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.tar.bz2 nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.tar.lz nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.tar.xz nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.tar.zst nixpkgs-7ed2f6e55d9b145169b9e2c020daceb15996c3a2.zip |
nixos/tests/vscodium{,-wayland}: merge tests
Diffstat (limited to 'nixos/tests/vscodium.nix')
-rw-r--r-- | nixos/tests/vscodium.nix | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/nixos/tests/vscodium.nix b/nixos/tests/vscodium.nix index 033090aa0e3..e217c1ec80f 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 |