improve waitForElement

This commit is contained in:
Karsten Hassel
2022-01-13 21:12:15 +01:00
parent 42b80b18f8
commit 2cfafe7bfe
12 changed files with 129 additions and 108 deletions

View File

@@ -8,26 +8,28 @@ describe("Test helloworld module", function () {
describe("helloworld set config text", function () {
beforeAll(function (done) {
helpers.startApplication("tests/configs/modules/helloworld/helloworld.js");
helpers.getDocument(done, 1000);
helpers.getDocument(done);
});
it("Test message helloworld module", function () {
const elem = document.querySelector(".helloworld");
expect(elem).not.toBe(null);
expect(elem.textContent).toContain("Test HelloWorld Module");
helpers.waitForElement(".helloworld").then((elem) => {
expect(elem).not.toBe(null);
expect(elem.textContent).toContain("Test HelloWorld Module");
});
});
});
describe("helloworld default config text", function () {
beforeAll(function (done) {
helpers.startApplication("tests/configs/modules/helloworld/helloworld_default.js");
helpers.getDocument(done, 1000);
helpers.getDocument(done);
});
it("Test message helloworld module", function () {
const elem = document.querySelector(".helloworld");
expect(elem).not.toBe(null);
expect(elem.textContent).toContain("Hello World!");
helpers.waitForElement(".helloworld").then((elem) => {
expect(elem).not.toBe(null);
expect(elem.textContent).toContain("Hello World!");
});
});
});
});