# Squish - How to set it up
## 0. Set up your SSH key
You need an SSH key so that you can use a license of Squish.
Follow these steps: https://hackmd.io/@status-desktop/HkbWpk2e5
## 1. Install Squish
Mac installer: https://status-misc.ams3.digitaloceanspaces.com/squish/squish-6.7.2-qt515x-macx86_64.dmg
Linux installer: https://status-misc.ams3.digitaloceanspaces.com/squish/squish-6.7.2-qt515x-linux64.run
## 2. Open your SSH tunnel
As set up in step 0, start your tunnel with
```
ssh -N -L 49345:localhost:49345 squish-01.infra.status.im
```
You can also create an alias in `~/.ssh/config`:
```
Host squish-01
HostName squish-01.infra.status.im
User <your-username-here>
Port 22
IdentityFile ~/.ssh/id_ed25519
LocalForward 49345 localhost:49345
```
And then use it like this:
```shell
ssh -N squish-01
```
## 3. Open Squish
If the software asks for a license, select "Floating license" and put `localhost:49345` as the license server (this was the whole point of Step 0).
Select Python 3 version.
## 4. Setup Test folder
Once in the app, go to Files > Open Test Suite
Browse to `path/to/status-desktop/test/ui-test/testSuites`
Press Next, then Finish
Then, you'll want to add the Screens and other useful files to Global Scripts on the right panel.
To do that, click the first button on the left on that panel. The button is called `Add an existing directory as a global script directory to Squish` (see image below).

Then browse to `path/to/status-desktop/test/ui-test/src` and click OK.
You also need to add `path/to/status-desktop/test/ui-test/testSuites/global_shared` as a global script directory, so browse to it and click OK, as well.

## 5. Setup AUT settings
This is the last step before Squish can work.
Click the `Test Suite Settings` button next to `suite_status` on the left (see image below)

In the settings, select `AUT` at the bottom of the panel (see image below point 1)

You need to set which application to run in `Application:` (image above point 2).
Just browse to `path/to/status-desktop/bin/nim_status_client` (or whatever the executable is called on your env).
**Linux only**
If you are on Linux, you also need to set up one environemnt variable in the AUT Settings (image above point 3)
It is the `LD_LIBRARY_PATH`. To know exactly what to add there, open the Makefile at the root of the repo in the editing software of your choice and go at the bottom, at the `run-linux` command.
Right after the first echo, you can add:
```
echo "$(QT5_LIBDIR)":"$(STATUSGO_LIBDIR)":"$(STATUSKEYCARDGO_LIBDIR)"
```
This will print the value that is put in `LD_LIBRARY_PATH` when we start the app.
Go ahead and do `make run` in the terminal. It should print the paths just below `Running: bin/nim_status_client`. Copy those paths and add them to the AUT Environement in Squish, with the Key being `LD_LIBRARY_PATH` (again you can refer to the image above, point 3).
## 6. All done :tada:
You can now run Squish.
Try running a test case on the left side panel using the green play button.
Do note that you **cannot** use your mouse while the test runs, since Squish uses the actual mouse pointer to perform the actions on screen.
**Warning**
Squish will overwrite your Status folder so create a backup.
## Final note
We have a limited number of licenses at the moment, so when going to lunch and especially when logging off for the day, make sure to close Squish. Closing the tunnel is not as necessary, but better safe than sorry.
Closing Squish makes sure the license is freed and ready to use by someone else on the team.
Happy testing!
## Troubleshooting
### Empty screen
In case you face an empty screen after starting IDE, click "Maximize":

### Object Not Found popup
In case you are prompted with the following popup, select `Do not show this dialog again. Throw Object Not Found errors right away`. It will not stop the test execution but it will throw the needed exceptions if the object is not found:
