diff --git a/CHANGELOG.md b/CHANGELOG.md index 83096e32..955a4859 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -51,6 +51,7 @@ Special thanks to: @rejas, @sdetweil, @MagMar94 - Possibility to change FontAwesome class in calendar, so icons like `fab fa-facebook-square` works. - Fix cors problems with newsfeed articles (as far as possible), allow disabling cors per feed with option `useCorsProxy: false` (#2840) - Tests not waiting for the application to start and stop before starting the next test +- Fix electron tests failing sometimes in github workflow - Fixed gap in clock module when displayed on the left side with displayType=digital ## [2.21.0] - 2022-10-01 diff --git a/tests/electron/helpers/global-setup.js b/tests/electron/helpers/global-setup.js index a8af0293..06419475 100644 --- a/tests/electron/helpers/global-setup.js +++ b/tests/electron/helpers/global-setup.js @@ -10,19 +10,22 @@ exports.startApplication = async (configFilename, systemDate = null, electronPar process.env.TZ = "GMT"; jest.retryTimes(3); global.electronApp = await electron.launch({ args: electronParams }); - expect(global.electronApp); - if ((await global.electronApp.windows().length) === 1) { - global.page = await global.electronApp.firstWindow(); - if (systemDate) { - await global.page.evaluate((systemDate) => { - Date.now = () => { - return new Date(systemDate); - }; - }, systemDate); + await global.electronApp.firstWindow(); + + for (const win of global.electronApp.windows()) { + const title = await win.title(); + expect(["MagicMirror²", "DevTools"]).toContain(title); + if (title === "MagicMirror²") { + global.page = win; + if (systemDate) { + await global.page.evaluate((systemDate) => { + Date.now = () => { + return new Date(systemDate); + }; + }, systemDate); + } } - expect(await global.page.title()).toBe("MagicMirror²"); - expect(await global.page.isVisible("body")).toBe(true); } };