From bdc4ed4d864a149863d6e9d001595b8a7d5ebdd1 Mon Sep 17 00:00:00 2001 From: rejas Date: Thu, 11 Feb 2021 22:18:51 +0100 Subject: [PATCH] Add specific change-port test and fix the others --- .../configs/modules/calendar/changed-port.js | 44 +++++++++++++++++++ .../modules/calendar/fail-basic-auth.js | 2 +- tests/e2e/modules/calendar_spec.js | 25 ++++++----- 3 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 tests/configs/modules/calendar/changed-port.js diff --git a/tests/configs/modules/calendar/changed-port.js b/tests/configs/modules/calendar/changed-port.js new file mode 100644 index 00000000..fa0f7ae7 --- /dev/null +++ b/tests/configs/modules/calendar/changed-port.js @@ -0,0 +1,44 @@ +/* Magic Mirror Test config default calendar with auth by default + * + * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com + * MIT Licensed. + */ + +var 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: [ + { + maximumNumberOfDays: 10000, + url: "http://localhost:8010/tests/configs/data/calendar_test.ics", + auth: { + user: "MagicMirror", + pass: "CallMeADog" + } + } + ] + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/configs/modules/calendar/fail-basic-auth.js b/tests/configs/modules/calendar/fail-basic-auth.js index b5856589..7ccb8bce 100644 --- a/tests/configs/modules/calendar/fail-basic-auth.js +++ b/tests/configs/modules/calendar/fail-basic-auth.js @@ -28,7 +28,7 @@ var config = { calendars: [ { maximumNumberOfDays: 10000, - url: "http://localhost:8080/tests/configs/data/calendar_test.ics", + url: "http://localhost:8020/tests/configs/data/calendar_test.ics", auth: { user: "MagicMirror", pass: "StairwayToHeaven", diff --git a/tests/e2e/modules/calendar_spec.js b/tests/e2e/modules/calendar_spec.js index 3712871c..8d9b0c5a 100644 --- a/tests/e2e/modules/calendar_spec.js +++ b/tests/e2e/modules/calendar_spec.js @@ -76,11 +76,11 @@ describe("Calendar module", function () { }); }); - describe("Basic auth", function () { + describe("Changed port", function () { before(function () { serverBasicAuth.listen(8010); // Set config sample for use in test - process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js"; + process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/changed-port.js"; }); after(function (done) { @@ -92,17 +92,23 @@ describe("Calendar module", function () { }); }); + describe("Basic auth", function () { + before(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js"; + }); + + it("should return TestEvents", function () { + return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); + }); + }); + describe("Basic auth by default", function () { before(function () { - serverBasicAuth.listen(8011); // Set config sample for use in test process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js"; }); - after(function (done) { - serverBasicAuth.close(done()); - }); - it("should return TestEvents", function () { return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); }); @@ -110,15 +116,10 @@ describe("Calendar module", function () { describe("Basic auth backward compatibility configuration: DEPRECATED", function () { before(function () { - serverBasicAuth.listen(8012); // Set config sample for use in test process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js"; }); - after(function (done) { - serverBasicAuth.close(done()); - }); - it("should return TestEvents", function () { return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); });