2021-11-19 20:21:20 +00:00
|
|
|
let
|
|
|
|
tests = {
|
2021-11-19 22:04:26 +00:00
|
|
|
wayland = { pkgs, ... }: {
|
2021-11-19 20:21:20 +00:00
|
|
|
imports = [ ./common/wayland-cage.nix ];
|
|
|
|
|
|
|
|
services.cage.program = ''
|
|
|
|
${pkgs.vscodium}/bin/codium \
|
|
|
|
--enable-features=UseOzonePlatform \
|
|
|
|
--ozone-platform=wayland
|
|
|
|
'';
|
|
|
|
|
|
|
|
fonts.fonts = with pkgs; [ dejavu_fonts ];
|
|
|
|
};
|
2021-11-19 22:04:26 +00:00
|
|
|
xorg = { pkgs, ... }: {
|
2021-11-19 20:21:20 +00: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 12:54:24 +00:00
|
|
|
};
|
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
mkTest = name: machine:
|
|
|
|
import ./make-test-python.nix ({ pkgs, ... }: {
|
2021-11-19 22:04:26 +00:00
|
|
|
inherit name;
|
|
|
|
|
|
|
|
nodes = { "${name}" = machine; };
|
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
|
|
|
maintainers = [ synthetica turion ];
|
|
|
|
};
|
|
|
|
enableOCR = true;
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
machine.wait_for_unit('graphical.target')
|
|
|
|
machine.wait_until_succeeds('pgrep -x codium')
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 22:04:53 +00:00
|
|
|
machine.wait_for_text('File')
|
2021-11-19 20:21:20 +00:00
|
|
|
machine.screenshot('start_screen')
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
test_string = 'testfile'
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
machine.send_key('ctrl-n')
|
|
|
|
machine.wait_for_text('Untitled')
|
|
|
|
machine.screenshot('empty_editor')
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
machine.send_chars(test_string)
|
|
|
|
machine.wait_for_text(test_string)
|
|
|
|
machine.screenshot('editor')
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
machine.send_key('ctrl-s')
|
|
|
|
machine.wait_for_text('Save')
|
|
|
|
machine.screenshot('save_window')
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
machine.send_key('ret')
|
|
|
|
machine.wait_for_file(f'/home/alice/{test_string}')
|
|
|
|
'';
|
|
|
|
});
|
2021-02-08 12:54:24 +00:00
|
|
|
|
2021-11-19 20:21:20 +00:00
|
|
|
in builtins.mapAttrs (k: v: mkTest k v { }) tests
|