Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

test(electron): electron tests on ubuntu 24 (#8492)

pengx1796d3692b3568
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 5a7607b771..e7b7cfca47 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 344a57cff1..b559b4cfdf 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:*",