GUI Testing the Desktop Client
Introduction
This document explains how to run GUI tests for the Desktop Client 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 make a Desktop Client build 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 Client
To be able to run tests, you need to build the Desktop Client 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 Client, 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-6.6.2-qt512x-linux64.run
. -
Make the downloaded file executable by running the following example command:
sudo chmod +x ./squish-6.6.2-qt512x-linux64.run
-
Execute the file:
sudo ./squish-6.6.2-qt512x-linux64.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 Client from GitHub
-
Copy
test/gui/config.sample.ini
totest/suite_oc-desktop/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 toadmin
. -
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 Clients by clicking Quit ownCloud in the settings page
-
Run the AUT (Application under Test) to check if everything works properly via
(the Desktop Client 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
Before running middleware, install yarn following the instructions from here and clone middleware from here. |
Run Tests Using Squish
-
Start the owncloud-test-middleware
-
Quit the desktop client if you have opened it earlier and make sure that desktop-client 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:qt512
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.