nixos/tests/vscodium{,-wayland}: merge tests
This commit is contained in:
parent
6ecb9a352f
commit
7ed2f6e55d
@ -489,7 +489,7 @@ in
|
||||
victoriametrics = handleTest ./victoriametrics.nix {};
|
||||
vikunja = handleTest ./vikunja.nix {};
|
||||
virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
|
||||
vscodium = handleTest ./vscodium.nix {};
|
||||
vscodium = discoverTests (import ./vscodium.nix);
|
||||
wasabibackend = handleTest ./wasabibackend.nix {};
|
||||
wiki-js = handleTest ./wiki-js.nix {};
|
||||
wireguard = handleTest ./wireguard {};
|
||||
|
@ -1,54 +0,0 @@
|
||||
import ./make-test-python.nix ({ pkgs, ...} :
|
||||
|
||||
{
|
||||
name = "vscodium-wayland";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ synthetica ];
|
||||
};
|
||||
|
||||
machine = { ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./common/wayland-cage.nix
|
||||
];
|
||||
|
||||
services.cage.program = ''
|
||||
${pkgs.vscodium}/bin/codium \
|
||||
--enable-features=UseOzonePlatform \
|
||||
--ozone-platform=wayland
|
||||
'';
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
dejavu_fonts
|
||||
];
|
||||
};
|
||||
|
||||
enableOCR = true;
|
||||
|
||||
testScript = { nodes, ... }: ''
|
||||
start_all()
|
||||
machine.wait_for_unit('graphical.target')
|
||||
machine.wait_until_succeeds('pgrep -x codium')
|
||||
|
||||
machine.wait_for_text('VSCodium')
|
||||
machine.screenshot('start_screen')
|
||||
|
||||
test_string = 'testfile'
|
||||
|
||||
machine.send_key('ctrl-n')
|
||||
machine.wait_for_text('Untitled')
|
||||
machine.screenshot('empty_editor')
|
||||
|
||||
machine.send_chars(test_string)
|
||||
machine.wait_for_text(test_string)
|
||||
machine.screenshot('editor')
|
||||
|
||||
machine.send_key('ctrl-s')
|
||||
machine.wait_for_text('Save')
|
||||
machine.screenshot('save_window')
|
||||
|
||||
machine.send_key('ret')
|
||||
machine.wait_for_file(f'/home/alice/{test_string}')
|
||||
'';
|
||||
})
|
@ -1,47 +1,61 @@
|
||||
import ./make-test-python.nix ({ pkgs, ...} :
|
||||
let
|
||||
tests = {
|
||||
vscodium-wayland = { pkgs, ... }: {
|
||||
imports = [ ./common/wayland-cage.nix ];
|
||||
|
||||
{
|
||||
name = "vscodium";
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ turion ];
|
||||
services.cage.program = ''
|
||||
${pkgs.vscodium}/bin/codium \
|
||||
--enable-features=UseOzonePlatform \
|
||||
--ozone-platform=wayland
|
||||
'';
|
||||
|
||||
fonts.fonts = with pkgs; [ dejavu_fonts ];
|
||||
};
|
||||
|
||||
machine = { ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./common/user-account.nix
|
||||
./common/x11.nix
|
||||
];
|
||||
vscodium-xorg = { pkgs, ... }: {
|
||||
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";
|
||||
environment.systemPackages = with pkgs; [
|
||||
vscodium
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
mkTest = name: machine:
|
||||
import ./make-test-python.nix ({ pkgs, ... }: {
|
||||
inherit name machine;
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ synthetica turion ];
|
||||
};
|
||||
enableOCR = true;
|
||||
|
||||
testScript = { nodes, ... }: ''
|
||||
# Start up X
|
||||
testScript = ''
|
||||
start_all()
|
||||
machine.wait_for_x()
|
||||
|
||||
# Start VSCodium with a file that doesn't exist yet
|
||||
machine.fail("ls /home/alice/foo.txt")
|
||||
machine.succeed("su - alice -c 'codium foo.txt' >&2 &")
|
||||
machine.wait_for_unit('graphical.target')
|
||||
machine.wait_until_succeeds('pgrep -x codium')
|
||||
|
||||
# Wait for the window to appear
|
||||
machine.wait_for_text("VSCodium")
|
||||
machine.wait_for_text('VSCodium')
|
||||
machine.screenshot('start_screen')
|
||||
|
||||
# Save file
|
||||
machine.send_key("ctrl-s")
|
||||
test_string = 'testfile'
|
||||
|
||||
# Wait until the file has been saved
|
||||
machine.wait_for_file("/home/alice/foo.txt")
|
||||
machine.send_key('ctrl-n')
|
||||
machine.wait_for_text('Untitled')
|
||||
machine.screenshot('empty_editor')
|
||||
|
||||
machine.screenshot("VSCodium")
|
||||
machine.send_chars(test_string)
|
||||
machine.wait_for_text(test_string)
|
||||
machine.screenshot('editor')
|
||||
|
||||
machine.send_key('ctrl-s')
|
||||
machine.wait_for_text('Save')
|
||||
machine.screenshot('save_window')
|
||||
|
||||
machine.send_key('ret')
|
||||
machine.wait_for_file(f'/home/alice/{test_string}')
|
||||
'';
|
||||
})
|
||||
});
|
||||
|
||||
in builtins.mapAttrs (k: v: mkTest k v { }) tests
|
||||
|
Loading…
Reference in New Issue
Block a user