Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

calendar_spec.js 4.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. const helpers = require("../global-setup");
  2. const serverBasicAuth = require("./basic-auth.js");
  3. describe("Calendar module", function () {
  4. helpers.setupTimeout(this);
  5. let app = null;
  6. beforeEach(function () {
  7. return helpers
  8. .startApplication({
  9. args: ["js/electron.js"]
  10. })
  11. .then(function (startedApp) {
  12. app = startedApp;
  13. });
  14. });
  15. afterEach(function () {
  16. return helpers.stopApplication(app);
  17. });
  18. describe("Default configuration", function () {
  19. beforeAll(function () {
  20. // Set config sample for use in test
  21. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
  22. });
  23. it("should show the default maximumEntries of 10", async () => {
  24. await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  25. const events = await app.client.$$(".calendar .event");
  26. return expect(events.length).toBe(10);
  27. });
  28. it("should show the default calendar symbol in each event", async () => {
  29. await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  30. const icons = await app.client.$$(".calendar .event .fa-calendar");
  31. return expect(icons.length).not.toBe(0);
  32. });
  33. });
  34. describe("Custom configuration", function () {
  35. beforeAll(function () {
  36. // Set config sample for use in test
  37. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/custom.js";
  38. });
  39. it("should show the custom maximumEntries of 4", async () => {
  40. await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  41. const events = await app.client.$$(".calendar .event");
  42. return expect(events.length).toBe(4);
  43. });
  44. it("should show the custom calendar symbol in each event", async () => {
  45. await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  46. const icons = await app.client.$$(".calendar .event .fa-birthday-cake");
  47. return expect(icons.length).toBe(4);
  48. });
  49. it("should show two custom icons for repeating events", async () => {
  50. await app.client.waitUntilTextExists(".calendar", "TestEventRepeat", 10000);
  51. const icons = await app.client.$$(".calendar .event .fa-undo");
  52. return expect(icons.length).toBe(2);
  53. });
  54. it("should show two custom icons for day events", async () => {
  55. await app.client.waitUntilTextExists(".calendar", "TestEventDay", 10000);
  56. const icons = await app.client.$$(".calendar .event .fa-calendar-day");
  57. return expect(icons.length).toBe(2);
  58. });
  59. });
  60. describe("Recurring event", function () {
  61. beforeAll(function () {
  62. // Set config sample for use in test
  63. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/recurring.js";
  64. });
  65. it("should show the recurring birthday event 6 times", async () => {
  66. await app.client.waitUntilTextExists(".calendar", "Mar 25th", 10000);
  67. const events = await app.client.$$(".calendar .event");
  68. return expect(events.length).toBe(6);
  69. });
  70. });
  71. describe("Changed port", function () {
  72. beforeAll(function () {
  73. serverBasicAuth.listen(8010);
  74. // Set config sample for use in test
  75. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/changed-port.js";
  76. });
  77. afterAll(function (done) {
  78. serverBasicAuth.close(done());
  79. });
  80. it("should return TestEvents", function () {
  81. return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  82. });
  83. });
  84. describe("Basic auth", function () {
  85. beforeAll(function () {
  86. // Set config sample for use in test
  87. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
  88. });
  89. it("should return TestEvents", function () {
  90. return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  91. });
  92. });
  93. describe("Basic auth by default", function () {
  94. beforeAll(function () {
  95. // Set config sample for use in test
  96. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
  97. });
  98. it("should return TestEvents", function () {
  99. return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  100. });
  101. });
  102. describe("Basic auth backward compatibility configuration: DEPRECATED", function () {
  103. beforeAll(function () {
  104. // Set config sample for use in test
  105. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
  106. });
  107. it("should return TestEvents", function () {
  108. return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
  109. });
  110. });
  111. describe("Fail Basic auth", function () {
  112. beforeAll(function () {
  113. serverBasicAuth.listen(8020);
  114. // Set config sample for use in test
  115. process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/fail-basic-auth.js";
  116. });
  117. afterAll(function (done) {
  118. serverBasicAuth.close(done());
  119. });
  120. it("should show Unauthorized error", function () {
  121. return app.client.waitUntilTextExists(".calendar", "Error in the calendar module. Authorization failed", 10000);
  122. });
  123. });
  124. });