mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
When trying to debug why the tests broke for https://github.com/MichMich/MagicMirror/pull/2946 I found that the tests does not wait for the app to start and close. So if the startup isn't blocking that would fail. So I added a callback for `close()` too and converted them to promises for the `startApplication()` and `stopApplication()` and updated all the e2e tests to await both. Will try to refactor all these callbacks to promises in a later PR.
66 lines
2.3 KiB
JavaScript
66 lines
2.3 KiB
JavaScript
const helpers = require("../helpers/global-setup");
|
|
|
|
describe("Clock set to spanish language module", () => {
|
|
afterAll(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
describe("with default 24hr clock config", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_24hr.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows date with correct format", async () => {
|
|
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
|
await helpers.testMatch(".clock .date", dateRegex);
|
|
});
|
|
|
|
it("shows time in 24hr format", async () => {
|
|
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
|
await helpers.testMatch(".clock .time", timeRegex);
|
|
});
|
|
});
|
|
|
|
describe("with default 12hr clock config", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_12hr.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows date with correct format", async () => {
|
|
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
|
|
await helpers.testMatch(".clock .date", dateRegex);
|
|
});
|
|
|
|
it("shows time in 12hr format", async () => {
|
|
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
|
await helpers.testMatch(".clock .time", timeRegex);
|
|
});
|
|
});
|
|
|
|
describe("with showPeriodUpper config enabled", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_showPeriodUpper.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows 12hr time with upper case AM/PM", async () => {
|
|
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
|
await helpers.testMatch(".clock .time", timeRegex);
|
|
});
|
|
});
|
|
|
|
describe("with showWeek config enabled", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/modules/clock/es/clock_showWeek.js");
|
|
await helpers.getDocument();
|
|
});
|
|
|
|
it("shows week with correct format", async () => {
|
|
const weekRegex = /^Semana [0-9]{1,2}$/;
|
|
await helpers.testMatch(".clock .week", weekRegex);
|
|
});
|
|
});
|
|
});
|