From 79f5b938f5668a35f58a4b5c152be4e2b6377772 Mon Sep 17 00:00:00 2001 From: rejas Date: Sun, 11 Apr 2021 20:59:33 +0200 Subject: [PATCH] Add first test for alert module --- tests/configs/modules/alert/default.js | 34 +++++++++++++++++++++++ tests/e2e/modules/alert_spec.js | 37 ++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 tests/configs/modules/alert/default.js create mode 100644 tests/e2e/modules/alert_spec.js diff --git a/tests/configs/modules/alert/default.js b/tests/configs/modules/alert/default.js new file mode 100644 index 00000000..8ee282d0 --- /dev/null +++ b/tests/configs/modules/alert/default.js @@ -0,0 +1,34 @@ +/* Magic Mirror Test config sample module alert + * + * By rejas + * MIT Licensed. + */ +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + + language: "en", + timeFormat: 24, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true, + enableRemoteModule: true + } + }, + + modules: [ + { + module: "alert", + config: { + display_time: 1000000, + welcome_message: true + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules/alert_spec.js b/tests/e2e/modules/alert_spec.js new file mode 100644 index 00000000..515001bf --- /dev/null +++ b/tests/e2e/modules/alert_spec.js @@ -0,0 +1,37 @@ +const helpers = require("../global-setup"); + +const describe = global.describe; +const it = global.it; +const beforeEach = global.beforeEach; +const afterEach = global.afterEach; + +describe("Alert module", function () { + helpers.setupTimeout(this); + + let app = null; + + beforeEach(function () { + return helpers + .startApplication({ + args: ["js/electron.js"] + }) + .then(function (startedApp) { + app = startedApp; + }); + }); + + afterEach(function () { + return helpers.stopApplication(app); + }); + + describe("Default configuration", function () { + before(function () { + // Set config sample for use in test + process.env.MM_CONFIG_FILE = "tests/configs/modules/alert/default.js"; + }); + + it("should show the welcome message", function () { + return app.client.waitUntilTextExists(".ns-box .ns-box-inner .light.bright.small", "Welcome, start was successful!", 10000); + }); + }); +});