diff --git a/wdio.conf.ts b/wdio.conf.ts index 1b2a6cd0cc8..4b225301f1a 100644 --- a/wdio.conf.ts +++ b/wdio.conf.ts @@ -1,5 +1,29 @@ /// import type { Options } from '@wdio/types'; +import { join } from 'path'; + +// For backward compatibility reason, the bundle is called `balena-etcher` on linux, and balenaEtcher on all other platforms. +// As a result, we need to specify the binary path for linux as wdio looks for balenaEtcher. +function serviceOptions() { + const appArgs: string[] = []; + if (process.platform === 'linux') { + return { + // custom application args + appArgs, + // path to the electron binary + binaryPath: join( + __dirname, + 'out', + `balenaEtcher-linux-${process.arch}`, + 'balena-etcher', + ), + }; + } else { + return { + appArgs, + }; + } +} export const config: Options.Testrunner = { // @@ -63,10 +87,7 @@ export const config: Options.Testrunner = { browserName: 'electron', // Electron service options // see https://webdriver.io/docs/desktop-testing/electron/configuration/#service-options - 'wdio:electronServiceOptions': { - // custom application args - appArgs: [], - }, + 'wdio:electronServiceOptions': serviceOptions(), }, ],