Search code examples
windowscontinuous-integrationkey-bindings

Simulate keypresses in CI Windows remote machine


I'm currently working on the testing of a GUI app that reacts to keybinds.

Locally, we can run our tests using the python librabry keyboard and everything seems to work fine.

However, when running our CI pipeline, we use Gitlab + remote Windows machine, and no key presses are detected by the app, as if they did not happen.

In the past, we already had an issue opening the application using the CI since there seem to be a Windows limitation that a service can't open application, so we are already using a socket server in the remote machine that launches the starting command for the app and seems that it works. Reference: https://stackoverflow.com/a/72686821/3524896

I figured the same limitation would apply for the keybinds but I came up unsuccessful. Ironically, the keybinds work as expected when launched with the socket server IF I'm connected using the Remote Desktop Connection app from Win11.

Currently, we have the machine configured with autolog so the user session should always be active too.

Given all this info, has anyone any suggestion or idea to make the "simulated keypresses" work?


Solution

  • At the end we managed by not having gitlab-runner as aservice but runnin git directly from a terminal in the remote machine. This way seems to work if no remote session was stablished with the machine, so:

    • Configured the machine to autolog with the desired user and to open a terminal and run gitlab-runner
    • Restart the machine
    • Run the tests and everything works :)

    We even deleted the socket server because in this config, gitlab-runner is capable of opening GUI applications without issues