Skip to content

Commit

Permalink
WIP: fixes for app e2e
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent T <[email protected]>
  • Loading branch information
vyncent-t committed Sep 19, 2024
1 parent 0c0442a commit 6c8b0dd
Show file tree
Hide file tree
Showing 12 changed files with 409 additions and 53 deletions.
9 changes: 8 additions & 1 deletion app/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,19 @@ import windowSize from './windowSize';

dotenv.config({ path: path.join(process.resourcesPath, '.env') });

let electronStartURL = process.env.ELECTRON_START_URL;

const pathInfoDebug = false;
let pathInfo;

const isDev = process.env.ELECTRON_DEV || false;
let frontendPath = '';

const isClusterDev = process.env.CLUSTER_DEV || false;
if (isClusterDev) {
electronStartURL = process.env.HEADLAMP_TEST_URL;
}

if (isDev) {
frontendPath = path.resolve('..', 'frontend', 'build', 'index.html');
} else {
Expand All @@ -43,7 +50,7 @@ if (isDev) {
const backendToken = randomBytes(32).toString('hex');

const startUrl = (
process.env.ELECTRON_START_URL ||
electronStartURL ||
url.format({
pathname: frontendPath,
protocol: 'file:',
Expand Down
74 changes: 74 additions & 0 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"copy-plugins": "npx --no-install rimraf build/.plugins && mkdirp build/.plugins && copyfiles ../.plugins build/.plugins",
"dev": "npm run compile-electron && cross-env ELECTRON_DEV=1 electron .",
"dev-only-app": "npm run compile-electron && cross-env ELECTRON_DEV=1 ELECTRON_START_URL=http://localhost:3000 EXTERNAL_SERVER=true electron .",
"dev-only-app-cluster": "npm run compile-electron && node scripts/cluster-dev-start.js",
"i18n": "npx --no-install i18next ./electron/main.ts -c ./electron/i18next-parser.config.js",
"package": "npm run build && electron-builder build --publish never",
"package-msi": "npm run build && node windows/msi/build.js",
Expand Down Expand Up @@ -155,6 +156,7 @@
"@babel/preset-env": "^7.24.8",
"@babel/preset-typescript": "^7.24.7",
"@electron/notarize": "^2.3.2",
"@playwright/test": "^1.45.3",
"electron": "^31.2.0",
"electron-builder": "^24.13.3",
"i18next-parser": "^9.0.0",
Expand Down
13 changes: 13 additions & 0 deletions app/scripts/cluster-dev-start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { exec } = require('child_process');

const url = process.env.HEADLAMP_TEST_URL;
const command = `cross-env ELECTRON_DEV=1 ELECTRON_START_URL=${url} EXTERNAL_SERVER=true electron .`;

exec(command, (err, stdout, stderr) => {
if (err) {
console.error(`Error: ${err}`);
return;
}
console.log(stdout);
console.error(stderr);
});
Loading

0 comments on commit 6c8b0dd

Please sign in to comment.