Skip to content

Commit 8fdd865

Browse files
authored
electron tests: fixes for running under new github image ubuntu-24.04 (#3680)
and replace xserver with labwc, fixes #3676
1 parent 0f6efac commit 8fdd865

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

.github/workflows/automated-tests.yaml

+10-4
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,14 @@ jobs:
3434
npm run test:css
3535
npm run test:markdown
3636
test:
37-
runs-on: ubuntu-22.04
37+
runs-on: ubuntu-24.04
3838
timeout-minutes: 30
3939
strategy:
4040
matrix:
4141
node-version: [20.18.1, 20.x, 22.x, 23.x]
4242
steps:
43+
- name: Install electron dependencies and labwc
44+
run: sudo apt-get install -y libnss3 libasound2t64 labwc
4345
- name: "Checkout code"
4446
uses: actions/checkout@v4
4547
- name: "Use Node.js ${{ matrix.node-version }}"
@@ -48,12 +50,16 @@ jobs:
4850
node-version: ${{ matrix.node-version }}
4951
check-latest: true
5052
cache: "npm"
51-
- name: "Install dependencies"
53+
- name: "Install MagicMirror²"
5254
run: |
5355
npm run install-mm:dev
5456
- name: "Run tests"
5557
run: |
56-
Xvfb :99 -screen 0 1024x768x16 &
57-
export DISPLAY=:99
58+
# Fix chrome-sandbox permissions:
59+
sudo chown root:root ./node_modules/electron/dist/chrome-sandbox
60+
sudo chmod 4755 ./node_modules/electron/dist/chrome-sandbox
61+
# Start labwc
62+
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_RENDERER=pixman labwc &
63+
export WAYLAND_DISPLAY=wayland-0
5864
touch css/custom.css
5965
npm run test

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ planned for 2025-04-01
2525

2626
### Fixed
2727

28-
- [calendar] fix clipping events being broadcast (#3678)
28+
- [calendar] Fix clipping events being broadcast (#3678)
29+
- [tests] Electron tests: Fixes for running under new github image ubuntu-24.04, replace xserver with labwc (#3676)
2930

3031
## [2.30.0] - 2025-01-01
3132

tests/electron/env_spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("Electron app environment", () => {
1919

2020
describe("Development console tests", () => {
2121
beforeEach(async () => {
22-
await helpers.startApplication("tests/configs/modules/display.js", null, ["js/electron.js", "dev"]);
22+
await helpers.startApplication("tests/configs/modules/display.js", null, ["dev"]);
2323
});
2424

2525
afterEach(async () => {

tests/electron/helpers/global-setup.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// https://www.anycodings.com/1questions/958135/can-i-set-the-date-for-playwright-browser
44
const { _electron: electron } = require("playwright");
55

6-
exports.startApplication = async (configFilename, systemDate = null, electronParams = ["js/electron.js"], timezone = "GMT") => {
6+
exports.startApplication = async (configFilename, systemDate = null, electronParams = [], timezone = "GMT") => {
77
global.electronApp = null;
88
global.page = null;
99
process.env.MM_CONFIG_FILE = configFilename;
@@ -13,6 +13,8 @@ exports.startApplication = async (configFilename, systemDate = null, electronPar
1313
}
1414
process.env.mmTestMode = "true";
1515

16+
electronParams.unshift("js/electron.js", "--enable-features=UseOzonePlatform", "--ozone-platform=wayland");
17+
1618
global.electronApp = await electron.launch({ args: electronParams });
1719

1820
await global.electronApp.firstWindow();

0 commit comments

Comments
 (0)