mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
Merge remote-tracking branch 'roramirez_github/develop' into newsfeed_test_case
This commit is contained in:
190
tests/configs/data/calendar_test.ics
Normal file
190
tests/configs/data/calendar_test.ics
Normal file
@@ -0,0 +1,190 @@
|
||||
BEGIN:VCALENDAR
|
||||
PRODID:-//Google Inc//Google Calendar 70.9054//EN
|
||||
VERSION:2.0
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:PUBLISH
|
||||
X-WR-CALNAME:MagicMirrorTest
|
||||
X-WR-TIMEZONE:America/Santiago
|
||||
X-WR-CALDESC:Testing propose MagicMirror
|
||||
BEGIN:VTIMEZONE
|
||||
TZID:America/Santiago
|
||||
X-LIC-LOCATION:America/Santiago
|
||||
BEGIN:STANDARD
|
||||
TZOFFSETFROM:-0300
|
||||
TZOFFSETTO:-0400
|
||||
TZNAME:-04
|
||||
DTSTART:19700510T000000
|
||||
RDATE:19700510T030000
|
||||
RDATE:19710509T030000
|
||||
RDATE:19720514T030000
|
||||
RDATE:19730513T030000
|
||||
RDATE:19740512T030000
|
||||
RDATE:19750511T030000
|
||||
RDATE:19760509T030000
|
||||
RDATE:19770515T030000
|
||||
RDATE:19780514T030000
|
||||
RDATE:19790513T030000
|
||||
RDATE:19800511T030000
|
||||
RDATE:19810510T030000
|
||||
RDATE:19820509T030000
|
||||
RDATE:19830515T030000
|
||||
RDATE:19840513T030000
|
||||
RDATE:19850512T030000
|
||||
RDATE:19860511T030000
|
||||
RDATE:19870510T030000
|
||||
RDATE:19880515T030000
|
||||
RDATE:19890514T030000
|
||||
RDATE:19900513T030000
|
||||
RDATE:19910512T030000
|
||||
RDATE:19920510T030000
|
||||
RDATE:19930509T030000
|
||||
RDATE:19940515T030000
|
||||
RDATE:19950514T030000
|
||||
RDATE:19960512T030000
|
||||
RDATE:19970511T030000
|
||||
RDATE:19980510T030000
|
||||
RDATE:19990509T030000
|
||||
RDATE:20000514T030000
|
||||
RDATE:20010513T030000
|
||||
RDATE:20020512T030000
|
||||
RDATE:20030511T030000
|
||||
RDATE:20040509T030000
|
||||
RDATE:20050515T030000
|
||||
RDATE:20060514T030000
|
||||
RDATE:20070513T030000
|
||||
RDATE:20080511T030000
|
||||
RDATE:20090510T030000
|
||||
RDATE:20100509T030000
|
||||
RDATE:20110515T030000
|
||||
RDATE:20120513T030000
|
||||
RDATE:20130512T030000
|
||||
RDATE:20140511T030000
|
||||
RDATE:20150510T030000
|
||||
RDATE:20160515T030000
|
||||
RDATE:20170514T030000
|
||||
RDATE:20180513T030000
|
||||
RDATE:20190512T030000
|
||||
RDATE:20200510T030000
|
||||
RDATE:20210509T030000
|
||||
RDATE:20220515T030000
|
||||
RDATE:20230514T030000
|
||||
RDATE:20240512T030000
|
||||
RDATE:20250511T030000
|
||||
RDATE:20260510T030000
|
||||
RDATE:20270509T030000
|
||||
RDATE:20280514T030000
|
||||
RDATE:20290513T030000
|
||||
RDATE:20300512T030000
|
||||
RDATE:20310511T030000
|
||||
RDATE:20320509T030000
|
||||
RDATE:20330515T030000
|
||||
RDATE:20340514T030000
|
||||
RDATE:20350513T030000
|
||||
RDATE:20360511T030000
|
||||
RDATE:20370510T030000
|
||||
END:STANDARD
|
||||
BEGIN:STANDARD
|
||||
TZOFFSETFROM:-0300
|
||||
TZOFFSETTO:-0400
|
||||
TZNAME:-04
|
||||
DTSTART:20380509T000000
|
||||
RRULE:FREQ=YEARLY;BYMONTH=5;BYDAY=2SU
|
||||
END:STANDARD
|
||||
BEGIN:DAYLIGHT
|
||||
TZOFFSETFROM:-0400
|
||||
TZOFFSETTO:-0300
|
||||
TZNAME:-03
|
||||
DTSTART:19700809T000000
|
||||
RDATE:19700809T040000
|
||||
RDATE:19710815T040000
|
||||
RDATE:19720813T040000
|
||||
RDATE:19730812T040000
|
||||
RDATE:19740811T040000
|
||||
RDATE:19750810T040000
|
||||
RDATE:19760815T040000
|
||||
RDATE:19770814T040000
|
||||
RDATE:19780813T040000
|
||||
RDATE:19790812T040000
|
||||
RDATE:19800810T040000
|
||||
RDATE:19810809T040000
|
||||
RDATE:19820815T040000
|
||||
RDATE:19830814T040000
|
||||
RDATE:19840812T040000
|
||||
RDATE:19850811T040000
|
||||
RDATE:19860810T040000
|
||||
RDATE:19870809T040000
|
||||
RDATE:19880814T040000
|
||||
RDATE:19890813T040000
|
||||
RDATE:19900812T040000
|
||||
RDATE:19910811T040000
|
||||
RDATE:19920809T040000
|
||||
RDATE:19930815T040000
|
||||
RDATE:19940814T040000
|
||||
RDATE:19950813T040000
|
||||
RDATE:19960811T040000
|
||||
RDATE:19970810T040000
|
||||
RDATE:19980809T040000
|
||||
RDATE:19990815T040000
|
||||
RDATE:20000813T040000
|
||||
RDATE:20010812T040000
|
||||
RDATE:20020811T040000
|
||||
RDATE:20030810T040000
|
||||
RDATE:20040815T040000
|
||||
RDATE:20050814T040000
|
||||
RDATE:20060813T040000
|
||||
RDATE:20070812T040000
|
||||
RDATE:20080810T040000
|
||||
RDATE:20090809T040000
|
||||
RDATE:20100815T040000
|
||||
RDATE:20110814T040000
|
||||
RDATE:20120812T040000
|
||||
RDATE:20130811T040000
|
||||
RDATE:20140810T040000
|
||||
RDATE:20150809T040000
|
||||
RDATE:20160814T040000
|
||||
RDATE:20170813T040000
|
||||
RDATE:20180812T040000
|
||||
RDATE:20190811T040000
|
||||
RDATE:20200809T040000
|
||||
RDATE:20210815T040000
|
||||
RDATE:20220814T040000
|
||||
RDATE:20230813T040000
|
||||
RDATE:20240811T040000
|
||||
RDATE:20250810T040000
|
||||
RDATE:20260809T040000
|
||||
RDATE:20270815T040000
|
||||
RDATE:20280813T040000
|
||||
RDATE:20290812T040000
|
||||
RDATE:20300811T040000
|
||||
RDATE:20310810T040000
|
||||
RDATE:20320815T040000
|
||||
RDATE:20330814T040000
|
||||
RDATE:20340813T040000
|
||||
RDATE:20350812T040000
|
||||
RDATE:20360810T040000
|
||||
RDATE:20370809T040000
|
||||
END:DAYLIGHT
|
||||
BEGIN:DAYLIGHT
|
||||
TZOFFSETFROM:-0400
|
||||
TZOFFSETTO:-0300
|
||||
TZNAME:-03
|
||||
DTSTART:20380815T000000
|
||||
RRULE:FREQ=YEARLY;BYMONTH=8;BYDAY=2SU
|
||||
END:DAYLIGHT
|
||||
END:VTIMEZONE
|
||||
BEGIN:VEVENT
|
||||
DTSTART;TZID=America/Santiago:20170309T100000
|
||||
DTEND;TZID=America/Santiago:20170309T110000
|
||||
RRULE:FREQ=MONTHLY;INTERVAL=30;BYMONTHDAY=9
|
||||
DTSTAMP:20170310T172720Z
|
||||
UID:80rl9kuu5bq49gme99eklov27k@google.com
|
||||
CREATED:20170310T172400Z
|
||||
DESCRIPTION:
|
||||
LAST-MODIFIED:20170310T172400Z
|
||||
LOCATION:
|
||||
SEQUENCE:0
|
||||
STATUS:CONFIRMED
|
||||
SUMMARY:TestEvent
|
||||
TRANSP:OPAQUE
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
25
tests/configs/empty_ipWhiteList.js
Normal file
25
tests/configs/empty_ipWhiteList.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Magic Mirror Test config sample ipWhitelist
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: [],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 24,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
41
tests/configs/modules/calendar/auth-default.js
Normal file
41
tests/configs/modules/calendar/auth-default.js
Normal file
@@ -0,0 +1,41 @@
|
||||
/* Magic Mirror Test config default calendar with auth by default
|
||||
*
|
||||
* 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"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "calendar",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
calendars: [
|
||||
{
|
||||
maximumNumberOfDays: 10000,
|
||||
url: "http://localhost:8011/tests/configs/data/calendar_test.ics",
|
||||
auth: {
|
||||
user: "MagicMirror",
|
||||
pass: "CallMeADog"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
42
tests/configs/modules/calendar/basic-auth.js
Normal file
42
tests/configs/modules/calendar/basic-auth.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/* Magic Mirror Test config default calendar
|
||||
*
|
||||
* 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"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "calendar",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
calendars: [
|
||||
{
|
||||
maximumNumberOfDays: 10000,
|
||||
url: "http://localhost:8010/tests/configs/data/calendar_test.ics",
|
||||
auth: {
|
||||
user: "MagicMirror",
|
||||
pass: "CallMeADog",
|
||||
method: "basic"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
37
tests/configs/modules/calendar/default.js
Normal file
37
tests/configs/modules/calendar/default.js
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Magic Mirror Test config default calendar
|
||||
*
|
||||
* 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"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "calendar",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
calendars: [
|
||||
{
|
||||
maximumNumberOfDays: 10000,
|
||||
url: "http://localhost:8080/tests/configs/data/calendar_test.ics"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
44
tests/configs/modules/calendar/fail-basic-auth.js
Normal file
44
tests/configs/modules/calendar/fail-basic-auth.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/* Magic Mirror Test calendar calendar
|
||||
*
|
||||
* This configuration is a wrong authentication
|
||||
*
|
||||
* 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"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "calendar",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
calendars: [
|
||||
{
|
||||
maximumNumberOfDays: 10000,
|
||||
url: "http://localhost:8020/tests/configs/data/calendar_test.ics",
|
||||
auth: {
|
||||
user: "MagicMirror",
|
||||
pass: "StairwayToHeaven",
|
||||
method: "basic"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
39
tests/configs/modules/calendar/old-basic-auth.js
Normal file
39
tests/configs/modules/calendar/old-basic-auth.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Magic Mirror Test config default calendar
|
||||
* with authenticacion old config
|
||||
* 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"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "calendar",
|
||||
position: "bottom_bar",
|
||||
config: {
|
||||
calendars: [
|
||||
{
|
||||
maximumNumberOfDays: 10000,
|
||||
url: "http://localhost:8012/tests/configs/data/calendar_test.ics",
|
||||
user: "MagicMirror",
|
||||
pass: "CallMeADog"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
32
tests/configs/modules/clock/clock_showWeek.js
Normal file
32
tests/configs/modules/clock/clock_showWeek.js
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Magic Mirror Test config for default clock module
|
||||
*
|
||||
* By Johan Hammar
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "clock",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
showWeek: true
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
@@ -0,0 +1,35 @@
|
||||
/* Magic Mirror Test config compliments with anytime type
|
||||
*
|
||||
* 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"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 12,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "compliments",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
compliments: {
|
||||
anytime: ["Anytime here"]
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
@@ -1,4 +1,4 @@
|
||||
/* Magic Mirror Test config for default compliments
|
||||
/* Magic Mirror Test config for default compliments
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
|
43
tests/configs/modules/positions.js
Normal file
43
tests/configs/modules/positions.js
Normal 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;}
|
25
tests/configs/noIpWhiteList.js
Normal file
25
tests/configs/noIpWhiteList.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Magic Mirror Test config sample ipWhitelist
|
||||
*
|
||||
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
||||
var config = {
|
||||
port: 8080,
|
||||
ipWhitelist: ["x.x.x.x"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 24,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
},
|
||||
|
||||
modules: [
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
25
tests/configs/port_8090.js
Normal file
25
tests/configs/port_8090.js
Normal 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;}
|
23
tests/configs/without_modules.js
Normal file
23
tests/configs/without_modules.js
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Magic Mirror Test default config for modules
|
||||
*
|
||||
* 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", "::ffff:192.168.10.1"],
|
||||
|
||||
language: "en",
|
||||
timeFormat: 24,
|
||||
units: "metric",
|
||||
electronOptions: {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
},
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {module.exports = config;}
|
@@ -1,5 +1,8 @@
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
const request = require("request");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("Electron app environment", function () {
|
||||
this.timeout(20000);
|
||||
@@ -17,7 +20,6 @@ describe("Electron app environment", function () {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
|
||||
it("is set to open new app window", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getWindowCount().should.eventually.equal(1);
|
||||
@@ -28,4 +30,18 @@ describe("Electron app environment", function () {
|
||||
.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();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
46
tests/e2e/ipWhistlist_spec.js
Normal file
46
tests/e2e/ipWhistlist_spec.js
Normal file
@@ -0,0 +1,46 @@
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
const request = require("request");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
|
||||
describe("ipWhitelist directive configuration", function () {
|
||||
|
||||
this.timeout(20000);
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
describe("Set ipWhitelist without access", function () {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
||||
});
|
||||
it("should return 403", function (done) {
|
||||
request.get("http://localhost:8080", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(403);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Set ipWhitelist []", function () {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
||||
});
|
||||
it("should return 200", function (done) {
|
||||
request.get("http://localhost:8080", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
81
tests/e2e/modules/calendar_spec.js
Normal file
81
tests/e2e/modules/calendar_spec.js
Normal file
@@ -0,0 +1,81 @@
|
||||
const globalSetup = require("../global-setup");
|
||||
const serverBasicAuth = require("../../servers/basic-auth.js");
|
||||
const app = globalSetup.app;
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("Calendar module", function () {
|
||||
|
||||
this.timeout(20000);
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
describe("Default configuration", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("Basic auth", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8010);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("Basic auth by default", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8011);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Basic auth backward compatibilty configuration", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8012);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
|
||||
});
|
||||
|
||||
it("Should return TestEvents", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Fail Basic auth", function() {
|
||||
before(function() {
|
||||
serverBasicAuth.listen(8020);
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/fail-basic-auth.js";
|
||||
});
|
||||
|
||||
it("Should return No upcoming events", function () {
|
||||
return app.client.waitUntilTextExists(".calendar", "No upcoming events.", 10000);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
@@ -100,4 +100,25 @@ describe("Clock module", function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showWeek config enabled", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showWeek.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("shows week with correct format", function() {
|
||||
const weekRegex = /^Week [0-9]{1,2}$/;
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".clock .week").should.eventually.match(weekRegex);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -6,21 +6,23 @@ const expect = chai.expect;
|
||||
describe("Compliments module", function () {
|
||||
this.timeout(20000);
|
||||
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
|
||||
describe("parts of days", function() {
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_parts_day.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
|
||||
it("if Morning compliments for that part of day", function () {
|
||||
var hour = new Date().getHours();
|
||||
if (hour >= 3 && hour < 12) {
|
||||
@@ -57,26 +59,37 @@ describe("Compliments module", function () {
|
||||
});
|
||||
|
||||
|
||||
describe("Tests anytime for compliments", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
|
||||
describe("Feature anytime in compliments module", function() {
|
||||
|
||||
describe("Set anytime and empty compliments for morning, evening and afternoon ", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
|
||||
});
|
||||
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
describe("Only anytime present in configuration compliments", function() {
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_only_anytime.js";
|
||||
});
|
||||
|
||||
it("Show anytime compliments", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText(".compliments").then(function (text) {
|
||||
expect(text).to.be.oneOf(["Anytime here"]);
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
42
tests/e2e/modules_position_spec.js
Normal file
42
tests/e2e/modules_position_spec.js
Normal 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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
51
tests/e2e/port_config.js
Normal file
51
tests/e2e/port_config.js
Normal file
@@ -0,0 +1,51 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Set port 8100 on enviroment variable MM_PORT", function () {
|
||||
before(function() {
|
||||
process.env.MM_PORT = 8100;
|
||||
// Set config sample for use in this test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
|
||||
});
|
||||
|
||||
after(function(){
|
||||
delete process.env.MM_PORT;
|
||||
});
|
||||
it("should return 200", function (done) {
|
||||
request.get("http://localhost:8100", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(200);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
53
tests/e2e/without_modules.js
Normal file
53
tests/e2e/without_modules.js
Normal file
@@ -0,0 +1,53 @@
|
||||
const Application = require("spectron").Application;
|
||||
const path = require("path");
|
||||
const chai = require("chai");
|
||||
const chaiAsPromised = require("chai-as-promised");
|
||||
|
||||
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
|
||||
|
||||
if (process.platform === "win32") {
|
||||
electronPath += ".cmd";
|
||||
}
|
||||
|
||||
var appPath = path.join(__dirname, "../../js/electron.js");
|
||||
|
||||
var app = new Application({
|
||||
path: electronPath,
|
||||
args: [appPath]
|
||||
});
|
||||
|
||||
global.before(function () {
|
||||
chai.should();
|
||||
chai.use(chaiAsPromised);
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe("Check configuration without modules", function () {
|
||||
this.timeout(20000);
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("Show the message MagicMirror title", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2")
|
||||
});
|
||||
|
||||
it("Show the text Michael's website", function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
|
||||
});
|
||||
|
||||
});
|
||||
|
30
tests/servers/basic-auth.js
Normal file
30
tests/servers/basic-auth.js
Normal file
@@ -0,0 +1,30 @@
|
||||
var http = require("http");
|
||||
var path = require("path");
|
||||
var auth = require("http-auth");
|
||||
var express = require("express")
|
||||
|
||||
var basic = auth.basic({
|
||||
realm: "MagicMirror Area restricted."
|
||||
}, (username, password, callback) => {
|
||||
callback(username === "MagicMirror" && password === "CallMeADog");
|
||||
});
|
||||
|
||||
this.server = express();
|
||||
this.server.use(auth.connect(basic));
|
||||
|
||||
// Set directories availables
|
||||
var directories = ["/tests/configs"];
|
||||
var directory;
|
||||
rootPath = path.resolve(__dirname + "/../../");
|
||||
for (i in directories) {
|
||||
directory = directories[i];
|
||||
this.server.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||
}
|
||||
|
||||
exports.listen = function () {
|
||||
this.server.listen.apply(this.server, arguments);
|
||||
};
|
||||
|
||||
exports.close = function (callback) {
|
||||
this.server.close(callback);
|
||||
};
|
@@ -63,8 +63,8 @@ describe("'global.root_path' set in js/app.js", function() {
|
||||
});
|
||||
|
||||
it("should expect the global.version equals package.json file", function() {
|
||||
version_package = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(version_package);
|
||||
versionPackage = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
|
||||
expect(this.sandbox.global.version).to.equal(versionPackage);
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user