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

@@ -3,22 +3,24 @@ const helpers = require("./global-setup");
describe("Display of modules", function () {
beforeAll(function (done) {
helpers.startApplication("tests/configs/modules/display.js");
helpers.getDocument(done, 3000);
helpers.getDocument(done);
});
afterAll(function () {
helpers.stopApplication();
});
it("should show the test header", function () {
const elem = document.querySelector("#module_0_helloworld .module-header");
expect(elem).not.toBe(null);
// textContent gibt hier lowercase zurück, das uppercase wird durch css realisiert, was daher nicht in textContent landet
expect(elem.textContent).toBe("test_header");
helpers.waitForElement("#module_0_helloworld .module-header").then((elem) => {
expect(elem).not.toBe(null);
// textContent gibt hier lowercase zurück, das uppercase wird durch css realisiert, was daher nicht in textContent landet
expect(elem.textContent).toBe("test_header");
});
});
it("should show no header if no header text is specified", function () {
const elem = document.querySelector("#module_1_helloworld .module-header");
expect(elem).not.toBe(null);
expect(elem.textContent).toBe("undefined");
helpers.waitForElement("#module_1_helloworld .module-header").then((elem) => {
expect(elem).not.toBe(null);
expect(elem.textContent).toBe("undefined");
});
});
});