MagicMirror/tests/e2e/dev_console.js

56 lines
1.3 KiB
JavaScript
Raw Normal View History

2017-02-05 11:38:01 +01:00
const Application = require("spectron").Application;
const path = require("path");
const chai = require("chai");
2017-02-07 22:29:51 +01:00
const expect = chai.expect;
2017-02-05 11:38:01 +01:00
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
});
global.before(function () {
chai.should();
chai.use(chaiAsPromised);
});
describe("Argument 'dev'", function () {
2017-02-12 15:36:18 -03:00
this.timeout(20000);
2017-02-05 11:38:01 +01:00
// This tests fail and crash another tests
// FIXME
return false;
2017-02-05 11:38:01 +01:00
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("should not open dev console when absent", function () {
app.args = [appPath];
return app.start().then(function() {
2017-02-07 22:29:51 +01:00
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(false);
2017-02-05 11:38:01 +01:00
});
});
it("should open dev console when provided", function () {
2017-02-05 12:26:42 +01:00
app.args = [appPath, "dev"];
2017-02-05 11:38:01 +01:00
return app.start().then(function() {
2017-02-07 22:29:51 +01:00
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(true);
2017-02-05 11:38:01 +01:00
});
});
});