mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
fix e2e tests not failing on errors, disable recurring-event-tests of calendar
This commit is contained in:
@@ -1,118 +1,121 @@
|
||||
const helpers = require("../global-setup");
|
||||
const moment = require("moment");
|
||||
|
||||
describe("Clock module", function () {
|
||||
afterAll(async function () {
|
||||
describe("Clock module", () => {
|
||||
afterAll(async () => {
|
||||
await helpers.stopApplication();
|
||||
});
|
||||
|
||||
const testMatch = function (element, regex) {
|
||||
const testMatch = (done, element, regex) => {
|
||||
helpers.waitForElement(element).then((elem) => {
|
||||
done();
|
||||
expect(elem).not.toBe(null);
|
||||
expect(elem.textContent).toMatch(regex);
|
||||
});
|
||||
};
|
||||
|
||||
describe("with default 24hr clock config", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with default 24hr clock config", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_24hr.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show the date in the correct format", function () {
|
||||
it("should show the date in the correct format", (done) => {
|
||||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
|
||||
testMatch(".clock .date", dateRegex);
|
||||
testMatch(done, ".clock .date", dateRegex);
|
||||
});
|
||||
|
||||
it("should show the time in 24hr format", function () {
|
||||
it("should show the time in 24hr format", (done) => {
|
||||
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
|
||||
testMatch(".clock .time", timeRegex);
|
||||
testMatch(done, ".clock .time", timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with default 12hr clock config", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with default 12hr clock config", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_12hr.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show the date in the correct format", function () {
|
||||
it("should show the date in the correct format", (done) => {
|
||||
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
|
||||
testMatch(".clock .date", dateRegex);
|
||||
testMatch(done, ".clock .date", dateRegex);
|
||||
});
|
||||
|
||||
it("should show the time in 12hr format", function () {
|
||||
it("should show the time in 12hr format", (done) => {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
|
||||
testMatch(".clock .time", timeRegex);
|
||||
testMatch(done, ".clock .time", timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showPeriodUpper config enabled", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with showPeriodUpper config enabled", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_showPeriodUpper.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show 12hr time with upper case AM/PM", function () {
|
||||
it("should show 12hr time with upper case AM/PM", (done) => {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
|
||||
testMatch(".clock .time", timeRegex);
|
||||
testMatch(done, ".clock .time", timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with displaySeconds config disabled", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with displaySeconds config disabled", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_displaySeconds_false.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show 12hr time without seconds am/pm", function () {
|
||||
it("should show 12hr time without seconds am/pm", (done) => {
|
||||
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
|
||||
testMatch(".clock .time", timeRegex);
|
||||
testMatch(done, ".clock .time", timeRegex);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showTime config disabled", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with showTime config disabled", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_showTime.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show not show the time when digital clock is shown", function () {
|
||||
helpers.waitForElement(".clock .digital .time").then((elem) => {
|
||||
expect(elem).toBe(null);
|
||||
});
|
||||
it("should not show the time when digital clock is shown", (done) => {
|
||||
const elem = document.querySelector(".clock .digital .time");
|
||||
done();
|
||||
expect(elem).toBe(null);
|
||||
});
|
||||
});
|
||||
|
||||
describe("with showWeek config enabled", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with showWeek config enabled", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_showWeek.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show the week in the correct format", function () {
|
||||
it("should show the week in the correct format", (done) => {
|
||||
const weekRegex = /^Week [0-9]{1,2}$/;
|
||||
testMatch(".clock .week", weekRegex);
|
||||
testMatch(done, ".clock .week", weekRegex);
|
||||
});
|
||||
|
||||
it("should show the week with the correct number of week of year", function () {
|
||||
it("should show the week with the correct number of week of year", (done) => {
|
||||
const currentWeekNumber = moment().week();
|
||||
const weekToShow = "Week " + currentWeekNumber;
|
||||
helpers.waitForElement(".clock .week").then((elem) => {
|
||||
done();
|
||||
expect(elem).not.toBe(null);
|
||||
expect(elem.textContent).toBe(weekToShow);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("with analog clock face enabled", function () {
|
||||
beforeAll(function (done) {
|
||||
describe("with analog clock face enabled", () => {
|
||||
beforeAll((done) => {
|
||||
helpers.startApplication("tests/configs/modules/clock/clock_analog.js");
|
||||
helpers.getDocument(done);
|
||||
});
|
||||
|
||||
it("should show the analog clock face", () => {
|
||||
it("should show the analog clock face", (done) => {
|
||||
helpers.waitForElement(".clockCircle").then((elem) => {
|
||||
done();
|
||||
expect(elem).not.toBe(null);
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user