Skip to content

Commit

Permalink
Merge pull request #1927 from fewieden/fix/weather-tests
Browse files Browse the repository at this point in the history
1840 fix weather tests
  • Loading branch information
MichMich authored Feb 12, 2020
2 parents 142d30b + 3dff3a1 commit f67310c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 42 deletions.
28 changes: 15 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
dist: trusty
language: node_js
node_js:
- "10"
- 10
- lts/*
- node
before_install:
- npm i -g npm
before_script:
- yarn danger ci
- npm install grunt-cli -g
- "export DISPLAY=:99.0"
- "export ELECTRON_DISABLE_SANDBOX=1"
- "sh -e /etc/init.d/xvfb start"
- sleep 5
- yarn danger ci
- npm install grunt-cli -g
- "export DISPLAY=:99.0"
- "export ELECTRON_DISABLE_SANDBOX=1"
- "sh -e /etc/init.d/xvfb start"
- sleep 5
script:
- npm run test:e2e
- npm run test:unit
- grunt
- npm run test:e2e
- npm run test:unit
- grunt
after_script:
- npm list
- npm list
cache:
directories:
- node_modules
directories:
- node_modules
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- The `clock` module now optionally displays sun and moon data, including rise/set times, remaining daylight, and percent of moon illumination.
- Added Hebrew translation.
- Add HTTPS support and update config.js.sample
- Run tests on long term support and latest stable version of nodejs
- Added the ability to configure a list of modules that shouldn't be update checked.


### Fixed
- Force declaration of public ip adress in config file (ISSUE #1852)
- Fixes `run-start.sh`: If running in docker-container, don't check the environment, just start electron (ISSUE #1859)
- Fix calendar time offset for recurring events crossing Daylight Savings Time (ISSUE #1798)
- Fix regression in currentweather module causing 'undefined' to show up when config.hideTemp is false
- Fixed weather tests [#1840](https://github.com/MichMich/MagicMirror/issues/1840)

### Updated
- Remove documentation from core repository and link to new dedicated docs site: [docs.magicmirror.builders](https://docs.magicmirror.builders).
Expand Down
45 changes: 19 additions & 26 deletions tests/e2e/modules/weather_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@ const helpers = require("../global-setup");

const {generateWeather, generateWeatherForecast} = require("./mocks");

const wait = () => new Promise(res => setTimeout(res, 3000));

// See issue: https://github.com/MichMich/MagicMirror/issues/1840
// Skipping the weather tests for now since these seem to give issues.
// Please send a PR if you know how to fix these. Thanks!


describe.skip("Weather module", function() {
describe("Weather module", function() {

let app;

Expand Down Expand Up @@ -49,7 +42,7 @@ describe.skip("Weather module", function() {

it("should render wind speed and wind direction", async function() {
const weather = generateWeather();
await setup([weather, template]);
await setup({template, data: weather});

return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "6 WSW", 10000);
});
Expand All @@ -59,7 +52,7 @@ describe.skip("Weather module", function() {
const sunset = moment().startOf("day").unix();

const weather = generateWeather({sys: {sunrise, sunset}});
await setup([weather, template]);
await setup({template, data: weather});

await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunrise", 10000);

Expand All @@ -71,7 +64,7 @@ describe.skip("Weather module", function() {
const sunset = moment().endOf("day").unix();

const weather = generateWeather({sys: {sunrise, sunset}});
await setup([weather, template]);
await setup({template, data: weather});

await app.client.waitForExist(".weather .normal.medium span.wi.dimmed.wi-sunset", 10000);

Expand All @@ -80,7 +73,7 @@ describe.skip("Weather module", function() {

it("should render temperature with icon", async function() {
const weather = generateWeather();
await setup([weather, template]);
await setup({template, data: weather});

await app.client.waitForExist(".weather .large.light span.wi.weathericon.wi-snow", 10000);

Expand All @@ -89,7 +82,7 @@ describe.skip("Weather module", function() {

it("should render feels like temperature", async function() {
const weather = generateWeather();
await setup([weather, template]);
await setup({template, data: weather});

return app.client.waitUntilTextExists(".weather .normal.medium span.dimmed", "Feels like -5.6°", 10000);
});
Expand All @@ -102,14 +95,14 @@ describe.skip("Weather module", function() {

it("should render useBeaufort = false", async function() {
const weather = generateWeather();
await setup([weather, template]);
await setup({template, data: weather});

return app.client.waitUntilTextExists(".weather .normal.medium span:nth-child(2)", "12", 10000);
});

it("should render showWindDirectionAsArrow = true", async function() {
const weather = generateWeather();
await setup([weather, template]);
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");
Expand All @@ -119,15 +112,15 @@ describe.skip("Weather module", function() {

it("should render showHumidity = true", async function() {
const weather = generateWeather();
await setup([weather, template]);
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);
});

it("should render degreeLabel = true", async function() {
const weather = generateWeather();
await setup([weather, template]);
await setup({template, data: weather});

await app.client.waitUntilTextExists(".weather .large.light span.bright", "1°C", 10000);

Expand All @@ -151,7 +144,7 @@ describe.skip("Weather module", function() {
speed: 11.8 * 2.23694
},
});
await setup([weather, template]);
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);
Expand All @@ -169,7 +162,7 @@ describe.skip("Weather module", function() {
speed: 11.8 * 2.23694
},
});
await setup([weather, template]);
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);
Expand All @@ -192,7 +185,7 @@ describe.skip("Weather module", function() {

it("should render days", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

const days = ["Fri", "Sat", "Sun", "Mon", "Tue"];

Expand All @@ -203,7 +196,7 @@ describe.skip("Weather module", function() {

it("should render icons", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

const icons = ["day-cloudy", "rain", "day-sunny", "day-sunny", "day-sunny"];

Expand All @@ -214,7 +207,7 @@ describe.skip("Weather module", function() {

it("should render max temperatures", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

const temperatures = ["24.4°", "21.0°", "22.9°", "23.4°", "20.6°"];

Expand All @@ -225,7 +218,7 @@ describe.skip("Weather module", function() {

it("should render min temperatures", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

const temperatures = ["15.3°", "13.6°", "13.8°", "13.9°", "10.9°"];

Expand All @@ -236,7 +229,7 @@ describe.skip("Weather module", function() {

it("should render fading of rows", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

const opacities = [1, 1, 0.8, 0.5333333333333333, 0.2666666666666667];

Expand All @@ -256,14 +249,14 @@ describe.skip("Weather module", function() {

it("should render custom table class", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

await app.client.waitForExist(".weather table.myTableClass", 10000);
});

it("should render colored rows", async function() {
const weather = generateWeatherForecast();
await setup([weather, template]);
await setup({template, data: weather});

await app.client.waitForExist(".weather table.myTableClass", 10000);

Expand Down
4 changes: 2 additions & 2 deletions tests/node_modules/webdriverajaxstub/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f67310c

Please sign in to comment.