Features
< Back to Blog Overview

Test your Electron app in the cloud

2024-08-26
Electron Automated Testing
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

We are excited to announce a new upgrade to the TestingBot testing capabilities: TestingBot now supports automated testing for Electron applications in the cloud!

Electron is a framework that lets developers build cross-platform desktop applications using web technologies such as JavaScript, HTML and CSS. It's used by popular apps such as Slack, Visual Studio Code and GitHub Desktop. With Electron, developers can create applications that work seamlessly on both Windows and macOS, while sharing a single codebase.

With this new release, developers and QA can now run automated tests against these native apps, running on remote Windows and macOS machines in the TestingBot cloud. Electron has a tutorial on how to run automated tests with Electron.

Electron Automated Testing Example

To get started, you will need to upload your Electron app to TestingBot Storage and indicate in your Selenium test script which app should should be tested, together with the Electron version.

Indicate which operating system needs to be used and TestingBot will provision a remote machine with your Electron app pre-installed. Please see the Java example below:

Copy code
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.http.ClientConfig;
import org.openqa.selenium.remote.http.HttpClient;
import org.openqa.selenium.remote.http.HttpClient.Factory;

import java.net.URL;
import java.util.Random;

public class SeleniumTest {

    public static void main(String[] args) {
        try {
            DesiredCapabilities caps = new DesiredCapabilities();
            caps.setCapability("browserName", "electron");
            caps.setCapability("platformName", "VENTURA");
            caps.setCapability("browserVersion", "31");
            caps.setCapability("tb:binary_location", "testingbot-electron-demo-app.app/Contents/MacOS/testingbot-electron-demo-app");
            caps.setCapability("tb:app", "https://github.com/testingbot/testingbot-electron-demo-app/releases/download/v1.0.0/testingbot-electron-demo-app-darwin-arm64-1.0.0.zip");

            WebDriver driver = new RemoteWebDriver(
                new URL("https://key:secret@hub.testingbot.com/wd/hub"),
                caps
            );

            // Generate two random numbers between 0 and 9

            Random random = new Random();
            int num1 = random.nextInt(10);
            int num2 = random.nextInt(10);

            WebElement firstNumber = driver.findElement(By.id("btn-" + num1));
            WebElement secondNumber = driver.findElement(By.id("btn-" + num2));
            WebElement plus = driver.findElement(By.id("btn-plus"));
            WebElement equal = driver.findElement(By.id("btn-equal"));

            firstNumber.click();
            plus.click();
            secondNumber.click();
            equal.click();

            WebElement resultElement = driver.findElement(By.id("calc-display"));
            String resultText = resultElement.getText();

            // Verify the result

            if ((num1 + num2) != Integer.parseInt(resultText)) {
                throw new AssertionError("Test failed");
            }

            // Quit the driver

            driver.quit();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Please see the Electron documentation for more information and examples.

Run Electron Tests on Multiple Operating Systems

Your Electron apps might behave differently on various platforms. TestingBot enables you to run your tests on both Windows and macOS environments, ensuring that your application functions as expected across all platforms your users might be on. Electron testing on TestingBot is currently supported on the following operating systems:

  • Windows 11
  • Windows 10
  • macOS Sonoma
  • macOS Ventura
  • macOS Monterey

High Parallel Testing

Speed up your testing process with TestingBot’s high parallel testing capabilities. By running multiple tests simultaneously, you can drastically reduce the time it takes to validate your app across different operating systems. This in turn means faster release cycles and more time to focus on building features, rather than waiting for your tests to complete.

By integrating automated Electron tests with TestingBot into your CI/CD pipeline, you'll accelerate your app releases while ensuring the highest quality for your Electron application.

Detailed Test Reporting

Every Electron test you run on TestingBot comes with a video recording of the test and generated log files, to help you identify and fix issues quickly.

Ready to get started? Sign up for free and start testing your Electron app.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

Selenium WebDriver BiDi

Selenium 4 is the latest version of the widely-used open-source browser testing framework. A new feature introduced in this version is support for ...

Read more
Test your website and mobile apps on iOS 18.

With the preview release of macOS Sequoia testing, TestingBot now also supports running automated, manual and visual tests against iOS 18 Simulator...

Read more
Test on macOS Sequoia

TestingBot now offers macOS Sequoia beta testing for automated, visual and manual tests. This update allows developers to run tests on the upcoming...

Read more
Visual Regression Testing

TestingBot released visual regression testing in Q1 of 2024. With this release, testers can now automatically discover visual defects on their we...

Read more
blank

Today we have added PhantomJS to our Linux VMs on our Selenium Grid. You can now run your WebDriver tests on PhantomJS + Ubuntu. PhantomJS is a he...

Read more
blank

We’re excited to announce that starting from today, our customers can choose to either run their tests on our existing US cloud or on our new Europ...

Read more