use expect where missing

This commit is contained in:
Karsten Hassel 2021-06-14 21:07:38 +02:00
parent ee23c5f72c
commit e3a5bbf661
6 changed files with 13 additions and 11 deletions

View File

@ -9,7 +9,7 @@ describe("Clock set to spanish language module", function () {
await app.client.waitUntilWindowLoaded(); await app.client.waitUntilWindowLoaded();
const elem = await app.client.$(element); const elem = await app.client.$(element);
const txt = await elem.getText(element); const txt = await elem.getText(element);
return txt.match(regex); return expect(txt).toMatch(regex);
}; };
beforeEach(function () { beforeEach(function () {

View File

@ -10,7 +10,7 @@ describe("Clock module", function () {
await app.client.waitUntilWindowLoaded(); await app.client.waitUntilWindowLoaded();
const elem = await app.client.$(element); const elem = await app.client.$(element);
const txt = await elem.getText(element); const txt = await elem.getText(element);
return txt.match(regex); return expect(txt).toMatch(regex);
}; };
beforeEach(function () { beforeEach(function () {
@ -102,7 +102,7 @@ describe("Clock module", function () {
await app.client.waitUntilWindowLoaded(); await app.client.waitUntilWindowLoaded();
const elem = await app.client.$(".clock .week"); const elem = await app.client.$(".clock .week");
const txt = await elem.getText(".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 () => { it("should show the analog clock face", async () => {
await app.client.waitUntilWindowLoaded(10000); await app.client.waitUntilWindowLoaded();
const clock = await app.client.$$(".clockCircle"); const clock = await app.client.$$(".clockCircle");
return expect(clock.length).toBe(1); return expect(clock.length).toBe(1);
}); });

View File

@ -27,7 +27,7 @@ describe("Test helloworld module", function () {
it("Test message helloworld module", async function () { it("Test message helloworld module", async function () {
const elem = await app.client.$(".helloworld"); 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 () { it("Test message helloworld module", async function () {
const elem = await app.client.$(".helloworld"); const elem = await app.client.$(".helloworld");
return elem.getText(".helloworld") === "Hello World!"; return expect(await elem.getText(".helloworld")).toBe("Hello World!");
}); });
}); });
}); });

View File

@ -27,12 +27,12 @@ describe("Display of modules", function () {
it("should show the test header", async () => { it("should show the test header", async () => {
const elem = await app.client.$("#module_0_helloworld .module-header", 10000); 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 () => { it("should show no header if no header text is specified", async () => {
const elem = await app.client.$("#module_1_helloworld .module-header", 10000); 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("");
}); });
}); });
}); });

View File

@ -28,7 +28,9 @@ describe("Position of modules", function () {
const className = position.replace("_", "."); const className = position.replace("_", ".");
it("should show text in " + position, function () { it("should show text in " + position, function () {
return app.client.$("." + className).then((result) => { 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);
});
}); });
}); });
} }

View File

@ -26,11 +26,11 @@ describe("Check configuration without modules", function () {
it("Show the message MagicMirror title", async function () { it("Show the message MagicMirror title", async function () {
const elem = await app.client.$("#module_1_helloworld .module-content"); 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 () { it("Show the text Michael's website", async function () {
const elem = await app.client.$("#module_5_helloworld .module-content"); 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");
}); });
}); });