diff --git a/tests/configs/without_modules.js b/tests/configs/without_modules.js index 02b767c0..d84f63b7 100644 --- a/tests/configs/without_modules.js +++ b/tests/configs/without_modules.js @@ -3,10 +3,13 @@ * By Rodrigo Ramírez Norambuena https://rodrigoramirez.com * MIT Licensed. */ -let config = require(process.cwd() + "/tests/configs/default.js").configFactory({ - ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.10.1"] -}); -delete config.modules; +let config = { + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.10.1"], + language: "en", + timeFormat: 24, + units: "metric", +}; /*************** DO NOT EDIT THE LINE BELOW ***************/ if (typeof module !== "undefined") { diff --git a/tests/e2e/env_spec.js b/tests/e2e/env_spec.js index 825da0e6..65dce883 100644 --- a/tests/e2e/env_spec.js +++ b/tests/e2e/env_spec.js @@ -3,8 +3,9 @@ const helpers = require("./global-setup"); let app = null; describe("Electron app environment", function () { - beforeAll(function () { - app = helpers.startApplication("tests/configs/env.js"); + beforeAll(function (done) { + app = helpers.startApplication("tests/configs/default.js"); + helpers.getDocument(done); }); afterAll(function () { helpers.stopApplication(app); @@ -23,4 +24,10 @@ describe("Electron app environment", function () { done(); }); }); + + it("should show the title MagicMirror²", function () { + const elem = document.querySelector("title"); + expect(elem).not.toBe(null); + expect(elem.textContent).toBe("MagicMirror²"); + }); }); diff --git a/tests/e2e/vendor_spec.js b/tests/e2e/vendor_spec.js index e8dcde11..e28f2d84 100644 --- a/tests/e2e/vendor_spec.js +++ b/tests/e2e/vendor_spec.js @@ -4,7 +4,7 @@ let app = null; describe("Vendors", function () { beforeAll(function () { - app = helpers.startApplication("tests/configs/env.js"); + app = helpers.startApplication("tests/configs/default.js"); }); afterAll(function () { helpers.stopApplication(app); diff --git a/tests/e2e/without_modules.js b/tests/e2e/without_modules.js new file mode 100644 index 00000000..dce6c0b2 --- /dev/null +++ b/tests/e2e/without_modules.js @@ -0,0 +1,24 @@ +const helpers = require("./global-setup"); +let app = null; + +describe("Check configuration without modules", function () { + beforeAll(function (done) { + app = helpers.startApplication("tests/configs/without_modules.js"); + helpers.getDocument(done, 1000); + }); + afterAll(function () { + helpers.stopApplication(app); + }); + + it("Show the message MagicMirror title", function () { + const elem = document.querySelector("#module_1_helloworld .module-content"); + expect(elem).not.toBe(null); + expect(elem.textContent).toContain("Magic Mirror2"); + }); + + it("Show the text Michael's website", function () { + const elem = document.querySelector("#module_5_helloworld .module-content"); + expect(elem).not.toBe(null); + expect(elem.textContent).toContain("www.michaelteeuw.nl"); + }); +}); diff --git a/tests/electron/without_modules.js b/tests/electron/without_modules.js deleted file mode 100644 index 0214aed7..00000000 --- a/tests/electron/without_modules.js +++ /dev/null @@ -1,36 +0,0 @@ -const helpers = require("./global-setup"); - -describe("Check configuration without modules", function () { - helpers.setupTimeout(this); - - let app = null; - - beforeEach(function () { - return helpers - .startApplication({ - args: ["js/electron.js"] - }) - .then(function (startedApp) { - app = startedApp; - }); - }); - - afterEach(function () { - return helpers.stopApplication(app); - }); - - beforeAll(function () { - // Set config sample for use in test - process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js"; - }); - - it("Show the message MagicMirror title", async function () { - const elem = await app.client.$("#module_1_helloworld .module-content"); - return expect(await elem.getText("#module_1_helloworld .module-content")).toBe("Magic Mirror2"); - }); - - it("Show the text Michael's website", async function () { - const elem = await app.client.$("#module_5_helloworld .module-content"); - return expect(await elem.getText("#module_5_helloworld .module-content")).toBe("www.michaelteeuw.nl"); - }); -});