mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-09-14 08:07:01 +00:00
Fix empty part-of-day logic (#3726)
Fixes #3727 --------- Co-authored-by: veeck <gitkraken@veeck.de>
This commit is contained in:
22
tests/configs/modules/compliments/compliments_evening.js
Normal file
22
tests/configs/modules/compliments/compliments_evening.js
Normal file
@@ -0,0 +1,22 @@
|
||||
let config = {
|
||||
address: "0.0.0.0",
|
||||
ipWhitelist: [],
|
||||
timeFormat: 12,
|
||||
|
||||
modules: [
|
||||
{
|
||||
module: "compliments",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
compliments: {
|
||||
evening: ["Evening here"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") {
|
||||
module.exports = config;
|
||||
}
|
@@ -49,10 +49,10 @@ exports.stopApplication = async () => {
|
||||
process.env.MOCK_DATE = undefined;
|
||||
};
|
||||
|
||||
exports.getElement = async (selector) => {
|
||||
exports.getElement = async (selector, state = "visible") => {
|
||||
expect(global.page).not.toBeNull();
|
||||
let elem = global.page.locator(selector);
|
||||
await elem.waitFor();
|
||||
const elem = global.page.locator(selector);
|
||||
await elem.waitFor({ state: state });
|
||||
expect(elem).not.toBeNull();
|
||||
return elem;
|
||||
};
|
||||
|
@@ -7,9 +7,9 @@ describe("Compliments module", () => {
|
||||
* @param {Array} complimentsArray The array of compliments.
|
||||
* @returns {boolean} result
|
||||
*/
|
||||
const doTest = async (complimentsArray) => {
|
||||
await helpers.getElement(".compliments");
|
||||
const elem = await helpers.getElement(".module-content");
|
||||
const doTest = async (complimentsArray, state = "visible") => {
|
||||
await helpers.getElement(".compliments", state);
|
||||
const elem = await helpers.getElement(".module-content", state);
|
||||
expect(elem).not.toBeNull();
|
||||
expect(complimentsArray).toContain(await elem.textContent());
|
||||
return true;
|
||||
@@ -34,6 +34,11 @@ describe("Compliments module", () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_parts_day.js", "01 Oct 2022 20:00:00 GMT");
|
||||
await expect(doTest(["Hello There", "Good Evening", "Evening test"])).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("doesnt show evening compliments during the day when the other parts of day are not set", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_evening.js", "01 Oct 2022 08:00:00 GMT");
|
||||
await expect(doTest([""], "attached")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Feature date in compliments module", () => {
|
||||
|
Reference in New Issue
Block a user