at master 2.6 kB view raw
1{ runTest }: 2let 3 tests = { 4 wayland = 5 { lib, pkgs, ... }: 6 { 7 imports = [ ./common/wayland-cage.nix ]; 8 9 # We scale vscodium to help OCR find the small "Untitled" text. 10 services.cage.program = "${lib.getExe pkgs.vscodium} --force-device-scale-factor=2"; 11 12 environment.variables.NIXOS_OZONE_WL = "1"; 13 environment.variables.DISPLAY = "do not use"; 14 15 fonts.packages = with pkgs; [ dejavu_fonts ]; 16 }; 17 xorg = 18 { lib, pkgs, ... }: 19 { 20 imports = [ 21 ./common/user-account.nix 22 ./common/x11.nix 23 ]; 24 25 virtualisation.memorySize = 2047; 26 services.xserver.enable = true; 27 services.xserver.displayManager.sessionCommands = '' 28 ${lib.getExe pkgs.vscodium} --force-device-scale-factor=2 29 ''; 30 test-support.displayManager.auto.user = "alice"; 31 }; 32 }; 33 34 mkTest = 35 name: machine: 36 runTest ( 37 { lib, ... }: 38 { 39 inherit name; 40 41 nodes."${name}" = machine; 42 43 meta.maintainers = with lib.maintainers; [ 44 synthetica 45 turion 46 ]; 47 48 enableOCR = true; 49 50 testScript = '' 51 @polling_condition 52 def codium_running(): 53 machine.succeed('pgrep -x codium') 54 55 56 start_all() 57 58 machine.wait_for_unit('graphical.target') 59 60 codium_running.wait() # type: ignore[union-attr] 61 with codium_running: # type: ignore[union-attr] 62 # Wait until vscodium is visible. "File" is in the menu bar. 63 machine.wait_for_text('(Get|Started|with|Customize|theme)') 64 machine.screenshot('start_screen') 65 66 test_string = 'testfile' 67 68 # Create a new file 69 machine.send_key('ctrl-n') 70 machine.wait_for_text('(Untitled|Select|language|template|dismiss)') 71 machine.screenshot('empty_editor') 72 73 # Type a string 74 machine.send_chars(test_string) 75 machine.wait_for_text(test_string) 76 machine.screenshot('editor') 77 78 # Save the file 79 machine.send_key('ctrl-s') 80 machine.wait_for_text('(Save|Desktop|alice|Size)') 81 machine.screenshot('save_window') 82 machine.send_key('ret') 83 84 # (the default filename is the first line of the file) 85 machine.wait_for_file(f'/home/alice/{test_string}') 86 87 # machine.send_key('ctrl-q') 88 # machine.wait_until_fails('pgrep -x codium') 89 ''; 90 } 91 ); 92in 93builtins.mapAttrs mkTest tests