|
| 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