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

@@ -1,6 +1,5 @@
const helpers = require("../global-setup");
const serverBasicAuth = require("./basic-auth.js");
const testDelay = 4000;
describe("Calendar module", function () {
/**
@@ -16,14 +15,15 @@ describe("Calendar module", function () {
} else {
expect(elem.length).toBe(result);
}
})
});
}
const testTextContain = function (element, text) {
const elem = document.querySelector(".calendar");
expect(elem).not.toBe(null);
expect(elem.textContent).toContain(text);
}
helpers.waitForElement(element).then((elem) => {
expect(elem).not.toBe(null);
expect(elem.textContent).toContain(text);
});
};
afterAll(function () {
helpers.stopApplication();
@@ -86,7 +86,7 @@ describe("Calendar module", function () {
return i * 60;
};
helpers.startApplication("tests/configs/modules/calendar/recurring.js");
helpers.getDocument(done, testDelay);
helpers.getDocument(done);
});
it('should contain text "Mar 25th" in timezone UTC ' + -i, () => {
@@ -148,7 +148,7 @@ describe("Calendar module", function () {
beforeAll(function (done) {
helpers.startApplication("tests/configs/modules/calendar/fail-basic-auth.js");
serverBasicAuth.listen(8020);
helpers.getDocument(done, testDelay);
helpers.getDocument(done);
});
afterAll(function (done) {