nixpkgs/nixos/tests/vscodium.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.2 KiB
Nix
Raw Normal View History

let
tests = {
2021-11-19 23:04:26 +01:00
wayland = { pkgs, ... }: {
imports = [ ./common/wayland-cage.nix ];
services.cage.program = "${pkgs.vscodium}/bin/codium";
environment.variables.NIXOS_OZONE_WL = "1";
environment.variables.DISPLAY = "do not use";
fonts.fonts = with pkgs; [ dejavu_fonts ];
};
2021-11-19 23:04:26 +01:00
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";
};
2021-02-08 13:54:24 +01:00
};
mkTest = name: machine:
import ./make-test-python.nix ({ pkgs, ... }: {
2021-11-19 23:04:26 +01:00
inherit name;
nodes = { "${name}" = machine; };
meta = with pkgs.lib.maintainers; {
maintainers = [ synthetica turion ];
};
enableOCR = true;
testScript = ''
@polling_condition
def codium_running():
machine.succeed('pgrep -x codium')
start_all()
2021-02-08 13:54:24 +01:00
machine.wait_for_unit('graphical.target')
machine.wait_until_succeeds('pgrep -x codium')
2021-02-08 13:54:24 +01:00
with codium_running:
# Wait until vscodium is visible. "File" is in the menu bar.
machine.wait_for_text('Get Started')
machine.screenshot('start_screen')
test_string = 'testfile'
2021-02-08 13:54:24 +01:00
# Create a new file
machine.send_key('ctrl-n')
machine.wait_for_text('Untitled')
machine.screenshot('empty_editor')
2021-02-08 13:54:24 +01:00
# Type a string
machine.send_chars(test_string)
machine.wait_for_text(test_string)
machine.screenshot('editor')
2021-02-08 13:54:24 +01:00
# Save the file
machine.send_key('ctrl-s')
machine.wait_for_text('Save')
machine.screenshot('save_window')
machine.send_key('ret')
2021-02-08 13:54:24 +01:00
# (the default filename is the first line of the file)
machine.wait_for_file(f'/home/alice/{test_string}')
2021-11-20 11:26:30 +01:00
machine.send_key('ctrl-q')
machine.wait_until_fails('pgrep -x codium')
'';
});
2021-02-08 13:54:24 +01:00
in
builtins.mapAttrs (k: v: mkTest k v { }) tests