back
Avatar of Daniel Rieth
Author: Daniel Rieth
07. May 2020

Fantastic Electron apps - and how to test them

Many developers - 72% according to a survey from stackoverflow  (german version) - are specialized in web development. Web technologies are widely spread and supported by basically all operating systems. They provide a huge range of frameworks to the developers. This doesn’t make desktop applications obsolete. Why not use existing resources from the web for local applications? As the headline states there is already a solution for this: Electron.

Electron is a framework for executing cross-platform desktop applications using the web browser Chromium and the Node.js framework.

Further information

Almost every user knows or uses Electron apps. Popular apps like Skype, Microsoft Visual Studio Code or Discord are built using the Electron framework. Electron origins from GitHubs well known editor Atom which gave it its initial name „Atom Shell“. The idea of GitHub was to combine the browserless „Node.js“ framework with the Chromium rendering engine. This provides an easy and fast way to create desktop apps out of existing web apps. Except for the initial download there is no need for an network connection.

Apps can now be developed using web technologies like HTML, CSS and JavaScript. This enables apps to be developed OS independent which makes them easier to maintain. Even on the code base it is quite easy to handle native functions like menus, notifications, access to the file system and also some low-level informations about the hardware.

The best summary for the framework comes from the official site:  "It takes care of the hard parts so you can focus on the core of your application."

But I don’t write this to sing the praises of Electron - of course I want to mention that QF-Test supports testing of Electron apps since version 4.5 and I want to give a quick introduction.

The basic concept is still the same. The best way to connect to an Electron app is by using our Quickstart Wizard (Menu: Extras → Quickstart Wizard). Then select "An Electron application" and on the next page you select the app you want to test plus option command line parameters.

The next step is to specify the ChromeDriver. You can either choose the correct Electron version or let QF-Test detect it so you know what ChromeDriver version you need. QF-Test can then automatically download the ChromeDriver.

Electron provides all features already known from the web. Additionally native menus can be controlled by a Selection step (Insert->Event  nodes->Selection). The syntax looks like this:

To be able to control this functionality QF-Test has to get access to the Electron API. This means that the following values (currently default) inside the BrowserWindow should not be changed.

mainWindow = new BrowserWindow({

      webPreferences: {

            enableRemoteModule: true,

            contextIsolation: false,

            nodeIntegration: true

      }

})

Please try it yourself and test your own app! If you only have an older version of QF-Test (<4.5) you can get the latest version for free from this site and evaluate it

Free trial

New comment
( Will be displayed on the page )
( Will not be displayed on the page )

0 comments

You have new topics in mind?
Please share them with us via blog@remove-this.qfs.de or within the comments.

Subscribe for new blog posts

Data protection