From e3a5bbf661779bd44ade07cd831e008815e33844 Mon Sep 17 00:00:00 2001 From: Karsten Hassel Date: Mon, 14 Jun 2021 21:07:38 +0200 Subject: [PATCH] use expect where missing --- tests/e2e/modules/clock_es_spec.js | 2 +- tests/e2e/modules/clock_spec.js | 6 +++--- tests/e2e/modules/helloworld_spec.js | 4 ++-- tests/e2e/modules_display_spec.js | 4 ++-- tests/e2e/modules_position_spec.js | 4 +++- tests/e2e/without_modules.js | 4 ++-- 6 files changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/e2e/modules/clock_es_spec.js b/tests/e2e/modules/clock_es_spec.js index 63b2aa1a..f97fba2f 100644 --- a/tests/e2e/modules/clock_es_spec.js +++ b/tests/e2e/modules/clock_es_spec.js @@ -9,7 +9,7 @@ describe("Clock set to spanish language module", function () { await app.client.waitUntilWindowLoaded(); const elem = await app.client.$(element); const txt = await elem.getText(element); - return txt.match(regex); + return expect(txt).toMatch(regex); }; beforeEach(function () { diff --git a/tests/e2e/modules/clock_spec.js b/tests/e2e/modules/clock_spec.js index 0cea265b..c09f44de 100644 --- a/tests/e2e/modules/clock_spec.js +++ b/tests/e2e/modules/clock_spec.js @@ -10,7 +10,7 @@ describe("Clock module", function () { await app.client.waitUntilWindowLoaded(); const elem = await app.client.$(element); const txt = await elem.getText(element); - return txt.match(regex); + return expect(txt).toMatch(regex); }; beforeEach(function () { @@ -102,7 +102,7 @@ describe("Clock module", function () { await app.client.waitUntilWindowLoaded(); const elem = await app.client.$(".clock .week"); const txt = await elem.getText(".clock .week"); - return txt === weekToShow; + return expect(txt).toBe(weekToShow); }); }); @@ -113,7 +113,7 @@ describe("Clock module", function () { }); it("should show the analog clock face", async () => { - await app.client.waitUntilWindowLoaded(10000); + await app.client.waitUntilWindowLoaded(); const clock = await app.client.$$(".clockCircle"); return expect(clock.length).toBe(1); }); diff --git a/tests/e2e/modules/helloworld_spec.js b/tests/e2e/modules/helloworld_spec.js index 49e9f8f3..95ee1a2d 100644 --- a/tests/e2e/modules/helloworld_spec.js +++ b/tests/e2e/modules/helloworld_spec.js @@ -27,7 +27,7 @@ describe("Test helloworld module", function () { it("Test message helloworld module", async function () { const elem = await app.client.$(".helloworld"); - return elem.getText(".helloworld") === "Test HelloWorld Module"; + return expect(await elem.getText(".helloworld")).toBe("Test HelloWorld Module"); }); }); @@ -39,7 +39,7 @@ describe("Test helloworld module", function () { it("Test message helloworld module", async function () { const elem = await app.client.$(".helloworld"); - return elem.getText(".helloworld") === "Hello World!"; + return expect(await elem.getText(".helloworld")).toBe("Hello World!"); }); }); }); diff --git a/tests/e2e/modules_display_spec.js b/tests/e2e/modules_display_spec.js index 71a1f670..6132c62f 100644 --- a/tests/e2e/modules_display_spec.js +++ b/tests/e2e/modules_display_spec.js @@ -27,12 +27,12 @@ describe("Display of modules", function () { it("should show the test header", async () => { const elem = await app.client.$("#module_0_helloworld .module-header", 10000); - return elem.getText("#module_0_helloworld .module-header") === "TEST_HEADER"; + return expect(await elem.getText("#module_0_helloworld .module-header")).toBe("TEST_HEADER"); }); it("should show no header if no header text is specified", async () => { const elem = await app.client.$("#module_1_helloworld .module-header", 10000); - return elem.getText("#module_1_helloworld .module-header") === false; + return expect(await elem.getText("#module_1_helloworld .module-header")).toBe(""); }); }); }); diff --git a/tests/e2e/modules_position_spec.js b/tests/e2e/modules_position_spec.js index 80525afb..7ac1cadd 100644 --- a/tests/e2e/modules_position_spec.js +++ b/tests/e2e/modules_position_spec.js @@ -28,7 +28,9 @@ describe("Position of modules", function () { const className = position.replace("_", "."); it("should show text in " + position, function () { return app.client.$("." + className).then((result) => { - return result.getText("." + className) === "Text in " + position; + return result.getText("." + className).then((text) => { + return expect(text).toContain("Text in " + position); + }); }); }); } diff --git a/tests/e2e/without_modules.js b/tests/e2e/without_modules.js index 499caad0..0214aed7 100644 --- a/tests/e2e/without_modules.js +++ b/tests/e2e/without_modules.js @@ -26,11 +26,11 @@ describe("Check configuration without modules", function () { it("Show the message MagicMirror title", async function () { const elem = await app.client.$("#module_1_helloworld .module-content"); - return elem.getText("#module_1_helloworld .module-content") === "Magic Mirror2"; + 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 elem.getText("#module_5_helloworld .module-content") === "www.michaelteeuw.nl"; + return expect(await elem.getText("#module_5_helloworld .module-content")).toBe("www.michaelteeuw.nl"); }); });