You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You're absolutely right. It is a visual test that only makes sense when you run it on your own system, and especially if you have 2 or more monitors attached. I don't see any way to actually test this module's features in a CI environment.
Furthermore, and eventhough you are testing in an actual system, it is not recommendable to enforce the results of the modifications made to the monitors (e.g. adding assert sentences), since there are many caveats when dealing with monitors in every platform (for more info, check the Monitor Class section in README.md, if you haven't yet).
In short, it would be a good thing to have a better test environment, but I don't know how in this case.
Well, speaking of caveats: Tests fail if you have no primary monitors! 😆 #13 (comment)
it would be a good thing to have a better test environment, but I don't know how in this case.
We're already using virtual monitors and launching session buses just to have a testable environment. Surely it's possible to design a test suite (at least linux-only) that consists ob spawning subprocesses with their own tailor-made virtual desktop for testing various scenarios.
Though I'll be honest, that's more than I'm willing to throw myself at ^^"
Though I'll be honest, that's more than I'm willing to throw myself at ^^"
Of course! you have gone much further than one could ask for! Thanks a lot for your work and for pointing out all these issues and improvements.
I will try to find a way to improve the tests so they are meaningful. I don't know how CI internally works nor how it manages displays, roots and screens (monitors). So, by the way, do you know if it is possible to configure more screens (monitors) in CI environment? Do you know if there is any information source in relation to this subject I can dig into?
EDIT: Do you know if it is possible to clone the GitHub CI environment locally? This would allow me to tweak everything before uploading anything.
Do you know if it is possible to clone the GitHub CI environment locally?
You could technically replicate the GitHub env (the linux one at least) through docker.
There is information out there about pre-installed software on the runners, and such:
There's also tools that claim being able to run GitHub actions locally (so you can test them in a similar environment and reduce back&forth with CI). This is NOT an endorsement, I've never tried it, but I've seen https://github.com/nektos/act mentioned in blog posts and on stackoverflow.
There's also some VSCode extensions that claim being able to run github actions locally, but VSCode actions have been a minefield of malware recently, so I'll avoid making any recommendations I don't trust.
I just thought of something, if you can't assert expectations (due to wildly different setups the tests can run on), you could use snapshots!
Basically, save all the print outputs from the CI (1 per OS) into a file (the snapshot). Then a CI test can compare its output to ensure it matches the snapshot 1-to-1.
Whenever it differs (due to CI environment update, or due to code change) the CI test would fail. You can review the new output, ensure all code paths are still taken, and replace the snapshot if the new output is correct.
This would at least ensure consistency without having to emulate full environments. (if you change any behavior that results in a different test output, it won't go by unnoticed). And without forcing specific hardcoded values out of the test.
Locally you could create a temporary snapshot file before working on a feature to help spot any diff before it even goes to CI.
That sounds really well, in deed. I'll give it a try as soon as I can. Thank you so much again!
I will also work on the suggestions you made, as well as other minor improvements I detected when reviewing your PRs. This will take some additional time since I will need to deeply test everything before uploading a new version (to be honest, I have to re-build my whole test environment since I don't use it like 2 years ago).
Activity
Kalmat commentedon Jun 24, 2026
You're absolutely right. It is a visual test that only makes sense when you run it on your own system, and especially if you have 2 or more monitors attached. I don't see any way to actually test this module's features in a CI environment.
Furthermore, and eventhough you are testing in an actual system, it is not recommendable to enforce the results of the modifications made to the monitors (e.g. adding
assertsentences), since there are many caveats when dealing with monitors in every platform (for more info, check theMonitor Classsection in README.md, if you haven't yet).In short, it would be a good thing to have a better test environment, but I don't know how in this case.
Avasam commentedon Jun 24, 2026
Well, speaking of caveats: Tests fail if you have no primary monitors! 😆 #13 (comment)
We're already using virtual monitors and launching session buses just to have a testable environment. Surely it's possible to design a test suite (at least linux-only) that consists ob spawning subprocesses with their own tailor-made virtual desktop for testing various scenarios.
Though I'll be honest, that's more than I'm willing to throw myself at ^^"
Kalmat commentedon Jun 25, 2026
Of course! you have gone much further than one could ask for! Thanks a lot for your work and for pointing out all these issues and improvements.
I will try to find a way to improve the tests so they are meaningful. I don't know how CI internally works nor how it manages displays, roots and screens (monitors). So, by the way, do you know if it is possible to configure more screens (monitors) in CI environment? Do you know if there is any information source in relation to this subject I can dig into?
EDIT: Do you know if it is possible to clone the GitHub CI environment locally? This would allow me to tweak everything before uploading anything.
Avasam commentedon Jun 26, 2026
You could technically replicate the GitHub env (the linux one at least) through docker.
There is information out there about pre-installed software on the runners, and such:
There's also tools that claim being able to run GitHub actions locally (so you can test them in a similar environment and reduce back&forth with CI). This is NOT an endorsement, I've never tried it, but I've seen https://github.com/nektos/act mentioned in blog posts and on stackoverflow.
There's also some VSCode extensions that claim being able to run github actions locally, but VSCode actions have been a minefield of malware recently, so I'll avoid making any recommendations I don't trust.
Kalmat commentedon Jun 26, 2026
Thank you!
Avasam commentedon Jun 26, 2026
I just thought of something, if you can't assert expectations (due to wildly different setups the tests can run on), you could use snapshots!
Basically, save all the print outputs from the CI (1 per OS) into a file (the snapshot). Then a CI test can compare its output to ensure it matches the snapshot 1-to-1.
Whenever it differs (due to CI environment update, or due to code change) the CI test would fail. You can review the new output, ensure all code paths are still taken, and replace the snapshot if the new output is correct.
This would at least ensure consistency without having to emulate full environments. (if you change any behavior that results in a different test output, it won't go by unnoticed). And without forcing specific hardcoded values out of the test.
Locally you could create a temporary snapshot file before working on a feature to help spot any diff before it even goes to CI.
Kalmat commentedon Jun 26, 2026
That sounds really well, in deed. I'll give it a try as soon as I can. Thank you so much again!
I will also work on the suggestions you made, as well as other minor improvements I detected when reviewing your PRs. This will take some additional time since I will need to deeply test everything before uploading a new version (to be honest, I have to re-build my whole test environment since I don't use it like 2 years ago).