Unverified Commit cc660fbc authored by h7x4's avatar h7x4
Browse files

nixos/tests/ringboard: poll for gedit to show up on screen

While polling with `pgrep` earlier, there was a slight chance that the
test might start writing before the application had finished
initializing. Waiting for the actual application to show up on screen
should be a better target for avoiding such a race condition.
parent e70b0cf7
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -17,12 +17,14 @@
    test-support.displayManager.auto.user = "alice";

    services.xserver.displayManager.sessionCommands = ''
      '${lib.getExe pkgs.gedit}' &
      '${lib.getExe pkgs.gedit}' my_document &
    '';

    services.ringboard.x11.enable = true;
  };

  enableOCR = true;

  testScript =
    { nodes, ... }:
    let
@@ -31,7 +33,8 @@
    ''
      @polling_condition
      def gedit_running():
        machine.succeed("pgrep gedit")
        "Check that gedit is running and visible to the user"
        machine.wait_for_text("my_document")

      with subtest("Wait for service startup"):
        machine.wait_for_unit("graphical.target")