mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Merge branch 'develop' into patch-1
This commit is contained in:
commit
56846b258c
10
.travis.yml
10
.travis.yml
@ -1,7 +1,9 @@
|
|||||||
dist: trusty
|
dist: trusty
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "10"
|
- 10
|
||||||
|
- lts/*
|
||||||
|
- node
|
||||||
before_install:
|
before_install:
|
||||||
- npm i -g npm
|
- npm i -g npm
|
||||||
before_script:
|
before_script:
|
||||||
@ -12,9 +14,9 @@ before_script:
|
|||||||
- "sh -e /etc/init.d/xvfb start"
|
- "sh -e /etc/init.d/xvfb start"
|
||||||
- sleep 5
|
- sleep 5
|
||||||
script:
|
script:
|
||||||
- npm run test:e2e
|
- npm run test:e2e
|
||||||
- npm run test:unit
|
- npm run test:unit
|
||||||
- grunt
|
- grunt
|
||||||
after_script:
|
after_script:
|
||||||
- npm list
|
- npm list
|
||||||
cache:
|
cache:
|
||||||
|
@ -20,7 +20,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
|
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
|
||||||
- Added Hebrew translation.
|
- Added Hebrew translation.
|
||||||
- Add HTTPS support and update config.js.sample
|
- Add HTTPS support and update config.js.sample
|
||||||
|
- Run tests on long term support and latest stable version of nodejs
|
||||||
|
- Added the ability to configure a list of modules that shouldn't be update checked.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Force declaration of public ip adress in config file (ISSUE #1852)
|
- Force declaration of public ip adress in config file (ISSUE #1852)
|
||||||
@ -28,6 +29,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|||||||
- Fix calendar time offset for recurring events crossing Daylight Savings Time (ISSUE #1798)
|
- Fix calendar time offset for recurring events crossing Daylight Savings Time (ISSUE #1798)
|
||||||
- Fix regression in currentweather module causing 'undefined' to show up when config.hideTemp is false
|
- Fix regression in currentweather module causing 'undefined' to show up when config.hideTemp is false
|
||||||
- Fix FEELS translation for Croatian
|
- Fix FEELS translation for Croatian
|
||||||
|
- Fixed weather tests [#1840](https://github.com/MichMich/MagicMirror/issues/1840)
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
- Remove documentation from core repository and link to new dedicated docs site: [docs.magicmirror.builders](https://docs.magicmirror.builders).
|
- Remove documentation from core repository and link to new dedicated docs site: [docs.magicmirror.builders](https://docs.magicmirror.builders).
|
||||||
|
@ -179,11 +179,19 @@ Module.register("clock",{
|
|||||||
if (this.config.showMoonTimes) {
|
if (this.config.showMoonTimes) {
|
||||||
const moonIllumination = SunCalc.getMoonIllumination(now.toDate());
|
const moonIllumination = SunCalc.getMoonIllumination(now.toDate());
|
||||||
const moonTimes = SunCalc.getMoonTimes(now, this.config.lat, this.config.lon);
|
const moonTimes = SunCalc.getMoonTimes(now, this.config.lat, this.config.lon);
|
||||||
const isVisible = now.isBetween(moonTimes.rise, moonTimes.set);
|
const moonRise = moonTimes.rise;
|
||||||
const illuminatedFractionString = moonIllumination.fraction.toLocaleString(undefined, {style: 'percent'});
|
var moonSet;
|
||||||
|
if (moment(moonTimes.set).isAfter(moonTimes.rise)) {
|
||||||
|
moonSet = moonTimes.set;
|
||||||
|
} else {
|
||||||
|
const nextMoonTimes = SunCalc.getMoonTimes(now.clone().add(1, 'day'), this.config.lat, this.config.lon);
|
||||||
|
moonSet = nextMoonTimes.set;
|
||||||
|
}
|
||||||
|
const isVisible = now.isBetween(moonRise, moonSet) || moonTimes.alwaysUp === true;
|
||||||
|
const illuminatedFractionString = moonIllumination.fraction.toFixed(2) * 100 + '%';
|
||||||
moonWrapper.innerHTML = '<span class="' + (isVisible ? 'bright' : '') + '"><i class="fa fa-moon-o" aria-hidden="true"></i> ' + illuminatedFractionString + '</span>' +
|
moonWrapper.innerHTML = '<span class="' + (isVisible ? 'bright' : '') + '"><i class="fa fa-moon-o" aria-hidden="true"></i> ' + illuminatedFractionString + '</span>' +
|
||||||
'<span><i class="fa fa-arrow-up" aria-hidden="true"></i> ' + formatTime(this.config, moonTimes.rise) + '</span>'+
|
'<span><i class="fa fa-arrow-up" aria-hidden="true"></i> ' + (moonRise ? formatTime(this.config, moonRise) : '...') + '</span>'+
|
||||||
'<span><i class="fa fa-arrow-down" aria-hidden="true"></i> ' + formatTime(this.config, moonTimes.set) + '</span>';
|
'<span><i class="fa fa-arrow-down" aria-hidden="true"></i> ' + (moonSet ? formatTime(this.config, moonSet) : '...') + '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
|
@ -22,7 +22,7 @@ module.exports = NodeHelper.create({
|
|||||||
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
|
simpleGits.push({"module": "default", "git": SimpleGit(path.normalize(__dirname + "/../../../"))});
|
||||||
|
|
||||||
for (moduleName in modules) {
|
for (moduleName in modules) {
|
||||||
if (defaultModules.indexOf(moduleName) < 0) {
|
if (!this.ignoreUpdateChecking(moduleName)) {
|
||||||
// Default modules are included in the main MagicMirror repo
|
// Default modules are included in the main MagicMirror repo
|
||||||
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);
|
var moduleFolder = path.normalize(__dirname + "/../../" + moduleName);
|
||||||
|
|
||||||
@ -56,15 +56,15 @@ module.exports = NodeHelper.create({
|
|||||||
this.config = payload;
|
this.config = payload;
|
||||||
} else if(notification === "MODULES") {
|
} else if(notification === "MODULES") {
|
||||||
// if this is the 1st time thru the update check process
|
// if this is the 1st time thru the update check process
|
||||||
if(this.updateProcessStarted==false ){
|
if (!this.updateProcessStarted) {
|
||||||
this.updateProcessStarted=true;
|
this.updateProcessStarted = true;
|
||||||
this.configureModules(payload);
|
this.configureModules(payload);
|
||||||
this.preformFetch();
|
this.performFetch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
preformFetch() {
|
performFetch() {
|
||||||
var self = this;
|
var self = this;
|
||||||
simpleGits.forEach(function(sg) {
|
simpleGits.forEach(function(sg) {
|
||||||
sg.git.fetch().status(function(err, data) {
|
sg.git.fetch().status(function(err, data) {
|
||||||
@ -91,8 +91,23 @@ module.exports = NodeHelper.create({
|
|||||||
var self = this;
|
var self = this;
|
||||||
clearTimeout(this.updateTimer);
|
clearTimeout(this.updateTimer);
|
||||||
this.updateTimer = setTimeout(function() {
|
this.updateTimer = setTimeout(function() {
|
||||||
self.preformFetch();
|
self.performFetch();
|
||||||
}, delay);
|
}, delay);
|
||||||
|
},
|
||||||
|
|
||||||
|
ignoreUpdateChecking: function(moduleName) {
|
||||||
|
// Should not check for updates for default modules
|
||||||
|
if (defaultModules.indexOf(moduleName) >= 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should not check for updates for ignored modules
|
||||||
|
if (this.config.ignoreModules.indexOf(moduleName) >= 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The rest of the modules that passes should check for updates
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,7 @@ Module.register("updatenotification", {
|
|||||||
defaults: {
|
defaults: {
|
||||||
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
updateInterval: 10 * 60 * 1000, // every 10 minutes
|
||||||
refreshInterval: 24 * 60 * 60 * 1000, // one day
|
refreshInterval: 24 * 60 * 60 * 1000, // one day
|
||||||
|
ignoreModules: []
|
||||||
},
|
},
|
||||||
|
|
||||||
suspended: false,
|
suspended: false,
|
||||||
|
@ -8,14 +8,7 @@ const helpers = require("../global-setup");
|
|||||||
|
|
||||||
const {generateWeather, generateWeatherForecast} = require("./mocks");
|
const {generateWeather, generateWeatherForecast} = require("./mocks");
|
||||||
|
|
||||||
const wait = () => new Promise(res => setTimeout(res, 3000));
|
describe("Weather module", function() {
|
||||||
|
|
||||||
// See issue: https://github.com/MichMich/MagicMirror/issues/1840
|
|
||||||
// Skipping the weather tests for now since these seem to give issues.
|
|
||||||
// Please send a PR if you know how to fix these. Thanks!
|
|
||||||
|
|
||||||
|
|
||||||
describe.skip("Weather module", function() {
|
|
||||||
|
|
||||||
let app;
|
let app;
|
||||||
|
|
||||||
@ -49,7 +42,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render wind speed and wind direction", async function() {
|
it("should render wind speed and wind direction", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
|
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
|
||||||
});
|
});
|
||||||
@ -59,7 +52,7 @@ describe.skip("Weather module", function() {
|
|||||||
const sunset = moment().startOf("day").unix();
|
const sunset = moment().startOf("day").unix();
|
||||||
|
|
||||||
const weather = generateWeather({sys: {sunrise, sunset}});
|
const weather = generateWeather({sys: {sunrise, sunset}});
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunrise", 10000);
|
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunrise", 10000);
|
||||||
|
|
||||||
@ -71,7 +64,7 @@ describe.skip("Weather module", function() {
|
|||||||
const sunset = moment().endOf("day").unix();
|
const sunset = moment().endOf("day").unix();
|
||||||
|
|
||||||
const weather = generateWeather({sys: {sunrise, sunset}});
|
const weather = generateWeather({sys: {sunrise, sunset}});
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunset", 10000);
|
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunset", 10000);
|
||||||
|
|
||||||
@ -80,7 +73,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render temperature with icon", async function() {
|
it("should render temperature with icon", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitForExist(".weather .large.light span.wi.weathericon.wi-snow", 10000);
|
await app.client.waitForExist(".weather .large.light span.wi.weathericon.wi-snow", 10000);
|
||||||
|
|
||||||
@ -89,7 +82,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render feels like temperature", async function() {
|
it("should render feels like temperature", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "Feels like -5.6°", 10000);
|
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "Feels like -5.6°", 10000);
|
||||||
});
|
});
|
||||||
@ -102,14 +95,14 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render useBeaufort = false", async function() {
|
it("should render useBeaufort = false", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "12", 10000);
|
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "12", 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should render showWindDirectionAsArrow = true", async function() {
|
it("should render showWindDirectionAsArrow = true", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitForExist(".weather .normal.medium sup i.fa-long-arrow-up", 10000);
|
await app.client.waitForExist(".weather .normal.medium sup i.fa-long-arrow-up", 10000);
|
||||||
const element = await app.client.getHTML(".weather .normal.medium sup i.fa-long-arrow-up");
|
const element = await app.client.getHTML(".weather .normal.medium sup i.fa-long-arrow-up");
|
||||||
@ -119,7 +112,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render showHumidity = true", async function() {
|
it("should render showHumidity = true", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93", 10000);
|
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93", 10000);
|
||||||
return app.client.waitForExist(".weather .normal.medium sup i.wi-humidity", 10000);
|
return app.client.waitForExist(".weather .normal.medium sup i.wi-humidity", 10000);
|
||||||
@ -127,7 +120,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render degreeLabel = true", async function() {
|
it("should render degreeLabel = true", async function() {
|
||||||
const weather = generateWeather();
|
const weather = generateWeather();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitUntilTextExists(".weather .large.light span.bright", "1°C", 10000);
|
await app.client.waitUntilTextExists(".weather .large.light span.bright", "1°C", 10000);
|
||||||
|
|
||||||
@ -151,7 +144,7 @@ describe.skip("Weather module", function() {
|
|||||||
speed: 11.8 * 2.23694
|
speed: 11.8 * 2.23694
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
|
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
|
||||||
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
|
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
|
||||||
@ -169,7 +162,7 @@ describe.skip("Weather module", function() {
|
|||||||
speed: 11.8 * 2.23694
|
speed: 11.8 * 2.23694
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93,7", 10000);
|
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93,7", 10000);
|
||||||
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
|
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
|
||||||
@ -192,7 +185,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render days", async function() {
|
it("should render days", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
const days = ["Fri", "Sat", "Sun", "Mon", "Tue"];
|
const days = ["Fri", "Sat", "Sun", "Mon", "Tue"];
|
||||||
|
|
||||||
@ -203,7 +196,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render icons", async function() {
|
it("should render icons", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
const icons = ["day-cloudy", "rain", "day-sunny", "day-sunny", "day-sunny"];
|
const icons = ["day-cloudy", "rain", "day-sunny", "day-sunny", "day-sunny"];
|
||||||
|
|
||||||
@ -214,7 +207,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render max temperatures", async function() {
|
it("should render max temperatures", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
const temperatures = ["24.4°", "21.0°", "22.9°", "23.4°", "20.6°"];
|
const temperatures = ["24.4°", "21.0°", "22.9°", "23.4°", "20.6°"];
|
||||||
|
|
||||||
@ -225,7 +218,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render min temperatures", async function() {
|
it("should render min temperatures", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
const temperatures = ["15.3°", "13.6°", "13.8°", "13.9°", "10.9°"];
|
const temperatures = ["15.3°", "13.6°", "13.8°", "13.9°", "10.9°"];
|
||||||
|
|
||||||
@ -236,7 +229,7 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render fading of rows", async function() {
|
it("should render fading of rows", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
const opacities = [1, 1, 0.8, 0.5333333333333333, 0.2666666666666667];
|
const opacities = [1, 1, 0.8, 0.5333333333333333, 0.2666666666666667];
|
||||||
|
|
||||||
@ -256,14 +249,14 @@ describe.skip("Weather module", function() {
|
|||||||
|
|
||||||
it("should render custom table class", async function() {
|
it("should render custom table class", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitForExist(".weather table.myTableClass", 10000);
|
await app.client.waitForExist(".weather table.myTableClass", 10000);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should render colored rows", async function() {
|
it("should render colored rows", async function() {
|
||||||
const weather = generateWeatherForecast();
|
const weather = generateWeatherForecast();
|
||||||
await setup([weather, template]);
|
await setup({template, data: weather});
|
||||||
|
|
||||||
await app.client.waitForExist(".weather table.myTableClass", 10000);
|
await app.client.waitForExist(".weather table.myTableClass", 10000);
|
||||||
|
|
||||||
|
4
tests/node_modules/webdriverajaxstub/index.js
generated
vendored
4
tests/node_modules/webdriverajaxstub/index.js
generated
vendored
@ -3,7 +3,7 @@ function plugin (wdInstance, requests) {
|
|||||||
throw new Error("You can't use WebdriverAjaxStub with this version of WebdriverIO");
|
throw new Error("You can't use WebdriverAjaxStub with this version of WebdriverIO");
|
||||||
}
|
}
|
||||||
|
|
||||||
function stub(requests, done) {
|
function stub({template, data}, done) {
|
||||||
window.XMLHttpRequest = function () {
|
window.XMLHttpRequest = function () {
|
||||||
this.open = function (method, url) {
|
this.open = function (method, url) {
|
||||||
this.method = method;
|
this.method = method;
|
||||||
@ -13,7 +13,7 @@ function plugin (wdInstance, requests) {
|
|||||||
this.send = function () {
|
this.send = function () {
|
||||||
this.status = 200;
|
this.status = 200;
|
||||||
this.readyState = 4;
|
this.readyState = 4;
|
||||||
const response = requests.shift() || [];
|
const response = this.url.includes('.njk') ? template : data;
|
||||||
this.response = response;
|
this.response = response;
|
||||||
this.responseText = response;
|
this.responseText = response;
|
||||||
this.onreadystatechange();
|
this.onreadystatechange();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user