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 run the test, we will need to build the Desktop App from source or install the existing one and configure Squish first.

Install python 3.10 along with some modules required for running Squish tests:

  1. requests

  2. pywin32 (required for Windows only)

Before running tests, you need to make sure that you have disabled oauth2 and openidconnect in ownCloud Server.

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

To install Squish, follow these steps:

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

  2. Depending on the version and system you are using, you will get a file like squish-x.x.x-qtxxx-x64.run or squish-x.x.x-qtxxx-x64.exe.

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.
Ensure that Squish supports the QT version that was used to build the Desktop App.
  1. [Linux only] Make the downloaded file executable by running the following example command:

    sudo chmod +x ./squish-x.x.x-qtxxx-x64.run
  2. Run the Squish installer.

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

  4. 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 App from GitHub

  2. Copy test/gui/config.sample.ini to test/gui/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.
    If you are testing against the oCIS server, set OCIS=true in the config.ini.
  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 executable file, e.g.: client/client-build/bin/owncloud or <owncloud-installation-path>/owncloud.exe

  8. Close any running Desktop Apps 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 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-installation-path>/etc/paths.ini is user-readable.
Extra Steps for Infinite Scale or ownCloud Server with Oauth2

While running the tests against Infinite Scale, playwright is used to automate the login process in the browser. The following extra steps need to be taken:

  1. Install node and pnpm

  2. Go to test/gui/webUI and run

    pnpm install
  3. Install Playwright Chromium

    npx playwright install chromium

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