2022-10-07 19:16:37 +02:00
|
|
|
const helpers = require("../helpers/global-setup");
|
2021-09-25 23:37:37 +02:00
|
|
|
|
2022-10-04 10:15:24 +02:00
|
|
|
describe("Compliments module", () => {
|
|
|
|
/**
|
|
|
|
* move similar tests in function doTest
|
|
|
|
* @param {Array} complimentsArray The array of compliments.
|
|
|
|
*/
|
|
|
|
const doTest = async (complimentsArray) => {
|
|
|
|
let elem = await helpers.waitForElement(".compliments");
|
2023-11-20 20:11:41 +01:00
|
|
|
expect(elem).not.toBeNull();
|
2022-10-04 10:15:24 +02:00
|
|
|
elem = await helpers.waitForElement(".module-content");
|
2023-11-20 20:11:41 +01:00
|
|
|
expect(elem).not.toBeNull();
|
2022-10-04 10:15:24 +02:00
|
|
|
expect(complimentsArray).toContain(elem.textContent);
|
|
|
|
};
|
2021-09-25 23:37:37 +02:00
|
|
|
|
2022-09-20 23:43:06 +02:00
|
|
|
afterAll(async () => {
|
2022-05-27 19:46:28 +02:00
|
|
|
await helpers.stopApplication();
|
2021-09-25 23:37:37 +02:00
|
|
|
});
|
|
|
|
|
2022-09-20 23:43:06 +02:00
|
|
|
describe("Feature anytime in compliments module", () => {
|
2023-11-20 20:11:41 +01:00
|
|
|
describe("Set anytime and empty compliments for morning, evening and afternoon", () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
beforeAll(async () => {
|
2022-10-29 22:34:17 +02:00
|
|
|
await helpers.startApplication("tests/configs/modules/compliments/compliments_anytime.js");
|
2022-10-04 10:15:24 +02:00
|
|
|
await helpers.getDocument();
|
2021-09-25 23:37:37 +02:00
|
|
|
});
|
|
|
|
|
2023-04-09 12:49:50 +02:00
|
|
|
it("shows anytime because if configure empty parts of day compliments and set anytime compliments", async () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
await doTest(["Anytime here"]);
|
2021-09-25 23:37:37 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-09-20 23:43:06 +02:00
|
|
|
describe("Only anytime present in configuration compliments", () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
beforeAll(async () => {
|
2022-10-29 22:34:17 +02:00
|
|
|
await helpers.startApplication("tests/configs/modules/compliments/compliments_only_anytime.js");
|
2022-10-04 10:15:24 +02:00
|
|
|
await helpers.getDocument();
|
2021-09-25 23:37:37 +02:00
|
|
|
});
|
|
|
|
|
2023-04-09 12:49:50 +02:00
|
|
|
it("shows anytime compliments", async () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
await doTest(["Anytime here"]);
|
2021-09-25 23:37:37 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-10-04 14:26:31 +02:00
|
|
|
describe("remoteFile option", () => {
|
|
|
|
beforeAll(async () => {
|
2022-10-29 22:34:17 +02:00
|
|
|
await helpers.startApplication("tests/configs/modules/compliments/compliments_remote.js");
|
2022-10-04 14:26:31 +02:00
|
|
|
await helpers.getDocument();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should show compliments from a remote file", async () => {
|
|
|
|
await doTest(["Remote compliment file works!"]);
|
|
|
|
});
|
|
|
|
});
|
2021-09-25 23:37:37 +02:00
|
|
|
});
|