mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-03 14:26:07 +00:00
## [2.27.0] - 2024-04-01 Thanks to: @bugsounet, @crazyscot, @illimarkangur, @jkriegshauser, @khassel, @KristjanESPERANTO, @Paranoid93, @rejas, @sdetweil and @vppencilsharpener. This release marks the first release without Michael Teeuw (@michmich). A very special thanks to him for creating MagicMirror and leading the project for so many years. For more info, please read the following post: [A New Chapter for MagicMirror: The Community Takes the Lead](https://forum.magicmirror.builders/topic/18329/a-new-chapter-for-magicmirror-the-community-takes-the-lead). ### Added - Output of system information to the console for troubleshooting (#3328 and #3337), ignore errors under aarch64 (#3349) - [chore] Add `eslint-plugin-package-json` to lint the `package.json` files (#3368) - [weather] `showHumidity` config is now a string describing where to show this element. Supported values: "wind", "temp", "feelslike", "below", "none". (#3330) - electron-rebuild test suite for electron and 3rd party modules compatibility (#3392) - Create MM² icon and attach it to electron process (#3407) ### Updated - Update updatenotification (update_helper.js): Recode with pm2 library (#3332) - Removing lodash dependency by replacing merge by spread operator (#3339) - Use node prefix for build-in modules (#3340) - Rework logging colors (#3350) - Update pm2 to v5.3.1 with no allow-ghsas (#3364) - [chore] Update husky and let lint-staged fix ESLint issues - [chore] Update dependencies including electron to v29 (#3357) and node-ical - Update translations for estonian (#3371) - Update electron to v29 and update other dependencies - [calendar] fullDay events over several days now show the left days from the first day on and 'today' on the last day - Update layout of current weather indoor values ### Fixed - Correct apibase of weathergov weatherprovider to match documentation (#2926) - Worked around several issues in the RRULE library that were causing deleted calender events to still show, some initial and recurring events to not show, and some event times to be off an hour. (#3291) - Skip changelog requirement when running tests for dependency updates (#3320) - Display precipitation probability when it is 0% instead of blank/empty (#3345) - [newsfeed] Suppress unsightly animation cases when there are 0 or 1 active news items (#3336) - [newsfeed] Always compute the feed item URL using the same helper function (#3336) - Ignore all custom css files (#3359) - [newsfeed] Fix newsfeed stall issue introduced by #3336 (#3361) - Changed `log.debug` to `log.log` in `app.js` where logLevel is not set because config is not loaded at this time (#3353) - [calendar] deny fetch interval < 60000 and set 60000 in this case (prevent fetch loop failed) (#3382) - added message in case where config.js is missing the module.export line PR #3383 - Fixed an issue where recurring events could extend past their recurrence end date (#3393) - Don't display any `npm WARN <....>` on install (#3399) - Fixed move suncalc dependency to production from dev, as it is used by clock module - [compliments] Fix mirror not responding anymore when no compliments are to be shown (#3385) ### Deleted - Unneeded file headers (#3358) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Michael Teeuw <michael@xonaymedia.nl> Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Karsten Hassel <hassel@gmx.de> Co-authored-by: Ross Younger <crazyscot@gmail.com> Co-authored-by: Bugsounet - Cédric <github@bugsounet.fr> Co-authored-by: jkriegshauser <joshuakr@nvidia.com> Co-authored-by: illimarkangur <116028111+illimarkangur@users.noreply.github.com> Co-authored-by: sam detweiler <sdetweil@gmail.com> Co-authored-by: vppencilsharpener <tim.pray@gmail.com> Co-authored-by: Paranoid93 <6515818+Paranoid93@users.noreply.github.com>
215 lines
7.1 KiB
JavaScript
215 lines
7.1 KiB
JavaScript
const helpers = require("../helpers/global-setup");
|
|
const serverBasicAuth = require("../helpers/basic-auth");
|
|
|
|
describe("Calendar module", () => {
|
|
|
|
/**
|
|
* @param {string} element css selector
|
|
* @param {string} result expected number
|
|
* @param {string} not reverse result
|
|
* @returns {boolean} result
|
|
*/
|
|
const testElementLength = async (element, result, not) => {
|
|
const elem = await helpers.waitForAllElements(element);
|
|
expect(elem).not.toBeNull();
|
|
if (not === "not") {
|
|
expect(elem).not.toHaveLength(result);
|
|
} else {
|
|
expect(elem).toHaveLength(result);
|
|
}
|
|
return true;
|
|
};
|
|
|
|
const testTextContain = async (element, text) => {
|
|
const elem = await helpers.waitForElement(element, "undefinedLoading");
|
|
expect(elem).not.toBeNull();
|
|
expect(elem.textContent).toContain(text);
|
|
return true;
|
|
};
|
|
|
|
afterAll(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
describe("Default configuration", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/default.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should show the default maximumEntries of 10", async () => {
|
|
await expect(testElementLength(".calendar .event", 10)).resolves.toBe(true);
|
|
});
|
|
|
|
it("should show the default calendar symbol in each event", async () => {
|
|
await expect(testElementLength(".calendar .event .fa-calendar-alt", 0, "not")).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Custom configuration", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/custom.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should show the custom maximumEntries of 5", async () => {
|
|
await expect(testElementLength(".calendar .event", 5)).resolves.toBe(true);
|
|
});
|
|
|
|
it("should show the custom calendar symbol in four events", async () => {
|
|
await expect(testElementLength(".calendar .event .fa-birthday-cake", 4)).resolves.toBe(true);
|
|
});
|
|
|
|
it("should show a customEvent calendar symbol in one event", async () => {
|
|
await expect(testElementLength(".calendar .event .fa-dice", 1)).resolves.toBe(true);
|
|
});
|
|
|
|
it("should show a customEvent calendar eventClass in one event", async () => {
|
|
await expect(testElementLength(".calendar .event.undo", 1)).resolves.toBe(true);
|
|
});
|
|
|
|
it("should show two custom icons for repeating events", async () => {
|
|
await expect(testElementLength(".calendar .event .fa-undo", 2)).resolves.toBe(true);
|
|
});
|
|
|
|
it("should show two custom icons for day events", async () => {
|
|
await expect(testElementLength(".calendar .event .fa-calendar-day", 2)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Recurring event", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/recurring.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should show the recurring birthday event 6 times", async () => {
|
|
await expect(testElementLength(".calendar .event", 6)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Events from multiple calendars", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/show-duplicates-in-calendar.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should show multiple events with the same title and start time from different calendars", async () => {
|
|
await expect(testElementLength(".calendar .event", 22)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
//Will contain everyday an fullDayEvent that starts today and ends tomorrow, and one starting tomorrow and ending the day after tomorrow
|
|
describe("FullDayEvent over several days should show how many days are left from the from the starting date on", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/long-fullday-event.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should contain text 'Ends in' with the left days", async () => {
|
|
await expect(testTextContain(".calendar .today .time", "Ends in")).resolves.toBe(true);
|
|
await expect(testTextContain(".calendar .yesterday .time", "Today")).resolves.toBe(true);
|
|
await expect(testTextContain(".calendar .tomorrow .time", "Tomorrow")).resolves.toBe(true);
|
|
});
|
|
it("should contain in total three events", async () => {
|
|
await expect(testElementLength(".calendar .event", 3)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("FullDayEvent Single day, should show Today", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/single-fullday-event.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should contain text 'Today'", async () => {
|
|
await expect(testTextContain(".calendar .time", "Today")).resolves.toBe(true);
|
|
});
|
|
it("should contain in total two events", async () => {
|
|
await expect(testElementLength(".calendar .event", 2)).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
process.setMaxListeners(0);
|
|
for (let i = -12; i < 12; i++) {
|
|
describe("Recurring event per timezone", () => {
|
|
beforeAll(async () => {
|
|
Date.prototype.getTimezoneOffset = () => {
|
|
return i * 60;
|
|
};
|
|
await helpers.startApplication("tests/configs/modules/calendar/recurring.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it(`should contain text "Mar 25th" in timezone UTC ${-i}`, async () => {
|
|
await expect(testTextContain(".calendar", "Mar 25th")).resolves.toBe(true);
|
|
});
|
|
});
|
|
}
|
|
|
|
describe("Changed port", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/changed-port.js");
|
|
serverBasicAuth.listen(8010);
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await serverBasicAuth.close();
|
|
});
|
|
|
|
it("should return TestEvents", async () => {
|
|
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Basic auth", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/basic-auth.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should return TestEvents", async () => {
|
|
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Basic auth by default", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/auth-default.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should return TestEvents", async () => {
|
|
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Basic auth backward compatibility configuration: DEPRECATED", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/old-basic-auth.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("should return TestEvents", async () => {
|
|
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
|
});
|
|
});
|
|
|
|
describe("Fail Basic auth", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/calendar/fail-basic-auth.js");
|
|
serverBasicAuth.listen(8020);
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await serverBasicAuth.close();
|
|
});
|
|
|
|
it("should show Unauthorized error", async () => {
|
|
await expect(testTextContain(".calendar", "Error in the calendar module. Authorization failed")).resolves.toBe(true);
|
|
});
|
|
});
|
|
});
|