Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
aethernet committed Apr 25, 2024
1 parent 9b6b882 commit b5236e2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
1 change: 0 additions & 1 deletion .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ runs:
npm ci
npm run lint
npm run make
npm run package
npm run wdio
Expand Down
18 changes: 18 additions & 0 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { MakerDMG } from '@electron-forge/maker-dmg';
import { MakerAppImage } from '@reforged/maker-appimage';
import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
import { WebpackPlugin } from '@electron-forge/plugin-webpack';
import { exec } from 'child_process';

import { mainConfig, rendererConfig } from './webpack.config';
import * as sidecar from './forge.sidecar';
Expand Down Expand Up @@ -153,6 +154,23 @@ const config: ForgeConfig = {

return packageJson;
},
postPackage: async (_forgeConfig, options) => {
if (options.platform === 'linux') {
// symlink the etcher binary from balena-etcher to balenaEtcher to ensure compatibility with the wdio suite and the old name
await new Promise<void>((resolve, reject) => {
exec(
`ln -s "${options.outputPaths}/balena-etcher" "${options.outputPaths}/balenaEtcher"`,
(err) => {
if (err) {
reject(err);
} else {
resolve();
}
},
);
});
}
},
},
};

Expand Down
28 changes: 3 additions & 25 deletions wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
/// <reference types="wdio-electron-service" />
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 = {
//
Expand Down Expand Up @@ -87,7 +63,9 @@ export const config: Options.Testrunner = {
browserName: 'electron',
// Electron service options
// see https://webdriver.io/docs/desktop-testing/electron/configuration/#service-options
'wdio:electronServiceOptions': serviceOptions(),
'wdio:electronServiceOptions': {
appArgs: [],
},
},
],

Expand Down

0 comments on commit b5236e2

Please sign in to comment.