1let
2 tests = {
3 wayland = { pkgs, ... }: {
4 imports = [ ./common/wayland-cage.nix ];
5
6 services.cage.program = ''
7 ${pkgs.vscodium}/bin/codium \
8 --enable-features=UseOzonePlatform \
9 --ozone-platform=wayland
10 '';
11
12 fonts.fonts = with pkgs; [ dejavu_fonts ];
13 };
14 xorg = { pkgs, ... }: {
15 imports = [ ./common/user-account.nix ./common/x11.nix ];
16
17 virtualisation.memorySize = 2047;
18 services.xserver.enable = true;
19 services.xserver.displayManager.sessionCommands = ''
20 ${pkgs.vscodium}/bin/codium
21 '';
22 test-support.displayManager.auto.user = "alice";
23 };
24 };
25
26 mkTest = name: machine:
27 import ./make-test-python.nix ({ pkgs, ... }: {
28 inherit name;
29
30 nodes = { "${name}" = machine; };
31
32 meta = with pkgs.lib.maintainers; {
33 maintainers = [ synthetica turion ];
34 };
35 enableOCR = true;
36 testScript = ''
37 start_all()
38
39 machine.wait_for_unit('graphical.target')
40 machine.wait_until_succeeds('pgrep -x codium')
41
42 # Wait until vscodium is visible. "File" is in the menu bar.
43 machine.wait_for_text('File')
44 machine.screenshot('start_screen')
45
46 test_string = 'testfile'
47
48 # Create a new file
49 machine.send_key('ctrl-n')
50 machine.wait_for_text('Untitled')
51 machine.screenshot('empty_editor')
52
53 # Type a string
54 machine.send_chars(test_string)
55 machine.wait_for_text(test_string)
56 machine.screenshot('editor')
57
58 # Save the file
59 machine.send_key('ctrl-s')
60 machine.wait_for_text('Save')
61 machine.screenshot('save_window')
62 machine.send_key('ret')
63
64 # (the default filename is the first line of the file)
65 machine.wait_for_file(f'/home/alice/{test_string}')
66 '';
67 });
68
69in builtins.mapAttrs (k: v: mkTest k v { }) tests