From 96d3692b356859299adaed6b20a014e7fcd5ffd2 Mon Sep 17 00:00:00 2001 From: pengx17 Date: Mon, 14 Oct 2024 10:20:17 +0000 Subject: [PATCH] test(electron): electron tests on ubuntu 24 (#8492) Operating System Ubuntu 24.04.1 LTS Github ubuntu-latest now points to 24.04.1 https://github.com/actions/runner-images/issues/10636#issuecomment-2377530635 related possible fix https://github.com/electron/electron/issues/17972#issuecomment-487369441 --- .github/workflows/build-test.yml | 11 ++++++++++- tests/affine-desktop/package.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 5a7607b77..e7b7cfca4 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -412,6 +412,10 @@ jobs: - name: 'Server Desktop E2E Test' script: | yarn workspace @affine/electron build:dev + # Workaround for Electron apps failing to initialize on Ubuntu 24.04 due to AppArmor restrictions + # Disables unprivileged user namespaces restriction to allow Electron apps to run + # Reference: https://github.com/electron/electron/issues/42510 + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop-cloud e2e needs: - build-server-native @@ -561,7 +565,12 @@ jobs: - name: Run desktop tests if: ${{ matrix.spec.os == 'ubuntu-latest' }} - run: xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop e2e + run: | + # Workaround for Electron apps failing to initialize on Ubuntu 24.04 due to AppArmor restrictions + # Disables unprivileged user namespaces restriction to allow Electron apps to run + # Reference: https://github.com/electron/electron/issues/42510 + sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 + xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- yarn workspace @affine-test/affine-desktop e2e - name: Run desktop tests if: ${{ matrix.spec.test && matrix.spec.os != 'ubuntu-latest' }} diff --git a/tests/affine-desktop/package.json b/tests/affine-desktop/package.json index 344a57cff..b559b4cfd 100644 --- a/tests/affine-desktop/package.json +++ b/tests/affine-desktop/package.json @@ -2,7 +2,7 @@ "name": "@affine-test/affine-desktop", "private": true, "scripts": { - "e2e": "yarn playwright test" + "e2e": "DEBUG=pw:browser yarn playwright test" }, "devDependencies": { "@affine-test/kit": "workspace:*",