at 23.05-pre 2.5 kB view raw
1let 2 tests = { 3 wayland = { pkgs, ... }: { 4 imports = [ ./common/wayland-cage.nix ]; 5 6 services.cage.program = "${pkgs.vscodium}/bin/codium"; 7 8 environment.variables.NIXOS_OZONE_WL = "1"; 9 environment.variables.DISPLAY = "do not use"; 10 11 fonts.fonts = with pkgs; [ dejavu_fonts ]; 12 }; 13 xorg = { pkgs, ... }: { 14 imports = [ ./common/user-account.nix ./common/x11.nix ]; 15 16 virtualisation.memorySize = 2047; 17 services.xserver.enable = true; 18 services.xserver.displayManager.sessionCommands = '' 19 ${pkgs.vscodium}/bin/codium 20 ''; 21 test-support.displayManager.auto.user = "alice"; 22 }; 23 }; 24 25 mkTest = name: machine: 26 import ./make-test-python.nix ({ pkgs, ... }: { 27 inherit name; 28 29 nodes = { "${name}" = machine; }; 30 31 meta = with pkgs.lib.maintainers; { 32 maintainers = [ synthetica turion ]; 33 }; 34 enableOCR = true; 35 36 # testScriptWithTypes:55: error: Item "function" of 37 # "Union[Callable[[Callable[..., Any]], ContextManager[Any]], ContextManager[Any]]" 38 # has no attribute "__enter__" 39 # with codium_running: 40 # ^ 41 skipTypeCheck = true; 42 43 testScript = '' 44 @polling_condition 45 def codium_running(): 46 machine.succeed('pgrep -x codium') 47 48 49 start_all() 50 51 machine.wait_for_unit('graphical.target') 52 machine.wait_until_succeeds('pgrep -x codium') 53 54 with codium_running: 55 # Wait until vscodium is visible. "File" is in the menu bar. 56 machine.wait_for_text('Get Started') 57 machine.screenshot('start_screen') 58 59 test_string = 'testfile' 60 61 # Create a new file 62 machine.send_key('ctrl-n') 63 machine.wait_for_text('Untitled') 64 machine.screenshot('empty_editor') 65 66 # Type a string 67 machine.send_chars(test_string) 68 machine.wait_for_text(test_string) 69 machine.screenshot('editor') 70 71 # Save the file 72 machine.send_key('ctrl-s') 73 machine.wait_for_text('(Save|Desktop|alice|Size)') 74 machine.screenshot('save_window') 75 machine.send_key('ret') 76 77 # (the default filename is the first line of the file) 78 machine.wait_for_file(f'/home/alice/{test_string}') 79 80 # machine.send_key('ctrl-q') 81 # machine.wait_until_fails('pgrep -x codium') 82 ''; 83 }); 84 85in 86builtins.mapAttrs (k: v: mkTest k v { }) tests