From 073d67ec10afc8de7050edde59ef9207041fb14a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Wed, 1 Oct 2025 22:37:12 -0400 Subject: [PATCH 1/6] Run xvfb in the background directly --- .github/workflows/test.yml | 14 ++++++++++++-- tests/main.spec.ts | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 678f063..a330e16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,8 +19,7 @@ jobs: matrix: os: - macos-latest - # Testing on Linux is temporarily disabled until we can figure out the SUID sandboxing issue. - # - ubuntu-latest + - ubuntu-latest - windows-latest runs-on: ${{ matrix.os }} steps: @@ -49,10 +48,21 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: npm install + - name: Linux workarounds + if: runner.os == 'Linux' + run: | + sudo chown root:root $SANDBOX_BIN + sudo chmod 4755 $SANDBOX_BIN + Xvfb :99 & + env: + SANDBOX_BIN: ./node_modules/electron/dist/chrome-sandbox + - name: Run tests run: | composer run assets --working-dir=build npm run test + env: + DISPLAY: :99 - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} diff --git a/tests/main.spec.ts b/tests/main.spec.ts index 590a380..7df450a 100644 --- a/tests/main.spec.ts +++ b/tests/main.spec.ts @@ -21,6 +21,8 @@ async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[Ele COMPOSER_MIRROR_PATH_REPOS: '1', // Disable the network so we don't inadvertently test the internet. COMPOSER_DISABLE_NETWORK: '1', + // For xvfb on Linux. + DISPLAY: process.env.DISPLAY || '', }, }); return [app, root]; From 5ed79c8ee2151031b445146b4c2831328e3e4266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Wed, 1 Oct 2025 22:42:38 -0400 Subject: [PATCH 2/6] Try a different workaround --- .github/workflows/test.yml | 15 ++++----------- tests/main.spec.ts | 2 -- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a330e16..7673e7d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,9 +18,9 @@ jobs: strategy: matrix: os: - - macos-latest +# - macos-latest - ubuntu-latest - - windows-latest +# - windows-latest runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 @@ -50,19 +50,12 @@ jobs: - name: Linux workarounds if: runner.os == 'Linux' - run: | - sudo chown root:root $SANDBOX_BIN - sudo chmod 4755 $SANDBOX_BIN - Xvfb :99 & - env: - SANDBOX_BIN: ./node_modules/electron/dist/chrome-sandbox + run: sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 - name: Run tests run: | composer run assets --working-dir=build - npm run test - env: - DISPLAY: :99 + xvfb-run -- npm run test - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} diff --git a/tests/main.spec.ts b/tests/main.spec.ts index 7df450a..590a380 100644 --- a/tests/main.spec.ts +++ b/tests/main.spec.ts @@ -21,8 +21,6 @@ async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[Ele COMPOSER_MIRROR_PATH_REPOS: '1', // Disable the network so we don't inadvertently test the internet. COMPOSER_DISABLE_NETWORK: '1', - // For xvfb on Linux. - DISPLAY: process.env.DISPLAY || '', }, }); return [app, root]; From 1f78aa17cc66301334d7b19f9c51b763402caa47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Wed, 1 Oct 2025 22:46:00 -0400 Subject: [PATCH 3/6] Try another approach --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7673e7d..a1c81cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,7 +55,8 @@ jobs: - name: Run tests run: | composer run assets --working-dir=build - xvfb-run -- npm run test + npx electron-vite build + xvfb-run -- npx playwright test - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} From d7a6c0ad48af0aa8e8172a1a3f8765eec3b55fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Wed, 1 Oct 2025 22:50:43 -0400 Subject: [PATCH 4/6] Explicitly pass DISPLAY to launch --- tests/main.spec.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/main.spec.ts b/tests/main.spec.ts index 590a380..828b407 100644 --- a/tests/main.spec.ts +++ b/tests/main.spec.ts @@ -7,6 +7,8 @@ import { ComposerCommand } from '@/main/ComposerCommand'; async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[ElectronApplication, string]> { const root = testInfo.outputPath('drupal'); + console.log(process.env.DISPLAY); + const app = await electron.launch({ args: [ '.', @@ -21,6 +23,7 @@ async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[Ele COMPOSER_MIRROR_PATH_REPOS: '1', // Disable the network so we don't inadvertently test the internet. COMPOSER_DISABLE_NETWORK: '1', + DISPLAY: process.env.DISPLAY || '', }, }); return [app, root]; From 66c4e94f2bd85366e1e5904fa02460c7bdea5557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Thu, 2 Oct 2025 08:32:40 -0400 Subject: [PATCH 5/6] Try ozone-platform workaround --- tests/main.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/main.spec.ts b/tests/main.spec.ts index 828b407..1fd51a0 100644 --- a/tests/main.spec.ts +++ b/tests/main.spec.ts @@ -15,6 +15,7 @@ async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[Ele `--root=${root}`, `--log=${testInfo.outputPath('app.log')}`, `--timeout=2`, + '--ozone-platform=x11', ...options, ], env: { From 0d4c62771d0628e42328eb3962a95670a0e45ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ph=C3=A9na=20Proxima?= Date: Thu, 2 Oct 2025 08:35:07 -0400 Subject: [PATCH 6/6] Try another way --- src/main/main.ts | 2 ++ tests/main.spec.ts | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/main.ts b/src/main/main.ts index 8f7e4bb..b314722 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -17,6 +17,8 @@ import { hideBin } from 'yargs/helpers'; import { PhpCommand } from './PhpCommand'; import { ComposerCommand } from './ComposerCommand'; +app.commandLine.appendSwitch('ozone-platform', 'x11'); + // If any uncaught exception happens, send it to Sentry. Sentry.init({ beforeSend: (event, hint) => { diff --git a/tests/main.spec.ts b/tests/main.spec.ts index 1fd51a0..1a3e4c3 100644 --- a/tests/main.spec.ts +++ b/tests/main.spec.ts @@ -7,15 +7,12 @@ import { ComposerCommand } from '@/main/ComposerCommand'; async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[ElectronApplication, string]> { const root = testInfo.outputPath('drupal'); - console.log(process.env.DISPLAY); - const app = await electron.launch({ args: [ '.', `--root=${root}`, `--log=${testInfo.outputPath('app.log')}`, `--timeout=2`, - '--ozone-platform=x11', ...options, ], env: { @@ -24,7 +21,7 @@ async function launchApp(testInfo: TestInfo, ...options: string[]): Promise<[Ele COMPOSER_MIRROR_PATH_REPOS: '1', // Disable the network so we don't inadvertently test the internet. COMPOSER_DISABLE_NETWORK: '1', - DISPLAY: process.env.DISPLAY || '', + DISPLAY: ':99', }, }); return [app, root];