Electron Service
@wdio/electron-service is a 3rd party package, for more information please see GitHub | npm
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โ
- Sets up the Chromedriver your app's Electron version needs, for Electron 26 and later
- Finds your app's binary when you build with Electron Forge or Electron Builder, and runs unpackaged apps too
browser.electron.execute(), to run code in the main process with access to Electron's APIs- Vitest-style mocking of Electron's APIs
- Deeplink testing
- Console log capture from the main and renderer processes
- Browser mode, to test the renderer in Chrome against a dev server, without building the app
Installationโ
You will need to install WebdriverIO; Getting Started has the instructions.
Quick Startโ
Run the WDIO configuration wizard, or install the service and add it to your config:
npm install --save-dev @wdio/cli @wdio/electron-service
export const config = {
services: ['electron'],
capabilities: [{ browserName: 'electron' }],
};
The service finds apps packaged with Electron Forge or Electron Builder. The Quick Start covers setting the app's path, unpackaged apps and Electron versions before 26.
Documentationโ
Getting Startedโ
- Quick Start โ install, configure and run your first test
- Configuration โ service options and Chromedriver setup
- Electron APIs โ accessing and mocking Electron APIs in tests
Referenceโ
- API Reference โ every
browser.electron.*method and exported helper - Window Management โ automatic window focus behaviour
Operationsโ
- Browser Mode โ test the renderer in Chrome against a Vite dev server, no Electron binary required
- Deeplink Testing โ protocol handler tests across platforms
- Standalone Mode โ using the service without the WDIO test runner
- Visual Testing โ visual regression with
@wdio/visual-service - Video Recording โ record video of test runs with
wdio-video-reporter - Log Forwarding โ main and renderer process log capture
- Troubleshooting โ known issues, workarounds and debug logging
Migration & Release Notesโ
- v10.0.0 Release Notes โ full list of v10 changes
- v10 โ v11 Migration โ required upgrade actions
- v9 โ v10 Migration โ required upgrade actions
- v8 โ v9 Migration
Contributingโ
See CONTRIBUTING.md.
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 package test apps, E2E test apps, and E2E test suites in this repository.
Supportโ
- Troubleshooting covers common issues.
- Report bugs and request features in GitHub Issues.
- Ask questions in GitHub Discussions.