From 50f3f32ba8cab1c547438b32a13b367f6cb0b218 Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 19 Jul 2020 11:54:03 +0200 Subject: [PATCH] Add tests for custom icons --- tests/configs/data/calendar_test_icons.ics | 56 ++++++++++++++++++++++ tests/configs/modules/calendar/custom.js | 6 ++- tests/e2e/modules/calendar_spec.js | 18 +++++-- 3 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 tests/configs/data/calendar_test_icons.ics diff --git a/tests/configs/data/calendar_test_icons.ics b/tests/configs/data/calendar_test_icons.ics new file mode 100644 index 00000000..7f24060d --- /dev/null +++ b/tests/configs/data/calendar_test_icons.ics @@ -0,0 +1,56 @@ +BEGIN:VCALENDAR +VERSION:2.0 +PRODID:-//ical.marudot.com//iCal Event Maker +X-WR-CALNAME:TestEvents +NAME:TestEvents +CALSCALE:GREGORIAN +BEGIN:VTIMEZONE +TZID:Europe/Berlin +TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Berlin +X-LIC-LOCATION:Europe/Berlin +BEGIN:DAYLIGHT +TZOFFSETFROM:+0100 +TZOFFSETTO:+0200 +TZNAME:CEST +DTSTART:19700329T020000 +RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU +END:DAYLIGHT +BEGIN:STANDARD +TZOFFSETFROM:+0200 +TZOFFSETTO:+0100 +TZNAME:CET +DTSTART:19701025T030000 +RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU +END:STANDARD +END:VTIMEZONE +BEGIN:VEVENT +DTSTAMP:20200719T094531Z +UID:20200719T094531Z-1871115387@marudot.com +DTSTART;TZID=Europe/Berlin:20300101T120000 +DTEND;TZID=Europe/Berlin:20300101T130000 +SUMMARY:TestEvent +END:VEVENT +BEGIN:VEVENT +DTSTAMP:20200719T094531Z +UID:20200719T094531Z-1929725136@marudot.com +DTSTART;TZID=Europe/Berlin:20300701T120000 +RRULE:FREQ=YEARLY;BYMONTH=7;BYMONTHDAY=1 +DTEND;TZID=Europe/Berlin:20300701T130000 +SUMMARY:TestEventRepeat +END:VEVENT +BEGIN:VEVENT +DTSTAMP:20200719T094531Z +UID:20200719T094531Z-371801474@marudot.com +DTSTART;VALUE=DATE:20300401 +DTEND;VALUE=DATE:20300402 +SUMMARY:TestEventDay +END:VEVENT +BEGIN:VEVENT +DTSTAMP:20200719T094531Z +UID:20200719T094531Z-133401084@marudot.com +DTSTART;VALUE=DATE:20301001 +RRULE:FREQ=YEARLY;BYMONTH=10;BYMONTHDAY=1 +DTEND;VALUE=DATE:20301002 +SUMMARY:TestEventRepeatDay +END:VEVENT +END:VCALENDAR \ No newline at end of file diff --git a/tests/configs/modules/calendar/custom.js b/tests/configs/modules/calendar/custom.js index 48a735b7..2084419d 100644 --- a/tests/configs/modules/calendar/custom.js +++ b/tests/configs/modules/calendar/custom.js @@ -23,9 +23,11 @@ let config = { calendars: [ { symbol: "birthday-cake", - maximumEntries: 3, + fullDaySymbol: "calendar-day", + recurringSymbol: "undo", + maximumEntries: 4, maximumNumberOfDays: 10000, - url: "http://localhost:8080/tests/configs/data/calendar_test.ics" + url: "http://localhost:8080/tests/configs/data/calendar_test_icons.ics" } ] } diff --git a/tests/e2e/modules/calendar_spec.js b/tests/e2e/modules/calendar_spec.js index 806e4e4a..3712871c 100644 --- a/tests/e2e/modules/calendar_spec.js +++ b/tests/e2e/modules/calendar_spec.js @@ -51,16 +51,28 @@ describe("Calendar module", function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/custom.js"; }); - it("should show the custom maximumEntries of 3", async () => { + it("should show the custom maximumEntries of 4", async () => { await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); const events = await app.client.$$(".calendar .event"); - return expect(events.length).equals(3); + return expect(events.length).equals(4); }); it("should show the custom calendar symbol in each event", async () => { await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); const icons = await app.client.$$(".calendar .event .fa-birthday-cake"); - return expect(icons.length).not.equals(0); + return expect(icons.length).equals(4); + }); + + it("should show two custom icons for repeating events", async () => { + await app.client.waitUntilTextExists(".calendar", "TestEventRepeat", 10000); + const icons = await app.client.$$(".calendar .event .fa-undo"); + return expect(icons.length).equals(2); + }); + + it("should show two custom icons for day events", async () => { + await app.client.waitUntilTextExists(".calendar", "TestEventDay", 10000); + const icons = await app.client.$$(".calendar .event .fa-calendar-day"); + return expect(icons.length).equals(2); }); });