Merge branch 'develop' into missing-entries-changelog-test

This commit is contained in:
Rodrigo Ramírez Norambuena 2017-03-28 13:19:26 -03:00 committed by GitHub
commit e17a40fdb2
11 changed files with 194 additions and 21 deletions

View File

@ -23,13 +23,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Restructured Test Suite - Restructured Test Suite
### Added ### Added
- Added Docker support (Pull Request [#673](https://github.com/MichMich/MagicMirror/pull/673)) - Added Docker support (Pull Request [#673](https://github.com/MichMich/MagicMirror/pull/673)).
- Calendar-specific support for `maximumEntries`, and ` maximumNumberOfDays` - Calendar-specific support for `maximumEntries`, and ` maximumNumberOfDays`.
- Add loaded function to modules, providing an async callback. - Add loaded function to modules, providing an async callback.
- Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures) - Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures)
- Add use pm2 for manager process into Installer RaspberryPi script - Add use pm2 for manager process into Installer RaspberryPi script.
- Russian Translation - Russian Translation.
- Afrikaans Translation - Afrikaans Translation.
- Add postinstall script to notify user that MagicMirror installed successfully despite warnings from NPM. - Add postinstall script to notify user that MagicMirror installed successfully despite warnings from NPM.
- Init tests using mocha. - Init tests using mocha.
- Option to use RegExp in Calendar's titleReplace. - Option to use RegExp in Calendar's titleReplace.
@ -37,28 +37,30 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Icelandic Translation. - Icelandic Translation.
- Add use a script to prevent when is run by SSH session set DISPLAY enviroment. - Add use a script to prevent when is run by SSH session set DISPLAY enviroment.
- Enable ability to set configuration file by the enviroment variable called MM_CONFIG_FILE. - Enable ability to set configuration file by the enviroment variable called MM_CONFIG_FILE.
- Option to give each calendar a different color - Option to give each calendar a different color.
- Option for colored min-temp and max-temp - Option for colored min-temp and max-temp.
- Add test e2e helloworld - Add test e2e helloworld.
- Add test e2e enviroment - Add test e2e enviroment.
- Add `chai-as-promised` npm module to devDependencies - Add `chai-as-promised` npm module to devDependencies.
- Basic set of tests for clock module - Basic set of tests for clock module.
- Run e2e test in Travis - Run e2e test in Travis.
- Estonian Translation. - Estonian Translation.
- Add test for compliments module for parts of day - Add test for compliments module for parts of day.
- Korean Translation. - Korean Translation.
- Added console warning on startup when deprecated config options are used - Added console warning on startup when deprecated config options are used.
- Add option to display temperature unit label to the current weather module - Add option to display temperature unit label to the current weather module.
- Added ability to disable wrapping of news items - Added ability to disable wrapping of news items.
- Added in the ability to hide events in the calendar module based on simple string filters. - Added in the ability to hide events in the calendar module based on simple string filters.
- Updated Norwegian translation. - Updated Norwegian translation.
- Added hideLoading option for News Feed module - Added hideLoading option for News Feed module.
- Added configurable dateFormat to clock module. - Added configurable dateFormat to clock module.
- Added multiple calendar icon support. - Added multiple calendar icon support.
- Added tests for Translations, dev argument, version, dev console. - Added tests for Translations, dev argument, version, dev console.
- Added test anytime feature compliments module. - Added test anytime feature compliments module.
- Added test ipwhitelist configuration directive. - Added test ipwhitelist configuration directive.
- Added test for calendar module: default, basic-auth, backward compability, fail-basic-auth. - Added test for calendar module: default, basic-auth, backward compability, fail-basic-auth.
- Added meta tags to support fullscreen mode on iOS (for server mode)
- Added `ignoreOldItems` and `ignoreOlderThan` options to the News Feed module
### Fixed ### Fixed
- Update .gitignore to not ignore default modules folder. - Update .gitignore to not ignore default modules folder.
@ -67,7 +69,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611)) - Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611))
- If units is set to imperial, the showRainAmount option of weatherforecast will show the correct unit. - If units is set to imperial, the showRainAmount option of weatherforecast will show the correct unit.
- Module currentWeather: check if temperature received from api is defined. - Module currentWeather: check if temperature received from api is defined.
- Fix an issue with module hidden status changing to `true` although lock string prevented showing it - Fix an issue with module hidden status changing to `true` although lock string prevented showing it.
- Fix newsfeed module bug (removeStartTags) - Fix newsfeed module bug (removeStartTags)
- Fixed missing animation on `this.show(speed)` when module is alone in a region. - Fixed missing animation on `this.show(speed)` when module is alone in a region.

View File

