mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
improve electron tests (avoid errors in github workflows) (#2977)
Fix electron tests failing sometimes in github workflow.
This commit is contained in:
parent
3124b0a9c5
commit
2fec314ff5
@ -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.
|
- 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)
|
- 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
|
- 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
|
- Fixed gap in clock module when displayed on the left side with displayType=digital
|
||||||
|
|
||||||
## [2.21.0] - 2022-10-01
|
## [2.21.0] - 2022-10-01
|
||||||
|
@ -10,19 +10,22 @@ exports.startApplication = async (configFilename, systemDate = null, electronPar
|
|||||||
process.env.TZ = "GMT";
|
process.env.TZ = "GMT";
|
||||||
jest.retryTimes(3);
|
jest.retryTimes(3);
|
||||||
global.electronApp = await electron.launch({ args: electronParams });
|
global.electronApp = await electron.launch({ args: electronParams });
|
||||||
expect(global.electronApp);
|
|
||||||
|
|
||||||
if ((await global.electronApp.windows().length) === 1) {
|
await global.electronApp.firstWindow();
|
||||||
global.page = await global.electronApp.firstWindow();
|
|
||||||
if (systemDate) {
|
for (const win of global.electronApp.windows()) {
|
||||||
await global.page.evaluate((systemDate) => {
|
const title = await win.title();
|
||||||
Date.now = () => {
|
expect(["MagicMirror²", "DevTools"]).toContain(title);
|
||||||
return new Date(systemDate);
|
if (title === "MagicMirror²") {
|
||||||
};
|
global.page = win;
|
||||||
}, systemDate);
|
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);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user