|
1 | 1 | const helpers = require("../helpers/global-setup"); |
2 | 2 |
|
3 | 3 | describe("Alert module", () => { |
4 | | - beforeAll(async () => { |
5 | | - await helpers.startApplication("tests/configs/modules/alert/default.js"); |
6 | | - await helpers.getDocument(); |
7 | | - }); |
8 | 4 | afterAll(async () => { |
9 | 5 | await helpers.stopApplication(); |
10 | 6 | }); |
11 | 7 |
|
12 | | - it("should show the welcome message", async () => { |
13 | | - const elem = await helpers.waitForElement(".ns-box .ns-box-inner .light.bright.small"); |
14 | | - expect(elem).not.toBeNull(); |
15 | | - expect(elem.textContent).toContain("Welcome, start was successful!"); |
| 8 | + describe("with welcome_message set to false", () => { |
| 9 | + beforeAll(async () => { |
| 10 | + await helpers.startApplication("tests/configs/modules/alert/welcome_false.js"); |
| 11 | + await helpers.getDocument(); |
| 12 | + }); |
| 13 | + |
| 14 | + it("should not show any welcome message", async () => { |
| 15 | + // Wait a bit to ensure no message appears |
| 16 | + await new Promise((resolve) => setTimeout(resolve, 1000)); |
| 17 | + |
| 18 | + // Check that no alert/notification elements are present |
| 19 | + const alertElements = document.querySelectorAll(".ns-box .ns-box-inner .light.bright.small"); |
| 20 | + expect(alertElements).toHaveLength(0); |
| 21 | + }); |
| 22 | + }); |
| 23 | + |
| 24 | + describe("with welcome_message set to true", () => { |
| 25 | + beforeAll(async () => { |
| 26 | + await helpers.startApplication("tests/configs/modules/alert/welcome_true.js"); |
| 27 | + await helpers.getDocument(); |
| 28 | + |
| 29 | + // Wait for the application to initialize |
| 30 | + await new Promise((resolve) => setTimeout(resolve, 1000)); |
| 31 | + }); |
| 32 | + |
| 33 | + it("should show the translated welcome message", async () => { |
| 34 | + const elem = await helpers.waitForElement(".ns-box .ns-box-inner .light.bright.small"); |
| 35 | + expect(elem).not.toBeNull(); |
| 36 | + expect(elem.textContent).toContain("Welcome, start was successful!"); |
| 37 | + }); |
| 38 | + }); |
| 39 | + |
| 40 | + describe("with welcome_message set to custom string", () => { |
| 41 | + beforeAll(async () => { |
| 42 | + await helpers.startApplication("tests/configs/modules/alert/welcome_string.js"); |
| 43 | + await helpers.getDocument(); |
| 44 | + }); |
| 45 | + |
| 46 | + it("should show the custom welcome message", async () => { |
| 47 | + const elem = await helpers.waitForElement(".ns-box .ns-box-inner .light.bright.small"); |
| 48 | + expect(elem).not.toBeNull(); |
| 49 | + expect(elem.textContent).toContain("Custom welcome message!"); |
| 50 | + }); |
16 | 51 | }); |
17 | 52 | }); |
0 commit comments