From 3895c18466ce417d3b3b7ab7b0abb387f9d3857d Mon Sep 17 00:00:00 2001 From: veeck Date: Sun, 17 Jan 2021 14:50:48 +0100 Subject: [PATCH] Add test case --- .../weather/currentweather_compliments.js | 48 +++++++++++++++++++ tests/e2e/modules/weather_spec.js | 13 +++++ 2 files changed, 61 insertions(+) create mode 100644 tests/configs/modules/weather/currentweather_compliments.js diff --git a/tests/configs/modules/weather/currentweather_compliments.js b/tests/configs/modules/weather/currentweather_compliments.js new file mode 100644 index 00000000..1b11ef6c --- /dev/null +++ b/tests/configs/modules/weather/currentweather_compliments.js @@ -0,0 +1,48 @@ +/* Magic Mirror Test config current weather compliments + * + * By rejas https://github.com/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: { + fullscreen: false, + webPreferences: { + nodeIntegration: true + } + }, + + modules: [ + { + module: "compliments", + position: "top_bar", + config: { + compliments: { + snow: ["snow"] + }, + updateInterval: 4000 + } + }, + { + module: "weather", + position: "bottom_bar", + config: { + location: "Munich", + apiKey: "fake key", + initialLoadDelay: 3000 + } + } + ] +}; + +/*************** DO NOT EDIT THE LINE BELOW ***************/ +if (typeof module !== "undefined") { + module.exports = config; +} diff --git a/tests/e2e/modules/weather_spec.js b/tests/e2e/modules/weather_spec.js index 2d9f3f01..2ee0e292 100644 --- a/tests/e2e/modules/weather_spec.js +++ b/tests/e2e/modules/weather_spec.js @@ -87,6 +87,19 @@ describe("Weather module", function () { }); }); + describe("Compliments Integration", function () { + before(function () { + process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_compliments.js"; + }); + + it("should render a compliment based on the current weather", async function () { + const weather = generateWeather(); + await setup({ template, data: weather }); + + return app.client.waitUntilTextExists(".compliments .module-content span", "snow", 10000); + }); + }); + describe("Configuration Options", function () { before(function () { process.env.MM_CONFIG_FILE = "tests/configs/modules/weather/currentweather_options.js";