From c41fff8f5cefff7cb7177184e26a85aed43f062a Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 29 Aug 2021 20:00:42 +0200 Subject: [PATCH] Add test for showTime parameter --- tests/configs/modules/clock/clock_showTime.js | 23 +++++++++++++++++++ tests/e2e/modules/clock_spec.js | 14 +++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tests/configs/modules/clock/clock_showTime.js diff --git a/tests/configs/modules/clock/clock_showTime.js b/tests/configs/modules/clock/clock_showTime.js new file mode 100644 index 00000000..93dd83de --- /dev/null +++ b/tests/configs/modules/clock/clock_showTime.js @@ -0,0 +1,23 @@ +/* Magic Mirror Test config for default clock module + * + * By Johan Hammar + * MIT Licensed. + */ +let config = require(process.cwd() + "/tests/configs/default.js").configFactory({ + timeFormat: 12, + + modules: [ + { + module: "clock", + position: "middle_center", + config: { + showTime: false + } + } + ] +}); + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules/clock_spec.js b/tests/e2e/modules/clock_spec.js index 473c6f6a..57a2fa65 100644 --- a/tests/e2e/modules/clock_spec.js +++ b/tests/e2e/modules/clock_spec.js @@ -85,6 +85,20 @@ describe("Clock module", function () { }); }); + describe("with showTime config disabled", function () { + beforeAll(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showTime.js"; + }); + + it("should show not show the time when digital clock is shown", async function () { + await app.client.waitUntilWindowLoaded(); + const digital = await app.client.$(".clock .digital"); + const time = await digital.$$(".time"); + return expect(time.length).toBe(0); + }); + }); + describe("with showWeek config enabled", function () { beforeAll(function () { // Set config sample for use in test