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