From 474695643f714d7638127d6dc538d9778ff00d49 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Mon, 20 Feb 2017 04:59:15 -0300
Subject: [PATCH 1/2] Second test case anytime feature module compliments
Suggested by @fewieden PL #725
---
.../compliments/compliments_only_anytime.js | 35 ++++++++++++++++
tests/e2e/modules/compliments_spec.js | 40 ++++++++++++++-----
2 files changed, 65 insertions(+), 10 deletions(-)
create mode 100644 tests/configs/modules/compliments/compliments_only_anytime.js
diff --git a/tests/configs/modules/compliments/compliments_only_anytime.js b/tests/configs/modules/compliments/compliments_only_anytime.js
new file mode 100644
index 00000000..f0189652
--- /dev/null
+++ b/tests/configs/modules/compliments/compliments_only_anytime.js
@@ -0,0 +1,35 @@
+/* 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: {
+ 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 972d4c3b..f82cd89d 100644
--- a/tests/e2e/modules/compliments_spec.js
+++ b/tests/e2e/modules/compliments_spec.js
@@ -57,11 +57,7 @@ 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";
- });
+ describe("Feature anytime in compliments module", function() {
beforeEach(function (done) {
app.start().then(function() { done(); } );
@@ -71,12 +67,36 @@ describe("Compliments module", function () {
app.stop().then(function() { done(); });
});
- 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(["Anytime here"]);
- })
+
+ describe("Set anytime and empty compliments for morning, evening and afternoon ", function() {
+ before(function() {
+ // Set config sample for use in test
+ process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
+ });
+
+ 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(["Anytime here"]);
+ })
+ });
});
+
+ describe("Only anytime present in configuration compliments", function() {
+ before(function() {
+ // Set config sample for use in test
+ process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_only_anytime.js";
+ });
+
+ it("Show anytime compliments", function () {
+ return app.client.waitUntilWindowLoaded()
+ .getText(".compliments").then(function (text) {
+ expect(text).to.be.oneOf(["Anytime here"]);
+ })
+ });
+ });
+
+
});
});
From 5af2768d33f4132dd405cf6945cb8dcfc93e7aff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Mon, 20 Feb 2017 05:25:16 -0300
Subject: [PATCH 2/2] refactor afterEach and beforeEach compliments_spec
---
tests/e2e/modules/compliments_spec.js | 29 ++++++++++-----------------
1 file changed, 11 insertions(+), 18 deletions(-)
diff --git a/tests/e2e/modules/compliments_spec.js b/tests/e2e/modules/compliments_spec.js
index f82cd89d..0dd2c411 100644
--- a/tests/e2e/modules/compliments_spec.js
+++ b/tests/e2e/modules/compliments_spec.js
@@ -6,21 +6,23 @@ const expect = chai.expect;
describe("Compliments module", function () {
this.timeout(20000);
+
+ beforeEach(function (done) {
+ app.start().then(function() { done(); } );
+ });
+
+ afterEach(function (done) {
+ app.stop().then(function() { done(); });
+ });
+
+
describe("parts of days", function() {
+
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_parts_day.js";
});
- beforeEach(function (done) {
- app.start().then(function() { done(); } );
- });
-
- afterEach(function (done) {
- app.stop().then(function() { done(); });
- });
-
-
it("if Morning compliments for that part of day", function () {
var hour = new Date().getHours();
if (hour >= 3 && hour < 12) {
@@ -59,15 +61,6 @@ describe("Compliments module", function () {
describe("Feature anytime in compliments module", function() {
- beforeEach(function (done) {
- app.start().then(function() { done(); } );
- });
-
- afterEach(function (done) {
- app.stop().then(function() { done(); });
- });
-
-
describe("Set anytime and empty compliments for morning, evening and afternoon ", function() {
before(function() {
// Set config sample for use in test