MagicMirror/tests/electron/dev_console.js

54 lines
1.2 KiB
JavaScript
Raw Normal View History

const helpers = require("./global-setup");
2017-02-05 11:38:01 +01:00
describe("Development console tests", function () {
helpers.setupTimeout(this);
2021-04-08 21:12:56 +02:00
let app = null;
2021-06-08 00:47:40 +02:00
beforeAll(function () {
2017-02-05 11:38:01 +01:00
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
});
describe("Without 'dev' commandline argument", function () {
2021-06-08 00:47:40 +02:00
beforeAll(function () {
return helpers
.startApplication({
args: ["js/electron.js"]
})
.then(function (startedApp) {
app = startedApp;
});
});
2017-02-05 11:38:01 +01:00
2021-06-08 00:47:40 +02:00
afterAll(function () {
return helpers.stopApplication(app);
});
2017-02-05 11:38:01 +01:00
2021-06-08 00:47:40 +02:00
it("should not open dev console when absent", async function () {
await app.client.waitUntilWindowLoaded();
return expect(await app.browserWindow.isDevToolsOpened()).toBe(false);
2017-02-05 11:38:01 +01:00
});
});
describe("With 'dev' commandline argument", function () {
beforeAll(function () {
return helpers
.startApplication({
args: ["js/electron.js", "dev"]
})
.then(function (startedApp) {
app = startedApp;
});
});
afterAll(function () {
return helpers.stopApplication(app);
});
it("should open dev console when provided", async function () {
expect(await app.client.getWindowCount()).toBe(2);
});
});
2017-02-05 11:38:01 +01:00
});