From 1a296a8ca12af38154201336ba30a23ee90451ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Sat, 18 Feb 2017 23:38:39 -0300 Subject: [PATCH 1/2] Test anytime compliments module. feature introduced 79c79146a5df730cb8e8eee1cc1008639a2c21c7 --- .../compliments/compliments_anytime.js | 38 +++++++++++++++++++ tests/e2e/modules/compliments_spec.js | 23 +++++++++++ 2 files changed, 61 insertions(+) create mode 100644 tests/configs/modules/compliments/compliments_anytime.js diff --git a/tests/configs/modules/compliments/compliments_anytime.js b/tests/configs/modules/compliments/compliments_anytime.js new file mode 100644 index 00000000..06878f52 --- /dev/null +++ b/tests/configs/modules/compliments/compliments_anytime.js @@ -0,0 +1,38 @@ +/* Magic Mirror Test config compliments with anytime type + * + * 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, + }, + }, + + modules: [ + { + module: "compliments", + position: "middle_center", + config: { + compliments: { + morning: ["Good Morning"], + afternoon: ["Good Afternoon"], + evening: ["Good Evening"], + anytime: ["Anytime here"] + + } + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") {module.exports = config;} diff --git a/tests/e2e/modules/compliments_spec.js b/tests/e2e/modules/compliments_spec.js index 794ed400..f2840f9d 100644 --- a/tests/e2e/modules/compliments_spec.js +++ b/tests/e2e/modules/compliments_spec.js @@ -75,4 +75,27 @@ describe("Compliments module", function () { }); + + describe("Tests anytime for compliments", function() { + before(function() { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js"; + }); + + beforeEach(function (done) { + app.start().then(function() { done(); } ); + }); + + afterEach(function (done) { + app.stop().then(function() { done(); }); + }); + + it("Show anytime or parts of day compliments", function () { + return app.client.waitUntilWindowLoaded() + .getText(".compliments").then(function (text) { + expect(text).to.be.oneOf(["Good Morning", "Good Evening", "Good Afternoon", "Anytime here"]); + }) + }); + }); + }); From 97ab88b39a36b6704bfcc7b87c106fa5625825f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?= Date: Mon, 20 Feb 2017 01:52:07 -0300 Subject: [PATCH 2/2] Modified test compliments anytime this follow configuration: { morning: [], afternoon: [], evening: [], anytime: ["Anytime here"] } --- tests/configs/modules/compliments/compliments_anytime.js | 6 +++--- tests/e2e/modules/compliments_spec.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/configs/modules/compliments/compliments_anytime.js b/tests/configs/modules/compliments/compliments_anytime.js index 06878f52..1d2818bc 100644 --- a/tests/configs/modules/compliments/compliments_anytime.js +++ b/tests/configs/modules/compliments/compliments_anytime.js @@ -23,9 +23,9 @@ var config = { position: "middle_center", config: { compliments: { - morning: ["Good Morning"], - afternoon: ["Good Afternoon"], - evening: ["Good Evening"], + morning: [], + afternoon: [], + evening: [], anytime: ["Anytime here"] } diff --git a/tests/e2e/modules/compliments_spec.js b/tests/e2e/modules/compliments_spec.js index f2840f9d..d71b07c6 100644 --- a/tests/e2e/modules/compliments_spec.js +++ b/tests/e2e/modules/compliments_spec.js @@ -90,10 +90,10 @@ describe("Compliments module", function () { app.stop().then(function() { done(); }); }); - it("Show anytime or parts of day compliments", function () { + it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () { return app.client.waitUntilWindowLoaded() .getText(".compliments").then(function (text) { - expect(text).to.be.oneOf(["Good Morning", "Good Evening", "Good Afternoon", "Anytime here"]); + expect(text).to.be.oneOf(["Anytime here"]); }) }); });