Skip to content

Commit

Permalink
Merge pull request #4207 from balena-io/switch-test-runner-to-wdio
Browse files Browse the repository at this point in the history
patch: setup wdio and port most tests
  • Loading branch information
flowzone-app[bot] authored Apr 25, 2024
2 parents b132352 + a661d10 commit 58c82b3
Show file tree
Hide file tree
Showing 16 changed files with 8,317 additions and 583 deletions.
12 changes: 6 additions & 6 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@ name: test release
# https://github.com/product-os/flowzone/tree/master/.github/actions
inputs:
json:
description: "JSON stringified object containing all the inputs from the calling workflow"
description: 'JSON stringified object containing all the inputs from the calling workflow'
required: true
secrets:
description: "JSON stringified object containing all the secrets from the calling workflow"
description: 'JSON stringified object containing all the secrets from the calling workflow'
required: true

# --- custom environment
NODE_VERSION:
type: string
default: "20.10"
default: '20.10'
VERBOSE:
type: string
default: "true"
default: 'true'

runs:
# https://docs.github.com/en/actions/creating-actions/creating-a-composite-action
using: "composite"
using: 'composite'
steps:
# https://github.com/actions/setup-node#caching-global-packages-data
- name: Setup Node.js
Expand Down Expand Up @@ -57,7 +57,7 @@ runs:
npm ci
npm run lint
npm run package
npm run test
npm run wdio # test stage, note that it requires the package to be done first
env:
# https://www.electronjs.org/docs/latest/api/environment-variables
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
2 changes: 1 addition & 1 deletion lib/gui/app/models/selection-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { DrivelistDrive } from '../../../shared/drive-constraints';
* limitations under the License.
*/

import { SourceMetadata } from '../components/source-selector/source-selector';
import { SourceMetadata } from '../../../shared/typings/source-selector';

import * as availableDrives from './available-drives';
import { Actions, store } from './store';
Expand Down
2 changes: 1 addition & 1 deletion lib/gui/app/modules/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const initAnalytics = _.once(() => {

const getCircularReplacer = () => {
const seen = new WeakSet();
return (key: any, value: any) => {
return (_key: any, value: any) => {
if (typeof value === 'object' && value !== null) {
if (seen.has(value)) {
return;
Expand Down
2 changes: 2 additions & 0 deletions lib/gui/app/modules/progress-status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export function fromFlashState({
status: string;
position?: string;
} {
console.log(i18next.t('progress.starting'));

if (type === undefined) {
return { status: i18next.t('progress.starting') };
} else if (type === 'decompressing') {
Expand Down
4 changes: 1 addition & 3 deletions lib/shared/sudo/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ import { mkdir, writeFile, copyFile, readFile } from 'fs/promises';

export async function sudo(
command: string,
name: string,
_name: string,
env: any,
): Promise<{ cancelled: boolean; stdout?: string; stderr?: string }> {
// console.log('name', name);

const uuid = uuidv4();

const temp = tmpdir();
Expand Down
Loading

0 comments on commit 58c82b3

Please sign in to comment.