From f750436b64c54a090767d2c88a36e87da3138356 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Sun, 26 Sep 2021 22:09:41 +0200 Subject: [PATCH] update module clock_es --- tests/configs/modules/clock/es/clock_12hr.js | 7 +- tests/configs/modules/clock/es/clock_24hr.js | 8 +- .../modules/clock/es/clock_showPeriodUpper.js | 7 +- .../modules/clock/es/clock_showWeek.js | 7 +- tests/e2e/modules/clock_es_spec.js | 71 +++++++++++++++ tests/electron/modules/clock_es_spec.js | 86 ------------------- 6 files changed, 92 insertions(+), 94 deletions(-) create mode 100644 tests/e2e/modules/clock_es_spec.js delete mode 100644 tests/electron/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 index addbeb9f..57d1c7a9 100644 --- a/tests/configs/modules/clock/es/clock_12hr.js +++ b/tests/configs/modules/clock/es/clock_12hr.js @@ -3,9 +3,12 @@ * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. */ -let config = require(process.cwd() + "/tests/configs/default.js").configFactory({ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], language: "es", timeFormat: 12, + units: "metric", modules: [ { @@ -13,7 +16,7 @@ let config = require(process.cwd() + "/tests/configs/default.js").configFactory( position: "middle_center" } ] -}); +}; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { diff --git a/tests/configs/modules/clock/es/clock_24hr.js b/tests/configs/modules/clock/es/clock_24hr.js index a5fe49ca..60cfa109 100644 --- a/tests/configs/modules/clock/es/clock_24hr.js +++ b/tests/configs/modules/clock/es/clock_24hr.js @@ -3,8 +3,12 @@ * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. */ -let config = require(process.cwd() + "/tests/configs/default.js").configFactory({ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], language: "es", + timeFormat: 24, + units: "metric", modules: [ { @@ -12,7 +16,7 @@ let config = require(process.cwd() + "/tests/configs/default.js").configFactory( position: "middle_center" } ] -}); +}; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { diff --git a/tests/configs/modules/clock/es/clock_showPeriodUpper.js b/tests/configs/modules/clock/es/clock_showPeriodUpper.js index 4a5ab636..5d0c28bb 100644 --- a/tests/configs/modules/clock/es/clock_showPeriodUpper.js +++ b/tests/configs/modules/clock/es/clock_showPeriodUpper.js @@ -3,9 +3,12 @@ * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. */ -let config = require(process.cwd() + "/tests/configs/default.js").configFactory({ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], language: "es", timeFormat: 12, + units: "metric", modules: [ { @@ -16,7 +19,7 @@ let config = require(process.cwd() + "/tests/configs/default.js").configFactory( } } ] -}); +}; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { diff --git a/tests/configs/modules/clock/es/clock_showWeek.js b/tests/configs/modules/clock/es/clock_showWeek.js index b4a436a6..f8f71982 100644 --- a/tests/configs/modules/clock/es/clock_showWeek.js +++ b/tests/configs/modules/clock/es/clock_showWeek.js @@ -4,9 +4,12 @@ * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. */ -let config = require(process.cwd() + "/tests/configs/default.js").configFactory({ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], language: "es", timeFormat: 12, + units: "metric", modules: [ { @@ -17,7 +20,7 @@ let config = require(process.cwd() + "/tests/configs/default.js").configFactory( } } ] -}); +}; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { diff --git a/tests/e2e/modules/clock_es_spec.js b/tests/e2e/modules/clock_es_spec.js new file mode 100644 index 00000000..78818014 --- /dev/null +++ b/tests/e2e/modules/clock_es_spec.js @@ -0,0 +1,71 @@ +const helpers = require("../global-setup"); + +describe("Clock set to spanish language module", function () { + afterAll(function () { + helpers.stopApplication(); + }); + + const testMatch = function (element, regex) { + const elem = document.querySelector(element); + expect(elem).not.toBe(null); + expect(elem.textContent).toMatch(regex); + }; + + describe("with default 24hr clock config", function () { + beforeAll(function (done) { + helpers.startApplication("tests/configs/modules/clock/es/clock_24hr.js"); + helpers.getDocument(done, 1000); + }); + + it("shows date with correct format", function () { + const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/; + testMatch(".clock .date", dateRegex); + }); + + it("shows time in 24hr format", function () { + const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/; + testMatch(".clock .time", timeRegex); + }); + }); + + describe("with default 12hr clock config", function () { + beforeAll(function (done) { + helpers.startApplication("tests/configs/modules/clock/es/clock_12hr.js"); + helpers.getDocument(done, 1000); + }); + + it("shows date with correct format", function () { + const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/; + testMatch(".clock .date", dateRegex); + }); + + it("shows time in 12hr format", function () { + const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/; + testMatch(".clock .time", timeRegex); + }); + }); + + describe("with showPeriodUpper config enabled", function () { + beforeAll(function (done) { + helpers.startApplication("tests/configs/modules/clock/es/clock_showPeriodUpper.js"); + helpers.getDocument(done, 1000); + }); + + 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$/; + testMatch(".clock .time", timeRegex); + }); + }); + + describe("with showWeek config enabled", function () { + beforeAll(function (done) { + helpers.startApplication("tests/configs/modules/clock/es/clock_showWeek.js"); + helpers.getDocument(done, 1000); + }); + + it("shows week with correct format", function () { + const weekRegex = /^Semana [0-9]{1,2}$/; + testMatch(".clock .week", weekRegex); + }); + }); +}); diff --git a/tests/electron/modules/clock_es_spec.js b/tests/electron/modules/clock_es_spec.js deleted file mode 100644 index 4c39a241..00000000 --- a/tests/electron/modules/clock_es_spec.js +++ /dev/null @@ -1,86 +0,0 @@ -const helpers = require("../global-setup"); - -describe("Clock set to spanish language module", function () { - helpers.setupTimeout(this); - - let app = null; - - const testMatch = async function (element, regex) { - await app.client.waitUntilWindowLoaded(); - const elem = await app.client.$(element); - const txt = await elem.getText(element); - return expect(txt).toMatch(regex); - }; - - beforeEach(function () { - return helpers - .startApplication({ - args: ["js/electron.js"] - }) - .then(function (startedApp) { - app = startedApp; - }); - }); - - afterEach(function () { - return helpers.stopApplication(app); - }); - - describe("with default 24hr clock config", function () { - beforeAll(function () { - // Set config sample for use in test - process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js"; - }); - - it("shows date with correct format", async function () { - const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/; - return testMatch(".clock .date", dateRegex); - }); - - it("shows time in 24hr format", async function () { - const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/; - return testMatch(".clock .time", timeRegex); - }); - }); - - describe("with default 12hr clock config", function () { - beforeAll(function () { - // Set config sample for use in test - process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js"; - }); - - it("shows date with correct format", async function () { - const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/; - return testMatch(".clock .date", dateRegex); - }); - - it("shows time in 12hr format", async function () { - const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/; - return testMatch(".clock .time", timeRegex); - }); - }); - - describe("with showPeriodUpper config enabled", function () { - beforeAll(function () { - // Set config sample for use in test - process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js"; - }); - - it("shows 12hr time with upper case AM/PM", async function () { - const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/; - return testMatch(".clock .time", timeRegex); - }); - }); - - describe("with showWeek config enabled", function () { - beforeAll(function () { - // Set config sample for use in test - process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showWeek.js"; - }); - - it("shows week with correct format", async function () { - const weekRegex = /^Semana [0-9]{1,2}$/; - return testMatch(".clock .week", weekRegex); - }); - }); -});