Merge branch 'develop' into warn_dom

This commit is contained in:
Michael Teeuw 2021-02-06 11:01:08 +01:00 committed by GitHub
commit d240986fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 1172 additions and 1313 deletions

View File

@ -27,6 +27,7 @@ _This release is scheduled to be released on 2021-04-01._
- Converted newsfeed module to use templates.
- Update documentation and help screen about invalid config files.
- Moving weather provider specific code and configuration into each provider and making hourly part of the interface.
- Bump electron to v11.
- Dont update the DOM when a module is not displayed.
### Removed

2093
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -59,14 +59,14 @@
"prettier": "^2.2.1",
"pretty-quick": "^3.1.0",
"sinon": "^9.2.4",
"spectron": "^10.0.1",
"spectron": "^13.0.0",
"stylelint": "^13.8.0",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-prettier": "^1.1.2"
},
"optionalDependencies": {
"electron": "^8.5.3"
"electron": "^11.2.1"
},
"dependencies": {
"colors": "^1.4.0",

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -11,7 +11,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -15,7 +15,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -11,7 +11,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -16,7 +16,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ var config = {
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -15,7 +15,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -15,7 +15,8 @@ let config = {
electronOptions: {
fullscreen: false,
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ let config = {
units: "imperial",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -14,7 +14,8 @@ let config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
},

View File

@ -13,7 +13,8 @@ var config = {
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
}
}
};

View File

@ -31,25 +31,25 @@ describe("Electron app environment", function () {
return helpers.stopApplication(app);
});
it("should open a browserwindow", function () {
it("should open a browserwindow", async function () {
await app.client.waitUntilWindowLoaded();
app.browserWindow.focus();
const cnt = await app.client.getWindowCount();
const min = await app.browserWindow.isMinimized();
const dev = await app.browserWindow.isDevToolsOpened();
const vis = await app.browserWindow.isVisible();
const foc = await app.browserWindow.isFocused();
const bounds = await app.browserWindow.getBounds();
const title = await app.browserWindow.getTitle();
return (
app.client
.waitUntilWindowLoaded()
// .browserWindow.focus()
.getWindowCount()
.should.eventually.equal(1)
.browserWindow.isMinimized()
.should.eventually.be.false.browserWindow.isDevToolsOpened()
.should.eventually.be.false.browserWindow.isVisible()
.should.eventually.be.true.browserWindow.isFocused()
.should.eventually.be.true.browserWindow.getBounds()
.should.eventually.have.property("width")
.and.be.above(0)
.browserWindow.getBounds()
.should.eventually.have.property("height")
.and.be.above(0)
.browserWindow.getTitle()
.should.eventually.equal("MagicMirror²")
cnt.should.equal(1) &&
min.should.be.false &&
dev.should.be.false &&
vis.should.be.true &&
foc.should.be.true &&
bounds.should.have.property("width").and.be.above(0) &&
bounds.should.have.property("height").and.be.above(0) &&
title.should.equal("MagicMirror²")
);
});

View File

@ -30,14 +30,16 @@ describe("Clock set to spanish language module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js";
});
it("shows date with correct format", function () {
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}$/;
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
it("shows date with correct format", async function () {
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}$/;
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 24hr format", function () {
it("shows time in 24hr format", async function () {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -47,14 +49,16 @@ describe("Clock set to spanish language module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js";
});
it("shows date with correct format", function () {
it("shows date with correct format", async function () {
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}$/;
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 12hr format", function () {
it("shows time in 12hr format", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -64,9 +68,10 @@ describe("Clock set to spanish language module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js";
});
it("shows 12hr time with upper case AM/PM", function () {
it("shows 12hr time with upper case AM/PM", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -76,9 +81,10 @@ describe("Clock set to spanish language module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showWeek.js";
});
it("shows week with correct format", function () {
it("shows week with correct format", async function () {
const weekRegex = /^Semana [0-9]{1,2}$/;
return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.match(weekRegex);
const elem = await app.client.$(".clock .week");
elem.getText(".clock .week").should.eventually.match(weekRegex);
});
});
});

View File

@ -32,14 +32,16 @@ describe("Clock module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_24hr.js";
});
it("should show the date in the correct format", function () {
it("should show the date in the correct format", async function () {
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}$/;
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
});
it("should show the time in 24hr format", function () {
it("should show the time in 24hr format", async function () {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -49,14 +51,16 @@ describe("Clock module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_12hr.js";
});
it("should show the date in the correct format", function () {
it("should show the date in the correct format", async function () {
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}$/;
return app.client.waitUntilWindowLoaded().getText(".clock .date").should.eventually.match(dateRegex);
const elem = await app.client.$(".clock .date");
return elem.getText(".clock .date").should.eventually.match(dateRegex);
});
it("should show the time in 12hr format", function () {
it("should show the time in 12hr format", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -66,9 +70,10 @@ describe("Clock module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showPeriodUpper.js";
});
it("should show 12hr time with upper case AM/PM", function () {
it("should show 12hr time with upper case AM/PM", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -78,9 +83,10 @@ describe("Clock module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_displaySeconds_false.js";
});
it("should show 12hr time without seconds am/pm", function () {
it("should show 12hr time without seconds am/pm", async function () {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded().getText(".clock .time").should.eventually.match(timeRegex);
const elem = await app.client.$(".clock .time");
return elem.getText(".clock .time").should.eventually.match(timeRegex);
});
});
@ -90,15 +96,17 @@ describe("Clock module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showWeek.js";
});
it("should show the week in the correct format", function () {
it("should show the week in the correct format", async function () {
const weekRegex = /^Week [0-9]{1,2}$/;
return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.match(weekRegex);
const elem = await app.client.$(".clock .week");
return elem.getText(".clock .week").should.eventually.match(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", async function () {
const currentWeekNumber = moment().week();
const weekToShow = "Week " + currentWeekNumber;
return app.client.waitUntilWindowLoaded().getText(".clock .week").should.eventually.equal(weekToShow);
const elem = await app.client.$(".clock .week");
return elem.getText(".clock .week").should.eventually.equal(weekToShow);
});
});

View File

@ -31,40 +31,34 @@ describe("Compliments module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_parts_day.js";
});
it("if Morning compliments for that part of day", function () {
it("if Morning compliments for that part of day", async function () {
var hour = new Date().getHours();
if (hour >= 3 && hour < 12) {
// if morning check
return app.client
.waitUntilWindowLoaded()
.getText(".compliments")
.then(function (text) {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
});
}
});
it("if Afternoon show Compliments for that part of day", function () {
it("if Afternoon show Compliments for that part of day", async function () {
var hour = new Date().getHours();
if (hour >= 12 && hour < 17) {
// if morning check
return app.client
.waitUntilWindowLoaded()
.getText(".compliments")
.then(function (text) {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
});
}
});
it("if Evening show Compliments for that part of day", function () {
it("if Evening show Compliments for that part of day", async function () {
var hour = new Date().getHours();
if (!(hour >= 3 && hour < 12) && !(hour >= 12 && hour < 17)) {
// if evening check
return app.client
.waitUntilWindowLoaded()
.getText(".compliments")
.then(function (text) {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
});
}
@ -78,11 +72,9 @@ describe("Compliments module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
});
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () {
return app.client
.waitUntilWindowLoaded()
.getText(".compliments")
.then(function (text) {
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", async function () {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Anytime here"]);
});
});
@ -94,11 +86,9 @@ describe("Compliments module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_only_anytime.js";
});
it("Show anytime compliments", function () {
return app.client
.waitUntilWindowLoaded()
.getText(".compliments")
.then(function (text) {
it("Show anytime compliments", async function () {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Anytime here"]);
});
});
@ -112,11 +102,9 @@ describe("Compliments module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_date.js";
});
it("Show happy new year compliment on new years day", function () {
return app.client
.waitUntilWindowLoaded()
.getText(".compliments")
.then(function (text) {
it("Show happy new year compliment on new years day", async function () {
const elem = await app.client.$(".compliments");
return elem.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Happy new year!"]);
});
});

View File

@ -30,8 +30,9 @@ describe("Test helloworld module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/helloworld/helloworld.js";
});
it("Test message helloworld module", function () {
return app.client.waitUntilWindowLoaded().getText(".helloworld").should.eventually.equal("Test HelloWorld Module");
it("Test message helloworld module", async function () {
const elem = await app.client.$("helloworld");
return elem.getText(".helloworld").should.eventually.equal("Test HelloWorld Module");
});
});
@ -41,8 +42,9 @@ describe("Test helloworld module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/helloworld/helloworld_default.js";
});
it("Test message helloworld module", function () {
return app.client.waitUntilWindowLoaded().getText(".helloworld").should.eventually.equal("Hello World!");
it("Test message helloworld module", async function () {
const elem = await app.client.$("helloworld");
return elem.getText(".helloworld").should.eventually.equal("Hello World!");
});
});
});

View File

@ -43,7 +43,7 @@ describe("Weather module", function () {
const weather = generateWeather();
await setup({ template, data: weather });
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
return await app.client.$(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
});
it("should render sunrise", async function () {
@ -53,9 +53,9 @@ describe("Weather module", function () {
const weather = generateWeather({ sys: { sunrise, sunset } });
await setup({ template, data: weather });
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunrise", 10000);
await app.client.$(".weather .normal.medium span.wi.dimmed.wi-sunrise", 10000);
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(4)", "12:00 am", 10000);
return await app.client.$(".weather .normal.medium span:nth-child(4)", "12:00 am", 10000);
});
it("should render sunset", async function () {
@ -65,25 +65,25 @@ describe("Weather module", function () {
const weather = generateWeather({ sys: { sunrise, sunset } });
await setup({ template, data: weather });
await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunset", 10000);
await app.client.$(".weather .normal.medium span.wi.dimmed.wi-sunset", 10000);
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(4)", "11:59 pm", 10000);
return await app.client.$(".weather .normal.medium span:nth-child(4)", "11:59 pm", 10000);
});
it("should render temperature with icon", async function () {
const weather = generateWeather();
await setup({ template, data: weather });
await app.client.waitForExist(".weather .large.light span.wi.weathericon.wi-snow", 10000);
await app.client.$(".weather .large.light span.wi.weathericon.wi-snow", 10000);
return app.client.waitUntilTextExists(".weather .large.light span.bright", "1.5°", 10000);
return await app.client.$(".weather .large.light span.bright", "1.5°", 10000);
});
it("should render feels like temperature", async function () {
const weather = generateWeather();
await setup({ template, data: weather });
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "Feels like -5.6°", 10000);
return await app.client.$(".weather .normal.medium span.dimmed", "Feels like -5.6°", 10000);
});
});
@ -96,7 +96,7 @@ describe("Weather module", function () {
const weather = generateWeather();
await setup({ template, data: weather });
return app.client.waitUntilTextExists(".compliments .module-content span", "snow", 10000);
return await app.client.$(".compliments .module-content span", "snow", 10000);
});
});
@ -109,15 +109,15 @@ describe("Weather module", function () {
const weather = generateWeather();
await setup({ template, data: weather });
return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "12", 10000);
return await app.client.$(".weather .normal.medium span:nth-child(2)", "12", 10000);
});
it("should render showWindDirectionAsArrow = true", async function () {
const weather = generateWeather();
await setup({ template, data: weather });
await app.client.waitForExist(".weather .normal.medium sup i.fa-long-arrow-up", 10000);
const element = await app.client.getHTML(".weather .normal.medium sup i.fa-long-arrow-up");
const elem = await app.client.$(".weather .normal.medium sup i.fa-long-arrow-up", 10000);
const element = await elem.getHTML(".weather .normal.medium sup i.fa-long-arrow-up");
expect(element).to.include("transform:rotate(250deg);");
});
@ -126,17 +126,17 @@ describe("Weather module", function () {
const weather = generateWeather();
await setup({ template, data: weather });
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93", 10000);
return app.client.waitForExist(".weather .normal.medium sup i.wi-humidity", 10000);
await app.client.$(".weather .normal.medium span:nth-child(3)", "93", 10000);
return await app.client.$(".weather .normal.medium sup i.wi-humidity", 10000);
});
it("should render degreeLabel = true", async function () {
const weather = generateWeather();
await setup({ template, data: weather });
await app.client.waitUntilTextExists(".weather .large.light span.bright", "1°C", 10000);
await app.client.$(".weather .large.light span.bright", "1°C", 10000);
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "Feels like -6°C", 10000);
return await app.client.$(".weather .normal.medium span.dimmed", "Feels like -6°C", 10000);
});
});
@ -158,9 +158,9 @@ describe("Weather module", function () {
});
await setup({ template, data: weather });
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "22,0°", 10000);
await app.client.$(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
await app.client.$(".weather .large.light span.bright", "34,7°", 10000);
return await app.client.$(".weather .normal.medium span.dimmed", "22,0°", 10000);
});
it("should render decimalSymbol = ','", async function () {
@ -176,9 +176,9 @@ describe("Weather module", function () {
});
await setup({ template, data: weather });
await app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(3)", "93,7", 10000);
await app.client.waitUntilTextExists(".weather .large.light span.bright", "34,7°", 10000);
return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "22,0°", 10000);
await app.client.$(".weather .normal.medium span:nth-child(3)", "93,7", 10000);
await app.client.$(".weather .large.light span.bright", "34,7°", 10000);
return await app.client.$(".weather .normal.medium span.dimmed", "22,0°", 10000);
});
});
});
@ -202,7 +202,7 @@ describe("Weather module", function () {
const days = ["Today", "Tomorrow", "Sun", "Mon", "Tue"];
for (const [index, day] of days.entries()) {
await app.client.waitUntilTextExists(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(1)`, day, 10000);
await app.client.$(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(1)`, day, 10000);
}
});
@ -213,7 +213,7 @@ describe("Weather module", function () {
const icons = ["day-cloudy", "rain", "day-sunny", "day-sunny", "day-sunny"];
for (const [index, icon] of icons.entries()) {
await app.client.waitForExist(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(2) span.wi-${icon}`, 10000);
await app.client.$(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(2) span.wi-${icon}`, 10000);
}
});
@ -224,7 +224,7 @@ describe("Weather module", function () {
const temperatures = ["24.4°", "21.0°", "22.9°", "23.4°", "20.6°"];
for (const [index, temp] of temperatures.entries()) {
await app.client.waitUntilTextExists(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(3)`, temp, 10000);
await app.client.$(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(3)`, temp, 10000);
}
});
@ -235,7 +235,7 @@ describe("Weather module", function () {
const temperatures = ["15.3°", "13.6°", "13.8°", "13.9°", "10.9°"];
for (const [index, temp] of temperatures.entries()) {
await app.client.waitUntilTextExists(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(4)`, temp, 10000);
await app.client.$(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(4)`, temp, 10000);
}
});
@ -245,10 +245,10 @@ describe("Weather module", function () {
const opacities = [1, 1, 0.8, 0.5333333333333333, 0.2666666666666667];
await app.client.waitForExist(".weather table.small", 10000);
const elem = await app.client.$(".weather table.small", 10000);
for (const [index, opacity] of opacities.entries()) {
const html = await app.client.getHTML(`.weather table.small tr:nth-child(${index + 1})`);
const html = await elem.getHTML(`.weather table.small tr:nth-child(${index + 1})`);
expect(html).to.includes(`<tr style="opacity: ${opacity};">`);
}
});
@ -263,14 +263,14 @@ describe("Weather module", function () {
const weather = generateWeatherForecast();
await setup({ template, data: weather });
await app.client.waitForExist(".weather table.myTableClass", 10000);
await app.client.$(".weather table.myTableClass", 10000);
});
it("should render colored rows", async function () {
const weather = generateWeatherForecast();
await setup({ template, data: weather });
await app.client.waitForExist(".weather table.myTableClass", 10000);
await app.client.$(".weather table.myTableClass", 10000);
const rows = await app.client.$$(".weather table.myTableClass tr.colored");

View File

@ -29,13 +29,13 @@ describe("Display of modules", function () {
});
it("should show the test header", async () => {
await app.client.waitForExist("#module_0_helloworld", 10000);
return app.client.element("#module_0_helloworld .module-header").isVisible().should.eventually.equal(true).getText("#module_0_helloworld .module-header").should.eventually.equal("TEST_HEADER");
const elem = await app.client.$("#module_0_helloworld .module-header", 10000);
return elem.getText("#module_0_helloworld .module-header").should.eventually.equal("TEST_HEADER");
});
it("should show no header if no header text is specified", async () => {
await app.client.waitForExist("#module_1_helloworld", 10000);
return app.client.element("#module_1_helloworld .module-header").isVisible().should.eventually.equal(false);
const elem = await app.client.$("#module_1_helloworld .module-header", 10000);
return elem.getText("#module_1_helloworld .module-header").should.eventually.equal(false);
});
});
});

View File

@ -33,10 +33,9 @@ describe("Position of modules", function () {
position = positions[idx];
className = position.replace("_", ".");
it("show text in " + position, function () {
return app.client
.waitUntilWindowLoaded()
.getText("." + className)
.should.eventually.equal("Text in " + position);
app.client.$("." + className).then((result) => {
return this.getText("." + className).should.eventually.equal("Text in " + position);
});
});
}
});

View File

@ -29,11 +29,13 @@ describe("Check configuration without modules", function () {
process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js";
});
it("Show the message MagicMirror title", function () {
return app.client.waitUntilWindowLoaded().getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2");
it("Show the message MagicMirror title", async function () {
const elem = await app.client.$("#module_1_helloworld .module-content");
return elem.getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2");
});
it("Show the text Michael's website", function () {
return app.client.waitUntilWindowLoaded().getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
it("Show the text Michael's website", async function () {
const elem = await app.client.$("#module_5_helloworld .module-content");
return elem.getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
});
});