From 40c1521591f49bd9fb4b33cd9018a3e82c91bddc Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 22 Apr 2021 10:43:10 +0200 Subject: [PATCH 1/3] Add test data --- .../configs/data/calendar_test_recurring.ics | 37 ++++++++++++++++ tests/configs/modules/calendar/recurring.js | 43 +++++++++++++++++++ tests/e2e/modules/calendar_spec.js | 14 ++++++ 3 files changed, 94 insertions(+) create mode 100644 tests/configs/data/calendar_test_recurring.ics create mode 100644 tests/configs/modules/calendar/recurring.js diff --git a/tests/configs/data/calendar_test_recurring.ics b/tests/configs/data/calendar_test_recurring.ics new file mode 100644 index 00000000..5d063fa1 --- /dev/null +++ b/tests/configs/data/calendar_test_recurring.ics @@ -0,0 +1,37 @@ +BEGIN:VCALENDAR +PRODID:-//Google Inc//Google Calendar 70.9054//EN +VERSION:2.0 +CALSCALE:GREGORIAN +METHOD:PUBLISH +X-WR-CALNAME:xxx@gmail.com +X-WR-TIMEZONE:Europe/Zurich +BEGIN:VTIMEZONE +TZID:Etc/UTC +X-LIC-LOCATION:Etc/UTC +BEGIN:STANDARD +TZOFFSETFROM:+0000 +TZOFFSETTO:+0000 +TZNAME:GMT +DTSTART:19700101T00000--äüüßßß-0 +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +DTSTART;VALUE=DATE:20210325 +DTEND;VALUE=DATE:20210326 +RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTHDAY=25 +DTSTAMP:20210421T154106Z +UID:zzz@google.com +REATED:20200831T200244Z +DESCRIPTION: +LAST-MODIFIED:20200831T200244Z +LOCATION: +SEQUENCE:0 +STATUS:CONFIRMED +SUMMARY:Birthday +TRANSP:OPAQUE +BEGIN:VALARM +ACTION:DISPLAY +DESCRIPTION:This is an event reminder +TRIGGER:-P0DT7H0M0S +END:VALARM +END:VEVENT diff --git a/tests/configs/modules/calendar/recurring.js b/tests/configs/modules/calendar/recurring.js new file mode 100644 index 00000000..62417200 --- /dev/null +++ b/tests/configs/modules/calendar/recurring.js @@ -0,0 +1,43 @@ +/* Magic Mirror Test config custom calendar + * + * By Rejas + * MIT Licensed. + */ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 12, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true, + enableRemoteModule: true + } + }, + + modules: [ + { + module: "calendar", + position: "bottom_bar", + config: { + calendars: [ + { + maximumEntries: 4, + maximumNumberOfDays: 10000, + symbol: "birthday-cake", + fullDaySymbol: "calendar-day", + recurringSymbol: "undo", + url: "http://localhost:8080/tests/configs/data/calendar_test_recurring.ics" + } + ] + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules/calendar_spec.js b/tests/e2e/modules/calendar_spec.js index 34cc0164..10357e5b 100644 --- a/tests/e2e/modules/calendar_spec.js +++ b/tests/e2e/modules/calendar_spec.js @@ -76,6 +76,20 @@ describe("Calendar module", function () { }); }); + describe("Recurring event", function () { + before(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/recurring.js"; + }); + + it("should something correct", async () => { + // TODO add real test case + await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); + const events = await app.client.$$(".calendar .event"); + return expect(events.length).equals(4); + }); + }); + describe("Changed port", function () { before(function () { serverBasicAuth.listen(8010); From 87d543eb3aa1c166704d5b3de9f9851001163214 Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 2 May 2021 15:07:02 +0200 Subject: [PATCH 2/3] Finish test case --- tests/configs/data/calendar_test_recurring.ics | 2 +- tests/configs/modules/calendar/recurring.js | 7 ++----- tests/e2e/modules/calendar_spec.js | 7 +++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/configs/data/calendar_test_recurring.ics b/tests/configs/data/calendar_test_recurring.ics index 5d063fa1..635497da 100644 --- a/tests/configs/data/calendar_test_recurring.ics +++ b/tests/configs/data/calendar_test_recurring.ics @@ -18,7 +18,7 @@ END:VTIMEZONE BEGIN:VEVENT DTSTART;VALUE=DATE:20210325 DTEND;VALUE=DATE:20210326 -RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1;BYMONTHDAY=25 +RRULE:FREQ=YEARLY;WKST=MO;INTERVAL=1 DTSTAMP:20210421T154106Z UID:zzz@google.com REATED:20200831T200244Z diff --git a/tests/configs/modules/calendar/recurring.js b/tests/configs/modules/calendar/recurring.js index 62417200..371446a3 100644 --- a/tests/configs/modules/calendar/recurring.js +++ b/tests/configs/modules/calendar/recurring.js @@ -24,11 +24,8 @@ let config = { config: { calendars: [ { - maximumEntries: 4, - maximumNumberOfDays: 10000, - symbol: "birthday-cake", - fullDaySymbol: "calendar-day", - recurringSymbol: "undo", + maximumEntries: 6, + maximumNumberOfDays: 3650, url: "http://localhost:8080/tests/configs/data/calendar_test_recurring.ics" } ] diff --git a/tests/e2e/modules/calendar_spec.js b/tests/e2e/modules/calendar_spec.js index 10357e5b..a5cbe55a 100644 --- a/tests/e2e/modules/calendar_spec.js +++ b/tests/e2e/modules/calendar_spec.js @@ -82,11 +82,10 @@ describe("Calendar module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/recurring.js"; }); - it("should something correct", async () => { - // TODO add real test case - await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); + it("should show the recurring birthday event 6 times", async () => { + await app.client.waitUntilTextExists(".calendar", "Mar 25th", 10000); const events = await app.client.$$(".calendar .event"); - return expect(events.length).equals(4); + return expect(events.length).equals(6); }); }); From 591c9e53b0a81e0ae084fdced9e57bf868314e29 Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 2 May 2021 15:07:49 +0200 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5735a60a..25a28f61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ Special thanks to the following contributors: @B1gG, @codac, @ezeholz, @khassel, - Added first test for Alert module. - Added support for `dateFormat` when not using `timeFormat: "absolute"` - Added custom-properties in css of core and modules for improved styling experience, see `custom.css.sample` file +- Added test case for recurring calendar events ### Updated