Socket
Socket
Sign inDemoInstall

wdio-electron-service

Package Overview
Dependencies
10
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

wdio-electron-service

WebdriverIO service to enable Electron testing


Version published
Maintainers
1
Created

Readme

Source

WDIO Electron Service

WebdriverIO service for testing Electron applications

Enables cross-platform E2E testing of Electron apps via the extensive WebdriverIO ecosystem.

Spiritual successor to Spectron (RIP).

Features

Using the service makes testing Electron applications much easier:

  • 🚗 auto-setup of required Chromedriver
  • 📦 automatic path detection of your Electron application - supports Electron Forge and Electron Builder
  • 🧩 access Electron APIs within your tests
  • 🕵️ mocking of Electron APIs via a Vitest-like API

Installation

You will need to install WebdriverIO, instructions can be found here.

Quick Start

The recommended way to get up and running quickly is to use the WDIO configuration wizard.

Manual Quick Start

To get started without using the configuration wizard, you will need to install the service and @wdio/cli:

npm install --dev @wdio/cli wdio-electron-service

Or use your package manager of choice - pnpm, yarn, etc.

Next, create your WDIO configuration file. If you need some inspiration for this, there is a working configuration in the example directory of this repository, as well as the WDIO configuration reference page.

You will need to add electron to your services array and set an Electron capability, e.g.:

wdio.conf.ts

export const config = {
  // ...
  services: ['electron'],
  capabilities: [
    {
      browserName: 'electron',
    },
  ],
  // ...
};

Finally, run some tests using your configuration file.

This will spin up an instance of your app in the same way that WDIO handles browsers such as Chrome or Firefox. The service works with WDIO (parallel) multiremote if you need to run additional instances simultaneously, e.g. multiple instances of your app or different combinations of your app and a Web browser.

If you use Electron Forge or Electron Builder to package your app then the service will automatically attempt to find the path to your bundled Electron application. You can provide a custom path to the binary via custom service capabilities, e.g.:

wdio.conf.ts

export const config = {
  // ...
  capabilities: [
    {
      'browserName': 'electron',
      'wdio:electronServiceOptions': {
        appBinaryPath: './path/to/bundled/electron/app.exe',
        appArgs: ['foo', 'bar=baz'],
      },
    },
  ],
  // ...
};

Documentation

Service Configuration
Chromedriver Configuration
Accessing Electron APIs
Mocking Electron APIs
Standalone Mode
Development
Common Issues & Debugging

Development

Read the development doc if you are interested in contributing.

Example Integrations

Check out our Electron boilerplate project that showcases how to integrate WebdriverIO in an example application. You can also have a look at the Example App and E2Es directories in this repository.

Support

If you are having issues running WDIO with the service you should check the documented Common Issues in the first instance, then open a discussion in the main WDIO forum.

The Electron service discussion forum is much less active than the WDIO one, but if the issue you are experiencing is specific to Electron or using the service then you can open a discussion here.

Keywords

FAQs

Last updated on 21 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc