Gathering detailed insights and metrics for wdio-electron-service
Gathering detailed insights and metrics for wdio-electron-service
Gathering detailed insights and metrics for wdio-electron-service
Gathering detailed insights and metrics for wdio-electron-service
WebdriverIO service for testing Electron applications
npm install wdio-electron-service
Typescript
Module System
Min. Node Version
Node Version
NPM Version
52
Supply Chain
81.6
Quality
90.3
Maintenance
100
Vulnerability
93.4
License
TypeScript (89.6%)
HTML (6.19%)
JavaScript (4.21%)
Total Downloads
394,571
Last Day
982
Last Week
4,866
Last Month
22,748
Last Year
245,943
37 Stars
2,314 Commits
17 Forks
7 Watching
14 Branches
16 Contributors
Latest Version
7.3.1
Package Id
wdio-electron-service@7.3.1
Unpacked Size
131.96 kB
Size
32.55 kB
File Count
102
NPM Version
10.8.2
Node Version
20.18.0
Publised On
19 Nov 2024
Cumulative downloads
Total Downloads
Last day
-1.4%
982
Compared to previous day
Last week
-11.8%
4,866
Compared to previous week
Last month
6.8%
22,748
Compared to previous month
Last year
259.6%
245,943
Compared to previous year
12
2
WebdriverIO service for testing Electron applications
Enables cross-platform E2E testing of Electron apps via the extensive WebdriverIO ecosystem.
Spiritual successor to Spectron (RIP).
Makes testing Electron applications much easier via:
You will need to install WebdriverIO
, instructions can be found here.
The recommended way to get up and running quickly is to use the WDIO configuration wizard.
To get started without using the configuration wizard, you will need to install the service and @wdio/cli
:
1npm 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
1export const config = { 2 // ... 3 services: ['electron'], 4 capabilities: [ 5 { 6 browserName: 'electron', 7 }, 8 ], 9 // ... 10};
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
1export const config = { 2 // ... 3 capabilities: [ 4 { 5 'browserName': 'electron', 6 'wdio:electronServiceOptions': { 7 appBinaryPath: './path/to/built/electron/app.exe', 8 appArgs: ['foo', 'bar=baz'], 9 }, 10 }, 11 ], 12 // ... 13};
Alternatively, you can point the service at an unpackaged app by providing the path to the main.js
script. Electron will need to be installed in your node_modules
. It is recommended to bundle unpackaged apps using a bundler such as Rollup, Parcel, Webpack, etc.
wdio.conf.ts
1export const config = { 2 // ... 3 capabilities: [ 4 { 5 'browserName': 'electron', 6 'wdio:electronServiceOptions': { 7 appEntryPoint: './path/to/bundled/electron/main.bundle.js', 8 appArgs: ['foo', 'bar=baz'], 9 }, 10 }, 11 ], 12 // ... 13};
If your app uses a version of Electron which is lower than v26 then you will need to manually configure Chromedriver.
This is because WDIO uses Chrome for Testing to download Chromedriver, which only provides Chromedriver versions of v115 or newer.
Service Configuration
Chromedriver Configuration
Accessing Electron APIs
Mocking Electron APIs
Standalone Mode
Development
Common Issues & Debugging
Read the development doc if you are interested in contributing.
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 Apps and E2Es directories in this repository.
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.
No vulnerabilities found.
No security vulnerabilities found.