forked from MagicMirrorOrg/MagicMirror
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request MagicMirrorOrg#674 from morozgrafix/test_branch
Restructured Test Suite
- Loading branch information
Showing
13 changed files
with
217 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Magic Mirror Test config for default clock module | ||
* | ||
* By Sergey Morozov | ||
* 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" | ||
} | ||
] | ||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") {module.exports = config;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Magic Mirror Test config for default clock module | ||
* | ||
* By Sergey Morozov | ||
* MIT Licensed. | ||
*/ | ||
|
||
var config = { | ||
port: 8080, | ||
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], | ||
|
||
language: "en", | ||
timeFormat: 24, | ||
units: "metric", | ||
electronOptions: { | ||
webPreferences: { | ||
nodeIntegration: true, | ||
}, | ||
}, | ||
|
||
modules: [ | ||
{ | ||
module: "clock", | ||
position: "middle_center" | ||
} | ||
] | ||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") {module.exports = config;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* Magic Mirror Test config for default clock module | ||
* | ||
* By Sergey Morozov | ||
* 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: { | ||
showPeriodUpper: true | ||
} | ||
} | ||
] | ||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") {module.exports = config;} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
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("Clock module", function () { | ||
this.timeout(10000); | ||
|
||
describe("with default 24hr clock config", function() { | ||
before(function() { | ||
// Set config sample for use in test | ||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_24hr.js"; | ||
}); | ||
|
||
beforeEach(function (done) { | ||
app.start().then(function() { done(); } ); | ||
}); | ||
|
||
afterEach(function (done) { | ||
app.stop().then(function() { done(); }); | ||
}); | ||
|
||
it("shows date with correct format", function () { | ||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/; | ||
return app.client.waitUntilWindowLoaded() | ||
.getText(".clock .date").should.eventually.match(dateRegex); | ||
}); | ||
|
||
it("shows time in 24hr format", function() { | ||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/ | ||
return app.client.waitUntilWindowLoaded() | ||
.getText(".clock .time").should.eventually.match(timeRegex); | ||
}); | ||
}); | ||
|
||
describe("with default 12hr clock config", function() { | ||
before(function() { | ||
// Set config sample for use in test | ||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_12hr.js"; | ||
}); | ||
|
||
beforeEach(function (done) { | ||
app.start().then(function() { done(); } ); | ||
}); | ||
|
||
afterEach(function (done) { | ||
app.stop().then(function() { done(); }); | ||
}); | ||
|
||
it("shows date with correct format", function () { | ||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/; | ||
return app.client.waitUntilWindowLoaded() | ||
.getText(".clock .date").should.eventually.match(dateRegex); | ||
}); | ||
|
||
it("shows time in 12hr format", function() { | ||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/; | ||
return app.client.waitUntilWindowLoaded() | ||
.getText(".clock .time").should.eventually.match(timeRegex); | ||
}); | ||
}); | ||
|
||
describe("with showPeriodUpper config enabled", function() { | ||
before(function() { | ||
// Set config sample for use in test | ||
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showPeriodUpper.js"; | ||
}); | ||
|
||
beforeEach(function (done) { | ||
app.start().then(function() { done(); } ); | ||
}); | ||
|
||
afterEach(function (done) { | ||
app.stop().then(function() { done(); }); | ||
}); | ||
|
||
it("shows 12hr time with upper case AM/PM", function() { | ||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/; | ||
return app.client.waitUntilWindowLoaded() | ||
.getText(".clock .time").should.eventually.match(timeRegex); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
tests/functions/compare-version.js → tests/unit/functions/cmp_versions_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters