From aeb3ccaf093c8ad3ffdb991fbdade7c91fd358ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Tue, 31 Jan 2017 17:02:18 -0300
Subject: [PATCH 1/2] Remove extra spaces and lines in tests.
---
tests/e2e/modules/clock_spec.js | 12 +++++-------
tests/e2e/modules/helloworld_spec.js | 2 --
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/tests/e2e/modules/clock_spec.js b/tests/e2e/modules/clock_spec.js
index 860cc6f0..69e940ac 100644
--- a/tests/e2e/modules/clock_spec.js
+++ b/tests/e2e/modules/clock_spec.js
@@ -3,8 +3,6 @@ const path = require("path");
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
-
-
var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
if (process.platform === "win32") {
@@ -43,13 +41,13 @@ describe("Clock module", function () {
it("shows date with correct format", function () {
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
return app.client.waitUntilWindowLoaded()
- .getText(".clock .date").should.eventually.match(dateRegex);
+ .getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 24hr format", function() {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/
return app.client.waitUntilWindowLoaded()
- .getText(".clock .time").should.eventually.match(timeRegex);
+ .getText(".clock .time").should.eventually.match(timeRegex);
});
});
@@ -70,13 +68,13 @@ describe("Clock module", function () {
it("shows date with correct format", function () {
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
return app.client.waitUntilWindowLoaded()
- .getText(".clock .date").should.eventually.match(dateRegex);
+ .getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 12hr format", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded()
- .getText(".clock .time").should.eventually.match(timeRegex);
+ .getText(".clock .time").should.eventually.match(timeRegex);
});
});
@@ -97,7 +95,7 @@ describe("Clock module", function () {
it("shows 12hr time with upper case AM/PM", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
return app.client.waitUntilWindowLoaded()
- .getText(".clock .time").should.eventually.match(timeRegex);
+ .getText(".clock .time").should.eventually.match(timeRegex);
});
});
});
diff --git a/tests/e2e/modules/helloworld_spec.js b/tests/e2e/modules/helloworld_spec.js
index 7bb13381..fc3b3291 100644
--- a/tests/e2e/modules/helloworld_spec.js
+++ b/tests/e2e/modules/helloworld_spec.js
@@ -3,8 +3,6 @@ const path = require("path");
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
-
-
var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
if (process.platform === "win32") {
From c6f5c120baa5299913a4cfab6f714f8eda964375 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rodrigo=20Ram=C3=ADrez=20Norambuena?=
Date: Wed, 1 Feb 2017 14:10:12 -0300
Subject: [PATCH 2/2] add tests clock module variant language es
---
tests/configs/modules/clock/es/clock_12hr.js | 29 +++++
tests/configs/modules/clock/es/clock_24hr.js | 29 +++++
.../modules/clock/es/clock_showPeriodUpper.js | 32 ++++++
tests/e2e/modules/clock_es_spec.js | 101 ++++++++++++++++++
4 files changed, 191 insertions(+)
create mode 100644 tests/configs/modules/clock/es/clock_12hr.js
create mode 100644 tests/configs/modules/clock/es/clock_24hr.js
create mode 100644 tests/configs/modules/clock/es/clock_showPeriodUpper.js
create mode 100644 tests/e2e/modules/clock_es_spec.js
diff --git a/tests/configs/modules/clock/es/clock_12hr.js b/tests/configs/modules/clock/es/clock_12hr.js
new file mode 100644
index 00000000..d546e608
--- /dev/null
+++ b/tests/configs/modules/clock/es/clock_12hr.js
@@ -0,0 +1,29 @@
+/* Magic Mirror Test config for default clock module
+ *
+ * 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: "es",
+ timeFormat: 12,
+ units: "metric",
+ electronOptions: {
+ webPreferences: {
+ nodeIntegration: true,
+ },
+ },
+
+ modules: [
+ {
+ module: "clock",
+ position: "middle_center"
+ }
+ ]
+};
+
+/*************** DO NOT EDIT THE LINE BELOW ***************/
+if (typeof module !== "undefined") {module.exports = config;}
diff --git a/tests/configs/modules/clock/es/clock_24hr.js b/tests/configs/modules/clock/es/clock_24hr.js
new file mode 100644
index 00000000..abdf7a44
--- /dev/null
+++ b/tests/configs/modules/clock/es/clock_24hr.js
@@ -0,0 +1,29 @@
+/* Magic Mirror Test config for default clock module
+ *
+ * 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: "es",
+ timeFormat: 24,
+ units: "metric",
+ electronOptions: {
+ webPreferences: {
+ nodeIntegration: true,
+ },
+ },
+
+ modules: [
+ {
+ module: "clock",
+ position: "middle_center"
+ }
+ ]
+};
+
+/*************** DO NOT EDIT THE LINE BELOW ***************/
+if (typeof module !== "undefined") {module.exports = config;}
diff --git a/tests/configs/modules/clock/es/clock_showPeriodUpper.js b/tests/configs/modules/clock/es/clock_showPeriodUpper.js
new file mode 100644
index 00000000..6bb396db
--- /dev/null
+++ b/tests/configs/modules/clock/es/clock_showPeriodUpper.js
@@ -0,0 +1,32 @@
+/* Magic Mirror Test config for default clock module
+ *
+ * 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: "es",
+ timeFormat: 12,
+ units: "metric",
+ electronOptions: {
+ webPreferences: {
+ nodeIntegration: true,
+ },
+ },
+
+ modules: [
+ {
+ module: "clock",
+ position: "middle_center",
+ config: {
+ showPeriodUpper: true
+ }
+ }
+ ]
+};
+
+/*************** DO NOT EDIT THE LINE BELOW ***************/
+if (typeof module !== "undefined") {module.exports = config;}
diff --git a/tests/e2e/modules/clock_es_spec.js b/tests/e2e/modules/clock_es_spec.js
new file mode 100644
index 00000000..72aee74c
--- /dev/null
+++ b/tests/e2e/modules/clock_es_spec.js
@@ -0,0 +1,101 @@
+const Application = require("spectron").Application;
+const path = require("path");
+const chai = require("chai");
+const chaiAsPromised = require("chai-as-promised");
+
+var electronPath = path.join(__dirname, "../../../", "node_modules", ".bin", "electron");
+
+if (process.platform === "win32") {
+ electronPath += ".cmd";
+}
+
+var appPath = path.join(__dirname, "../../../js/electron.js");
+
+var app = new Application({
+ path: electronPath,
+ args: [appPath]
+});
+
+global.before(function () {
+ chai.should();
+ chai.use(chaiAsPromised);
+});
+
+describe("Clock set to spanish language module", function () {
+ this.timeout(10000);
+
+ describe("with default 24hr clock config", function() {
+ before(function() {
+ // Set config sample for use in test
+ process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js";
+ });
+
+ beforeEach(function (done) {
+ app.start().then(function() { done(); } );
+ });
+
+ afterEach(function (done) {
+ app.stop().then(function() { done(); });
+ });
+
+ it("shows date with correct format", function () {
+ const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sabado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
+ return app.client.waitUntilWindowLoaded()
+ .getText(".clock .date").should.eventually.match(dateRegex);
+ });
+
+ it("shows time in 24hr format", function() {
+ const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/
+ return app.client.waitUntilWindowLoaded()
+ .getText(".clock .time").should.eventually.match(timeRegex);
+ });
+ });
+
+ describe("with default 12hr clock config", function() {
+ before(function() {
+ // Set config sample for use in test
+ process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js";
+ });
+
+ beforeEach(function (done) {
+ app.start().then(function() { done(); } );
+ });
+
+ afterEach(function (done) {
+ app.stop().then(function() { done(); });
+ });
+
+ it("shows date with correct format", function () {
+ const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sabado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
+ return app.client.waitUntilWindowLoaded()
+ .getText(".clock .date").should.eventually.match(dateRegex);
+ });
+
+ it("shows time in 12hr format", function() {
+ const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
+ return app.client.waitUntilWindowLoaded()
+ .getText(".clock .time").should.eventually.match(timeRegex);
+ });
+ });
+
+ describe("with showPeriodUpper config enabled", function() {
+ before(function() {
+ // Set config sample for use in test
+ process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js";
+ });
+
+ beforeEach(function (done) {
+ app.start().then(function() { done(); } );
+ });
+
+ afterEach(function (done) {
+ app.stop().then(function() { done(); });
+ });
+
+ it("shows 12hr time with upper case AM/PM", function() {
+ const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
+ return app.client.waitUntilWindowLoaded()
+ .getText(".clock .time").should.eventually.match(timeRegex);
+ });
+ });
+});