General¶
Flatpak packages are meant to introduce security by disabling access of applications to certain parts of the system. Testing application in the sandbox created by flatpak with Squish means you will need to weaken this protection so that Squish can interact with the application.
This requires that you have full access to the source code of the application, because you will need to rebuild the flatpak package with the required permissions.
Setup¶
In order to allow Squish to connect to the hook in the application you must allow the sandbox access to the network as Squish communicates via TCP/IP with the hook. For this you must add the following part to the finish-args in the build file if not present : "--share=network".
For automation of the application we recommend to use a shell script as your AUT, because you will need to modify the environment for the flatpak sandbox.
The relevant environment variable in this case is LD_LIBRARY_PATH, which is cleaned by the sandbox on start. This is problematic for Squish, because we use the LD_PRELOAD mechanism to load our code in the application process. To enable Squish to hook the application, you must modify your start command as shown below
flatpak run --env=LD_LIBRARY_PATH=$LD_LIBRARY_PATH APP_NAME
the env switch allows you to modify the environment passed to the sandbox. Replace APP_NAME with the identifier of the flatpak package Once these changes are made and the rest of the setup is correct, you will find that Squish is able to connect to the Application like with a regular desktop App when you launch the shell script as your AUT.
This is confirmed working on Ubuntu 24.04 LTS with flatpak 1.14.6