Using VNC to a headless system¶
When automating Squish tests on the macOS operating system it may happen that desktop screenshot as well as object screenshots (via screenshot or visual VP or grabWidget) generate images with wrong rendering. The images show the window contents as white or black only and often the rounded borders of windows are replaced with squares (see the example screenshot below). The same problem appears when using native tools for creating desktop screenshots, like screencapture or the Command+Shift+5 shortcut. We found this issue in macOS 10.13 and 10.14 so far and it affects all editions of Squish where the AUT runs on macOS, so Squish for Qt, Squish for Java, Squish for Web and Squish for macOS.
The cause for this issue seems to be that the affected Mac machines have no physical monitor connected. Connecting a monitor fixes the problem immediately. The problem also occurs when having a VNC connection open to the corresponding system, only a real monitor attached to the machine helps.
In addition to attaching a real monitor there are two other options for fixing or working around this problem:
Use a virtualization technology to setup a virtual machine in which the AUT and tests are being executed. The macOS system running inside the virtual machine is not affected by the lack of a monitor on the host system
Use a hdmi-adapter (if your mac uses HDMI) that emulates a monitor, these are sometimes called ‘headless adapters’ and attach it to the machine
OSX Catalina: First-time use Permissions needed¶
Updating to “OSX Catalina” appears to ‘break’ image search.
You now need to grant accessibility permissions to the “sh” process when before you did not. And the OS dialog that asks the user for permissions is immediately hidden by the screenshot grabbing window of Squish when you do image search, so people can’t see the dialog unless they know it is there and cancel or move out of the way, the image grabbing window.