@ -1,6 +1,7 @@
html { html {
cursor: none; cursor: none;
overflow: hidden; overflow: hidden;
background: #000;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {

View File

@ -4,6 +4,12 @@
<title>Magic Mirror</title> <title>Magic Mirror</title>
<meta name="google" content="notranslate" /> <meta name="google" content="notranslate" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" href="data:;base64,iVBORw0KGgo="> <link rel="icon" href="data:;base64,iVBORw0KGgo=">
<link rel="stylesheet" type="text/css" href="css/main.css"> <link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="fonts/roboto.css"> <link rel="stylesheet" type="text/css" href="fonts/roboto.css">

View File

@ -70,6 +70,8 @@ The following properties can be configured:
| `updateInterval` | How often do you want to display a new headline? (Milliseconds) <br><br> **Possible values:**`1000` - `60000` <br> **Default value:** `10000` (10 seconds) | `updateInterval` | How often do you want to display a new headline? (Milliseconds) <br><br> **Possible values:**`1000` - `60000` <br> **Default value:** `10000` (10 seconds)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2500` (2.5 seconds) | `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2500` (2.5 seconds)
| `maxNewsItems` | Total amount of news items to cycle through. (0 for unlimited) <br><br> **Possible values:**`0` - `...` <br> **Default value:** `0` | `maxNewsItems` | Total amount of news items to cycle through. (0 for unlimited) <br><br> **Possible values:**`0` - `...` <br> **Default value:** `0`
| `ignoreOldItems` | Ignore news items that are outdated. <br><br> **Possible values:**`true` or `false <br> **Default value:** `false`
| `ignoreOlderThan` | How old should news items be before they are considered outdated? (Milliseconds) <br><br> **Possible values:**`1` - `...` <br> **Default value:** `86400000` (1 day)
| `removeStartTags` | Some newsfeeds feature tags at the **beginning** of their titles or descriptions, such as _[VIDEO]_. This setting allows for the removal of specified tags from the beginning of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'` | `removeStartTags` | Some newsfeeds feature tags at the **beginning** of their titles or descriptions, such as _[VIDEO]_. This setting allows for the removal of specified tags from the beginning of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `startTags` | List the tags you would like to have removed at the beginning of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]` | `startTags` | List the tags you would like to have removed at the beginning of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
| `removeEndTags` | Remove specified tags from the **end** of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'` | `removeEndTags` | Remove specified tags from the **end** of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`

View File

@ -28,6 +28,8 @@ Module.register("newsfeed",{
updateInterval: 10 * 1000, updateInterval: 10 * 1000,
animationSpeed: 2.5 * 1000, animationSpeed: 2.5 * 1000,
maxNewsItems: 0, // 0 for unlimited maxNewsItems: 0, // 0 for unlimited
ignoreOldItems: false,
ignoreOlderThan: 24 * 60 * 60 * 1000, // 1 day
removeStartTags: "", removeStartTags: "",
removeEndTags: "", removeEndTags: "",
startTags: [], startTags: [],
@ -226,7 +228,9 @@ Module.register("newsfeed",{
for (var i in feedItems) { for (var i in feedItems) {
var item = feedItems[i]; var item = feedItems[i];
item.sourceTitle = this.titleForFeed(feed); item.sourceTitle = this.titleForFeed(feed);
newsItems.push(item); if (!(this.config.ignoreOldItems && ((Date.now() - new Date(item.pubdate)) > this.config.ignoreOlderThan))) {
newsItems.push(item);
}
} }
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "magicmirror", "name": "magicmirror",
"version": "2.1.1", "version": "2.1.1",
"description": "A modular interface for smart mirrors.", "description": "The open source modular smart mirror platform.",
"main": "js/electron.js", "main": "js/electron.js",
"scripts": { "scripts": {
"start": "sh run-start.sh", "start": "sh run-start.sh",

View File

@ -0,0 +1,43 @@
/* Magic Mirror Test config for position setters module
*
* For this case is using helloworld module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
ipWhitelist: [],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules:
// Using exotic content. This is why dont accept go to JSON configuration file
(function() {
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
"bottom_bar", "fullscreen_above", "fullscreen_below"];
var modules = Array();
for (idx in positions) {
modules.push({
module: "helloworld",
position: positions[idx],
config: {
text: "Text in " + positions[idx]
}
});
}
return modules;
})(),
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@ -0,0 +1,25 @@
/* Magic Mirror Test config sample enviroment set por 8090
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8090,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@ -1,5 +1,8 @@
const globalSetup = require("./global-setup"); const globalSetup = require("./global-setup");
const app = globalSetup.app; const app = globalSetup.app;
const request = require("request");
const chai = require("chai");
const expect = chai.expect;
describe("Electron app environment", function () { describe("Electron app environment", function () {
this.timeout(20000); this.timeout(20000);
@ -17,7 +20,6 @@ describe("Electron app environment", function () {
app.stop().then(function() { done(); }); app.stop().then(function() { done(); });
}); });
it("is set to open new app window", function () { it("is set to open new app window", function () {
return app.client.waitUntilWindowLoaded() return app.client.waitUntilWindowLoaded()
.getWindowCount().should.eventually.equal(1); .getWindowCount().should.eventually.equal(1);
@ -28,4 +30,18 @@ describe("Electron app environment", function () {
.getTitle().should.eventually.equal("Magic Mirror"); .getTitle().should.eventually.equal("Magic Mirror");
}); });
it("get request from http://localhost:8080 should return 200", function (done) {
request.get("http://localhost:8080", function (err, res, body) {
expect(res.statusCode).to.equal(200);
done();
});
});
it("get request from http://localhost:8080/nothing should return 404", function (done) {
request.get("http://localhost:8080/nothing", function (err, res, body) {
expect(res.statusCode).to.equal(404);
done();
});
});
}); });

View File

@ -0,0 +1,42 @@
const globalSetup = require("./global-setup");
const app = globalSetup.app;
const chai = require("chai");
const expect = chai.expect;
describe("Position of modules", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("Using helloworld", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js";
});
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
"bottom_bar", "fullscreen_above", "fullscreen_below"];
var position;
var className;
for (idx in positions) {
position = positions[idx];
className = position.replace("_", ".");
it("show text in " + position , function () {
return app.client.waitUntilWindowLoaded()
.getText("." + className).should.eventually.equal("Text in " + position);
});
}
});
});

32
tests/e2e/port_config.js Normal file
View File

@ -0,0 +1,32 @@
const globalSetup = require("./global-setup");
const app = globalSetup.app;
const request = require("request");
const chai = require("chai");
const expect = chai.expect;
describe("port directive configuration", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("Set port 8090", function () {
before(function() {
// Set config sample for use in this test
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
});
it("should return 200", function (done) {
request.get("http://localhost:8090", function (err, res, body) {
expect(res.statusCode).to.equal(200);
done();
});
});
});
});