macOS has become much stricter in recent releases about privacy-related APIs. Those include accessibility features and access to the microphone, camera or recording the screen itself. The way these permissions are handled during testing with Squish has changed in Squish 6.7.
Apart from the AUT itself Squish also needs some permissions during testing:
- Accessibility API for certain script functions, for example
- “Screen Recording” for screenshots
What changed is how permissions are associated with either Squish or the AUT by macOS. macOS grants permissions only to processes that are launched from an app bundle, e.g. GUI applications. Assume you have a command-line application that takes screenshots. macOS will ask to grant permission for screen recording to Terminal.app instead of your CLI program. The relationship between Squish and the AUT is very similar to this.
Squish Releases Until And Including 6.6¶
Permissions given to the AUT outside of test runs do not apply during testing. Squish launches the AUT just like a command-line application by directly running the executable inside the app bundle. Therefore all permissions required by the AUT need to be granted to Squish IDE, too, since it is the GUI process that launched the AUT.
Squish 6.7 And Newer¶
Squish launches the AUT through
/usr/bin/open, making it a proper GUI process in macOS’s view. As a result, all permissions given to the AUT outside of Squish persist during testing. Permission request dialogs for accessibility and screen recording may still appear on behalf of the AUT. These permissions are needed by the Squish component that is loaded into the AUT process for testing.
Applications that are not an app bundle are unaffected by this change.
Granting Permissions to an Application¶
The process to grant permissions is documented in Apple’s macOS user guide . This article talks about Camera access. Accessibility and Screen Recording can be granted the same way.
When a permission is requested for the first time by an application you will also see a dialog that explains what to do.
Resetting Permissions Given to an Application¶
Permissions given to a specific application can in some cases be revoked via the Privacy pane in macOS System Settings. Some permissions can only be revoked via the command line using
Restoring Pre-6.7 Behavior For App Bundles¶
Squish can be forced to launch an AUT like a console application by registering it in a certain way. If the path to the AUT can be interpreted as an app bundle, Squish will launch the bundle. Otherwise it will treat the AUT as a plain executable.
Assume the AUT is located in
/Applications/MyAUT.app. To force Squish to treat it as a console application the AUT needs to be re-registered with
squishserver like this:
To restore default behavior, simply remove the AUT via Squish IDE and re-register it (Edit -> Server Settings…). Alternatively, this command line does the same: