2022-10-07 19:16:37 +02:00
|
|
|
const helpers = require("../helpers/global-setup");
|
|
|
|
const weatherFunc = require("../helpers/weather-functions");
|
2022-10-04 10:15:24 +02:00
|
|
|
|
|
|
|
describe("Weather module", () => {
|
|
|
|
afterAll(async () => {
|
|
|
|
await helpers.stopApplication();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Current weather", () => {
|
|
|
|
describe("Default configuration", () => {
|
|
|
|
beforeAll(async () => {
|
|
|
|
await weatherFunc.startApp("tests/configs/modules/weather/currentweather_default.js", {});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should render wind speed and wind direction", async () => {
|
2022-10-24 19:41:34 +02:00
|
|
|
await weatherFunc.getText(".weather .normal.medium span:nth-child(2)", "12 WSW");
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should render temperature with icon", async () => {
|
2022-10-24 19:41:34 +02:00
|
|
|
await weatherFunc.getText(".weather .large.light span.bright", "1.5°");
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should render feels like temperature", async () => {
|
2022-10-24 19:41:34 +02:00
|
|
|
await weatherFunc.getText(".weather .normal.medium.feelslike span.dimmed", "Feels like -5.6°");
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Compliments Integration", () => {
|
|
|
|
beforeAll(async () => {
|
|
|
|
await weatherFunc.startApp("tests/configs/modules/weather/currentweather_compliments.js", {});
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should render a compliment based on the current weather", async () => {
|
|
|
|
await weatherFunc.getText(".compliments .module-content span", "snow");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Configuration Options", () => {
|
|
|
|
beforeAll(async () => {
|
|
|
|
await weatherFunc.startApp("tests/configs/modules/weather/currentweather_options.js", {});
|
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render windUnits in beaufort", async () => {
|
|
|
|
await weatherFunc.getText(".weather .normal.medium span:nth-child(2)", "6");
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render windDirection with an arrow", async () => {
|
2023-01-22 11:41:19 +01:00
|
|
|
const elem = await helpers.waitForElement(".weather .normal.medium sup i.fa-long-arrow-alt-down");
|
2022-10-04 10:15:24 +02:00
|
|
|
expect(elem).not.toBe(null);
|
|
|
|
expect(elem.outerHTML).toContain("transform:rotate(250deg);");
|
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render humidity", async () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
await weatherFunc.getText(".weather .normal.medium span:nth-child(3)", "93.7");
|
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render degreeLabel for temp", async () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
await weatherFunc.getText(".weather .large.light span.bright", "1°C");
|
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render degreeLabel for feels like", async () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
await weatherFunc.getText(".weather .normal.medium.feelslike span.dimmed", "Feels like -6°C");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
describe("Current weather with imperial units", () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
beforeAll(async () => {
|
2022-10-24 19:41:34 +02:00
|
|
|
await weatherFunc.startApp("tests/configs/modules/weather/currentweather_units.js", {});
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render wind in imperial units", async () => {
|
|
|
|
await weatherFunc.getText(".weather .normal.medium span:nth-child(2)", "26 WSW");
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render temperatures in fahrenheit", async () => {
|
2022-10-04 10:15:24 +02:00
|
|
|
await weatherFunc.getText(".weather .large.light span.bright", "34,7°");
|
|
|
|
});
|
|
|
|
|
2022-10-24 19:41:34 +02:00
|
|
|
it("should render 'feels like' in fahrenheit", async () => {
|
|
|
|
await weatherFunc.getText(".weather .normal.medium.feelslike span.dimmed", "Feels like 21,9°");
|
2022-10-04 10:15:24 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|