The service can be configured by setting wdio:electronServiceOptions
either on the service level or capability level, in which capability level configurations take precedence, e.g. the following WebdriverIO configuration:
wdio.conf.ts
export const config = {
// ...
services: [
[
'electron',
{
appBinaryPath: '/foo/bar/myApp'
},
],
],
capabilities: [
{
'browserName': 'electron',
'wdio:electronServiceOptions': {
appBinaryPath: '/foo/bar/myOtherApp'
appArgs: ['foo', 'bar'],
},
},
],
// ...
};
...would result in the following configuration object:
{
"appBinaryPath": "/foo/bar/myOtherApp",
"appArgs": ["foo", "bar"]
}
The service supports the following configuration options:
An array of string arguments to be passed through to the app on execution of the test run. Electron command line switches and some Chromium switches can be used here.
Type: string[]
The path to the Electron binary of the app for testing. In most cases the service will determine the path to your app automatically (check here), but if this fails for some reason, e.g. your app is in a different repository from your tests, then it is recommended to set this value manually.
Type: string
The path to the unpackaged entry point of the app for testing, e.g. your main.js
. You will need Electron installed to use this feature. The appEntryPoint
value overrides appBinaryPath
if both are set.
Type: string
Calls .mockClear() on all mocked APIs before each test. This will clear mock history, but not reset its implementation.
Type: boolean
Calls .mockReset() on all mocked APIs before each test. This will clear mock history and reset its implementation to an empty function (will return undefined).
Type: boolean
Calls .mockRestore() on all mocked APIs before each test. This will restore the original API function, the mock will be removed.
Type: boolean
The service will automatically determine the path to the Electron binary of your app based on the configuration of supported build tools.
If you want to manually set this value, you can specify the appBinaryPath
option.
package.json
(config values are read frombuild
)electron-builder.{json,json5,yaml,yml,toml,js,ts,mjs,cjs,mts,cts}
electron-builder.config.{json,json5,yaml,yml,toml,js,ts,mjs,cjs,mts,cts}
package.json
(config values are read fromconfig.forge
)forge.config.js
custom.config.js
(e.g. when"config": { "forge": "./custom-config.js" }
is specified in package.json)