added new electron tests supporting date mocking (#2947)

first PR for #2942 

- added new electron tests for calendar which test new css classes from
https://github.com/MichMich/MagicMirror/pull/2939
- moved some compliments tests from `e2e` to `electron` because of date
mocking
- removed mock stuff from compliments module
This commit is contained in:
Karsten Hassel
2022-10-17 07:20:23 +02:00
committed by GitHub
parent fc59ed20e3
commit ad4dbd786a
9 changed files with 134 additions and 66 deletions

View File

@@ -18,37 +18,6 @@ describe("Compliments module", () => {
await helpers.stopApplication();
});
describe("parts of days", () => {
beforeAll(async () => {
helpers.startApplication("tests/configs/modules/compliments/compliments_parts_day.js");
await helpers.getDocument();
});
it("if Morning compliments for that part of day", async () => {
const hour = new Date().getHours();
if (hour >= 3 && hour < 12) {
// if morning check
await doTest(["Hi", "Good Morning", "Morning test"]);
}
});
it("if Afternoon show Compliments for that part of day", async () => {
const hour = new Date().getHours();
if (hour >= 12 && hour < 17) {
// if afternoon check
await doTest(["Hello", "Good Afternoon", "Afternoon test"]);
}
});
it("if Evening show Compliments for that part of day", async () => {
const hour = new Date().getHours();
if (!(hour >= 3 && hour < 12) && !(hour >= 12 && hour < 17)) {
// if evening check
await doTest(["Hello There", "Good Evening", "Evening test"]);
}
});
});
describe("Feature anytime in compliments module", () => {
describe("Set anytime and empty compliments for morning, evening and afternoon ", () => {
beforeAll(async () => {
@@ -73,19 +42,6 @@ describe("Compliments module", () => {
});
});
describe("Feature date in compliments module", () => {
describe("Set date and empty compliments for anytime, morning, evening and afternoon", () => {
beforeAll(async () => {
helpers.startApplication("tests/configs/modules/compliments/compliments_date.js");
await helpers.getDocument();
});
it("Show happy new year compliment on new years day", async () => {
await doTest(["Happy new year!"]);
});
});
});
describe("remoteFile option", () => {
beforeAll(async () => {
helpers.startApplication("tests/configs/modules/compliments/compliments_remote.js");