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 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:

  1. Download the latest version of Squish from froglogic to a location of your choice.

  2. Depending upon the version and system you are using, you will get a file like squish-6.6.2-qt512x-linux64.run.

  3. Make the downloaded file executable by running the following example command:

    sudo chmod +x ./squish-6.6.2-qt512x-linux64.run
  4. Execute the file:

    sudo ./squish-6.6.2-qt512x-linux64.run
  5. 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

  6. After you have entered the license key, Squish opens.

Configure Squish

After installing Squish, follow these steps to configure it:

  1. Close Squish if opened.

  2. Download the PythonChanger.py script and save it in your squish installation folder.

  3. Run the downloaded script.

    sudo python3 PythonChanger.py --force

Some necessary steps before running tests:

  1. Clone the Desktop Client from GitHub

  2. Copy test/gui/config.sample.ini to test/suite_oc-desktop/config.ini

  3. Edit test/gui/config.ini and set BACKEND_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.
  4. Start Squish

  5. Open the existing test-suite via: File  Open Test Suite  test/gui

  6. Go to Edit  Server Settings  Manage AUTs  Mapped AUTs

  7. Click Add and select the compiled binary, e.g.: client/client-build/bin/owncloud

  8. Close any running Desktop Clients by clicking Quit ownCloud in the settings page

  9. Run the AUT (Application under Test) to check if everything works properly via Run  Lauch AUT (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:

  1. Copy server.ini file from test/gui/drone to a new folder called local

  2. Change AUT/owncloud value to "/app/client-build/bin"

  3. 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

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.