Skip to content

Commit 611bc26

Browse files
authored
Merge pull request MagicMirrorOrg#719 from roramirez/test-without-modules
Testing default modules
2 parents 0dc3916 + cfc8117 commit 611bc26

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

Diff for: tests/configs/without_modules.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* Magic Mirror Test default config for modules
2+
*
3+
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
4+
* MIT Licensed.
5+
*/
6+
7+
var config = {
8+
port: 8080,
9+
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.10.1"],
10+
11+
language: "en",
12+
timeFormat: 24,
13+
units: "metric",
14+
electronOptions: {
15+
webPreferences: {
16+
nodeIntegration: true,
17+
},
18+
}
19+
20+
};
21+
22+
/*************** DO NOT EDIT THE LINE BELOW ***************/
23+
if (typeof module !== "undefined") {module.exports = config;}

Diff for: tests/e2e/without_modules.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const Application = require("spectron").Application;
2+
const path = require("path");
3+
const chai = require("chai");
4+
const chaiAsPromised = require("chai-as-promised");
5+
6+
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
7+
8+
if (process.platform === "win32") {
9+
electronPath += ".cmd";
10+
}
11+
12+
var appPath = path.join(__dirname, "../../js/electron.js");
13+
14+
var app = new Application({
15+
path: electronPath,
16+
args: [appPath]
17+
});
18+
19+
global.before(function () {
20+
chai.should();
21+
chai.use(chaiAsPromised);
22+
});
23+
24+
25+
26+
describe("Check configuration without modules", function () {
27+
this.timeout(20000);
28+
29+
before(function() {
30+
// Set config sample for use in test
31+
process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js";
32+
});
33+
34+
beforeEach(function (done) {
35+
app.start().then(function() { done(); } );
36+
});
37+
38+
afterEach(function (done) {
39+
app.stop().then(function() { done(); });
40+
});
41+
42+
it("Show the message MagicMirror title", function () {
43+
return app.client.waitUntilWindowLoaded()
44+
.getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2")
45+
});
46+
47+
it("Show the text Michael's website", function () {
48+
return app.client.waitUntilWindowLoaded()
49+
.getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
50+
});
51+
52+
});
53+

0 commit comments

Comments
 (0)