Merge pull request #155894 from ivanbrennan/xmonad-tests-remove-sleeps

nixosTests.xmonad: avoid sleep()
This commit is contained in:
Lassulus 2022-01-21 11:33:03 +01:00 committed by GitHub
commit 0defcc063b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -52,7 +52,7 @@ let
in {
name = "xmonad";
meta = with pkgs.lib.maintainers; {
maintainers = [ nequissimus ];
maintainers = [ nequissimus ivanbrennan ];
};
machine = { pkgs, ... }: {
@ -90,8 +90,7 @@ in {
# original config has a keybinding that creates somefile
machine.send_key("alt-ctrl-t")
machine.sleep(1)
machine.succeed("stat /tmp/somefile")
machine.wait_for_file("/tmp/somefile")
# set up the new config
machine.succeed("mkdir -p ${user.home}/.xmonad")
@ -103,15 +102,13 @@ in {
# new config has a keybinding that deletes somefile
machine.send_key("alt-ctrl-r")
machine.sleep(1)
machine.fail("stat /tmp/somefile")
machine.wait_until_fails("stat /tmp/somefile", timeout=30)
# restart with the old config, and confirm the old keybinding is back
machine.succeed("rm /tmp/oldXMonad")
machine.send_key("alt-q")
machine.wait_for_file("/tmp/oldXMonad")
machine.send_key("alt-ctrl-t")
machine.sleep(1)
machine.succeed("stat /tmp/somefile")
machine.wait_for_file("/tmp/somefile")
'';
})