GUI Testing the Desktop App
Introduction
This document explains how to run GUI tests for the Desktop App locally in your system. To run GUI tests, the Squish GUI Test Automation Tool for all kinds of cross-platform desktop, mobile, embedded and web applications is used.
Prerequisites
Before we can actually run the test, we will need to build a Desktop App and install and configure Squish first.
Before running tests, you need to make sure that you have disabled oauth2 and openidconnect in ownCloud Server.
|
Building the Desktop App
To be able to run tests, you need to build the Desktop App from the latest master.
Prepare Tests
There are two ways to run tests:
You can use docker or Squish IDE to run the tests but if you want to add new test steps use Squish IDE or any other IDE. |
Using Squish IDE
Install Squish IDE
After building the ownCloud Desktop App, install and configure Squish. To install Squish, follow these steps:
-
Download the latest version of Squish from froglogic to a location of your choice.
-
Depending upon the version and system you are using, you will get a file like
squish-x.x.x-qtxxx-x64.run
.
For Desktop Client >= 2.11 and <5, Squish with QT 5.15 is required. |
For Desktop Client >=5, Squish with at least QT 6.2 is required. |
-
Make the downloaded file executable by running the following example command:
sudo chmod +x ./squish-x.x.x-qtxxx-x64.run
-
Execute the file:
sudo ./squish-x.x.x-qtxxx-x64.run
-
You will be asked for a license key. When asked, enter your existing license/url of the license server or get a free trial license
-
After you have entered the license key, Squish opens.
Configure Squish
After installing Squish, follow these steps to configure it:
-
Close Squish if opened.
-
Download the
PythonChanger.py
script and save it in your squish installation folder. -
Run the downloaded script.
sudo python3 PythonChanger.py --force
Some necessary steps before running tests:
-
Clone the Desktop App from GitHub
-
Copy
test/gui/config.sample.ini
totest/gui/config.ini
-
Edit
test/gui/config.ini
and setBACKEND_HOST=
to the URL of your ownCloud server, e.g.BACKEND_HOST=http://localhost/owncloud-core
BACKEND_HOST can be any server, but it is required that the password for the user admin is set to admin. If you are testing against the oCIS server, set OCIS=true in the config.ini. -
Start Squish
-
Open the existing test-suite via:
-
Go to
-
Click Add and select the compiled binary, e.g.:
client/client-build/bin/owncloud
-
Close any running Desktop Apps by clicking Quit ownCloud in the settings page
-
Run the AUT (Application under Test) to check if everything works properly via
(the Desktop App settings window should appear)
If there are problems with starting Squish, please check the log file ~/.squish/squishlibraryx.log.x . Also make sure that the ~/squish-for-qt-6.x.x/etc/paths.ini is user-readable.
|
Using Docker
You can also use the Squish docker image to run tests. Proceed with the following steps:
-
Copy
server.ini
file fromtest/gui/drone
to a new folder calledlocal
-
Change
AUT/owncloud
value to"/app/client-build/bin"
-
Pull the docker image with the following command:
sudo docker pull owncloudci/squish
Run Tests
Run Tests Using Squish
-
Start the owncloud-test-middleware
-
Quit the Desktop App if you have opened it earlier and make sure that Desktop App is not running in the background.
-
Click the play button for a test-case or scenario.
Run Tests Using Docker
-
Start the owncloud-test-middleware
-
Run the Squish docker image using the following command:
docker run --rm --network=host -e LICENSEKEY='YOUR_SQUISH_LICENSE' -e MIDDLEWARE_URL='http://localhost:3000/' -e BACKEND_HOST='http://localhost/owncloud-server/' -e SERVER_INI='/app/test/gui/local/server.ini' -e CLIENT_REPO='/app/' -e SQUISH_PARAMETERS='--retry 1' -v ${PWD}:/app owncloudci/squish:latest
Create New Steps
-
The language used for the tests is basically the same as in other repos. See how to write acceptance tests for more information.
-
Steps that have to go through the test-middleware are named the same way they are named in the middleware but have additionally
on the server
either at the end or in the middle of the sentence.
Object Identification
See object mapping and identification for more details.