Skip to content

Commit

Permalink
test: Disable sandbox for Linux e2e tests on older Electron versions (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish authored Jan 11, 2023
1 parent 49760e2 commit dd140ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion test/e2e/context.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { parseSemver } from '@sentry/utils';
import { ChildProcess, spawn, spawnSync } from 'child_process';
import { rmSync } from 'fs';
import { homedir } from 'os';
Expand Down Expand Up @@ -47,6 +48,7 @@ export class TestContext {
*/
public constructor(
private readonly _electronPath: string,
private readonly _electronVersion: string,
private readonly _appPath: string,
private readonly _appName: string,
) {}
Expand All @@ -66,7 +68,15 @@ export class TestContext {
this._clearAppUserData();
}

const childProcess = spawn(this._electronPath, [this._appPath], { env });
const version = parseSemver(this._electronVersion);

const args = [this._appPath];
// Older versions of Electron no longer work correctly on 'ubuntu-latest' with sandbox
if (process.platform === 'linux' && (version.major || 0) < 13) {
args.push('--no-sandbox');
}

const childProcess = spawn(this._electronPath, args, { env });

function logLinesWithoutEmpty(input: string): void {
input
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('E2E Tests', () => {
}

const [appPath, appName] = await recipe.prepare(this, distDir);
testContext = new TestContext(await electronPath, appPath, appName);
testContext = new TestContext(await electronPath, electronVersion, appPath, appName);
await recipe.runTests(testContext, testServer);
});
}
Expand All @@ -79,7 +79,7 @@ describe('E2E Tests', () => {
}

const [appPath, appName] = await recipe.prepare(this, distDir);
testContext = new TestContext(await electronPath, appPath, appName);
testContext = new TestContext(await electronPath, electronVersion, appPath, appName);
await recipe.runTests(testContext, testServer);
});
}
Expand Down

0 comments on commit dd140ed

Please sign in to comment.