Skip to content

Commit 8be89e5

Browse files
Merge remote-tracking branch 'origin/master' into migrate_RF_desktop_phase1
2 parents d9550f6 + 012f361 commit 8be89e5

4 files changed

Lines changed: 76 additions & 116 deletions

File tree

e2e/global-setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import * as fs from 'fs';
66
import * as os from 'os';
77
import * as path from 'path';
88

9+
import {ensureElectronBinary} from './helpers/config';
910
import {clearAllRegistryFiles} from './helpers/electronApp';
1011

1112
const MACOS_DEFAULTS_SNAPSHOT = path.join(os.tmpdir(), 'mattermost-desktop-e2e-macos-defaults-snapshot.json');
@@ -19,6 +20,8 @@ function readMacOsDefault(domain: string, key: string): string | null {
1920
}
2021

2122
export default async function globalSetup() {
23+
ensureElectronBinary();
24+
2225
// Clear stale per-worker PID shards (and any legacy shared file) from a
2326
// prior crashed run. We only delete files here, never signal pids, because
2427
// pids may have been reused by unrelated processes since that run.

e2e/helpers/config.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,34 @@
22
// See LICENSE.txt for license information.
33

44
import * as fs from 'fs';
5+
import {createRequire} from 'module';
56
import * as path from 'path';
67

8+
const require = createRequire(__filename);
9+
710
export const sourceRootDir = path.join(__dirname, '../..');
811

9-
// The Electron binary from the npm package
10-
export const electronBinaryPath = (() => {
12+
function getElectronBinaryPath(): string {
1113
if (process.platform === 'darwin') {
1214
return path.join(sourceRootDir, 'node_modules/electron/dist/Electron.app/Contents/MacOS/Electron');
1315
}
1416
const ext = process.platform === 'win32' ? '.exe' : '';
1517
return path.join(sourceRootDir, `node_modules/electron/dist/electron${ext}`);
18+
}
19+
20+
// Electron 42+ no longer downloads its binary during npm install. Playwright
21+
// launches via executablePath, so trigger the lazy download before tests run.
22+
export function ensureElectronBinary(): void {
23+
const binaryPath = getElectronBinaryPath();
24+
if (!fs.existsSync(binaryPath)) {
25+
require(path.join(sourceRootDir, 'node_modules/electron'));
26+
}
27+
}
28+
29+
// The Electron binary from the npm package
30+
export const electronBinaryPath = (() => {
31+
ensureElectronBinary();
32+
return getElectronBinaryPath();
1633
})();
1734

1835
// Test build app directory — built by `npm run build-test` (NODE_ENV=test)

package-lock.json

Lines changed: 53 additions & 113 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"copy-webpack-plugin": "10.2.4",
131131
"cross-env": "7.0.3",
132132
"css-loader": "6.7.1",
133-
"electron": "41.2.0",
133+
"electron": "43.0.0",
134134
"electron-builder": "26.6.0",
135135
"eslint": "8.57.0",
136136
"eslint-import-resolver-webpack": "0.13.8",

0 commit comments

Comments
 (0)