Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron tests: fixes for running under new github image ubuntu-24.04 #3680

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/automated-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ jobs:
npm run test:css
npm run test:markdown
test:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
matrix:
node-version: [20.18.1, 20.x, 22.x, 23.x]
steps:
- name: Install electron dependencies and labwc
run: sudo apt-get install -y libnss3 libasound2t64 labwc
- name: "Checkout code"
uses: actions/checkout@v4
- name: "Use Node.js ${{ matrix.node-version }}"
Expand All @@ -48,12 +50,16 @@ jobs:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: "npm"
- name: "Install dependencies"
- name: "Install MagicMirror²"
run: |
npm run install-mm:dev
- name: "Run tests"
run: |
Xvfb :99 -screen 0 1024x768x16 &
export DISPLAY=:99
# Fix chrome-sandbox permissions:
sudo chown root:root ./node_modules/electron/dist/chrome-sandbox
sudo chmod 4755 ./node_modules/electron/dist/chrome-sandbox
# Start labwc
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_RENDERER=pixman labwc &
export WAYLAND_DISPLAY=wayland-0
touch css/custom.css
npm run test
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ planned for 2025-04-01

### Fixed

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

## [2.30.0] - 2025-01-01

Expand Down
2 changes: 1 addition & 1 deletion tests/electron/env_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("Electron app environment", () => {

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

afterEach(async () => {
Expand Down
4 changes: 3 additions & 1 deletion tests/electron/helpers/global-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// https://www.anycodings.com/1questions/958135/can-i-set-the-date-for-playwright-browser
const { _electron: electron } = require("playwright");

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

electronParams.unshift("js/electron.js", "--enable-features=UseOzonePlatform", "--ozone-platform=wayland");

global.electronApp = await electron.launch({ args: electronParams });

await global.electronApp.firstWindow();
Expand Down
Loading