388 Commits

Author SHA1 Message Date
Veeck
6e80e5a295
Add option to show hourly forecast in increments (#2998)
Adds new config option to show weather forecast for every X hour
(default value is 1 which reflects the current behaviour)
Also adds tests for hourly forecast
Fixes #2996

Co-authored-by: veeck <michael@veeck.de>
2023-01-10 18:55:07 +01:00
Karsten Hassel
76d9042e60
update playwright to v1.29.1 and other dependencies (#2980)
see title, fixes https://github.com/MichMich/MagicMirror/issues/2969
2022-12-22 16:40:53 +01:00
Karsten Hassel
2fec314ff5
improve electron tests (avoid errors in github workflows) (#2977)
Fix electron tests failing sometimes in github workflow.
2022-12-12 21:43:22 +01:00
Kristjan ESPERANTO
3124b0a9c5
Replace &hellip; with (#2973)
I think it is clearer if we don't use the HTML entity.

Co-authored-by: Karsten Hassel <hassel@gmx.de>
2022-12-10 21:50:56 +01:00
Veeck
a2624442cc
Cleanup compliments module (#2965)
Lots of small fixes and cleanups:
- only render something when there is a compliment
- cleanup naming
- use es6 notations
- use fetch instead of XMLHttpRequest in compliments

Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
2022-12-10 21:23:00 +01:00
Magnus
bd0b3c00ad
New weather provider: Yr.no (#2948)
# Added Yr.no as a weather provider

Yr.no is a free Norwegian weather service. The configuration is quite
simple:
```js
{
    weatherProvider: "yr",
    lat: 59.9171,
    lon: 10.7276,
    altitude: 30
}
```
The latitude and longitude cannot have more than 4 decimals, but that
should be plenty. To quote yr: "There is no need to ask for weather
forecasts with nanometer precision!". The altitude should be meters
above sea level and defaults to 0. If `type` is set to `current` the
symbol can display the next 1, 6 or 12 hours by setting
`currentForecastHours` (default is 1).

It states in [Getting
started-guide](https://developer.yr.no/doc/GettingStarted/) that users
of the API should cache the results and use the `Expires`-header to know
when to ask for new data. By using the `If-Modified-Since`-header we can
avoid downloading the same data over and over again. I chose not to
override the `User-Agent`-header set in
[`server.js`](https://github.com/MichMich/MagicMirror/blob/a328ce5/js/server.js#L97)
even though it does not comply with [the terms of
service](https://developer.yr.no/doc/TermsOfService/). It currently
works with the default header, and by searching the web for MagicMirror
the GitHub-repo should be easy to find without an explicit link.

I also had to make some minor changes to `server.js` and
`weatherprovider.js` to be able to send and return HTTP headers. To
handle the HTTP 304 response without body I chose to return `undefined`
so we easily can use the response as a condition: `if (response) ...`.

The documentation for the API is available here:
- [API Reference overview](https://api.met.no/weatherapi/)
-
[Locationforecast](https://api.met.no/weatherapi/locationforecast/2.0/)
- Used to get the weather forecast
- [Sunrise](https://api.met.no/weatherapi/sunrise/2.0/documentation) -
used to find sunrise and sunset times

Co-authored-by: Veeck <github@veeck.de>
2022-11-08 06:18:47 +01:00
Magnus
4d47c0837f
Support HTTP headers with CORS-method (#2957)
Adds support for sending and receiving HTTP-headers when using the
CORS-method.

This change is required for the Yr weather-provider introduced in
https://github.com/MichMich/MagicMirror/pull/2948.

To make it easier to add unit tests I moved the server-functions into a
separate file.
2022-10-30 18:14:02 +01:00
Veeck
3879949f58
Switch back to third party fetch lib for all node versions (#2961)
As discussed in https://github.com/MichMich/MagicMirror/pull/2952

Co-authored-by: veeck <michael@veeck.de>
2022-10-29 23:10:25 +02:00
buxxi
f25abfd2f8
Make the e2e tests wait for the app to start and close before running next test (#2952)
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.
2022-10-29 22:34:17 +02:00
Veeck
f79d3f007d
Cleanup jest config (#2959)
Some small cleanups with regards to jest
- call jest directly (nyc is integrated in jest these days)
- move jest config into seperate file so we dont clutter up the
package.json
- remove empty test file for newsletter-unit-tests
- update dependencies that touch jest
- try out v8 as coverageProvider

Co-authored-by: veeck <michael@veeck.de>
2022-10-28 20:57:08 +02:00
Veeck
c191ff0032
Refactor common weather methods into utils class (#2958)
Co-authored-by: veeck <michael@veeck.de>
2022-10-28 19:56:55 +02:00
Veeck
2d3940a4ff
Use metric units internally in all weatherproviders (#2849)
So finally I think this refactorin is ready to be reviewed :-)

DONE:
- [x] Removed all conversion functions for wind and temperature from
specific weatherproviders
- [x] Use internally only metric units: celsius for temperature, meters
per seconds for wind
- [x] Convert temp and wind into the configured units when displaying
data on the UI
- [x] look how beaufort calculation uses metrics, added knots as new
windunit
- [x] add more e2e tests 

Checked providers:
- [x] Darksky
- [x] EnvCanada
- [x] OpenWeatherMap
- [x] SMHI provider 
- [x] UK Met Office
- [x] UK Met Office DataHub
- [x] WeatherBit
- [x] WeatherFlow
- [x] WeatherGov

TODO in different tickets:
- check weatherproviders for usage of weatherEndpoint (as seen in
https://github.com/MichMich/MagicMirror-Documentation/issues/131) -> see
#2926
- cleanup precipations -> #2953

Co-authored-by: veeck <michael@veeck.de>
2022-10-24 19:41:34 +02:00
Karsten Hassel
ad4dbd786a
added new electron tests supporting date mocking (#2947)
first PR for #2942 

- added new electron tests for calendar which test new css classes from
https://github.com/MichMich/MagicMirror/pull/2939
- moved some compliments tests from `e2e` to `electron` because of date
mocking
- removed mock stuff from compliments module
2022-10-17 07:20:23 +02:00
Veeck
a328ce537f
Cleanup test directory (#2937)
Moves files around and renames some so that the structure is cleaner and
more consistent
2022-10-07 12:16:37 -05:00
Veeck
ce4906d13b
Add test in compliments module for remotFile option (#2932)
nothing fancy here, just a simple test after @khassel's changes to the
test setup :-)

Co-authored-by: veeck <michael@veeck.de>
2022-10-04 14:26:31 +02:00
Karsten Hassel
f04d578704
improve tests (#2923)
use es6 syntax in all tests, split weather tests, remove callbacks
2022-10-04 10:15:24 +02:00
Karsten Hassel
0c1abad9df fix calendar_test_recurring.ics and uncomment recurring tests 2022-09-21 21:01:43 +02:00
Karsten Hassel
fb96cc3c72 fix e2e tests not failing on errors, disable recurring-event-tests of calendar 2022-09-21 00:28:43 +02:00
Karsten Hassel
4cc3e481cc update dependencies, revert electron to v19 2022-09-05 23:26:04 +02:00
Mike Bishop
0c1e5ea881 Use German as the base for tests 2022-07-25 18:23:27 -04:00
Karsten Hassel
ae72ed8c67 improve startApplication 2022-05-27 21:49:29 +02:00
Karsten Hassel
0023c64d59 use internal fetch function of node instead external node-fetch library if node version >= v18 2022-05-27 19:46:28 +02:00
Kristjan SCHMIDT
6f27e5ae07 MagicMirror -> MagicMirror² 2022-01-26 23:47:51 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Karsten Hassel
c392b5a661 Merge branch 'develop' into remove-old-weather-modules
# Conflicts:
#	modules/default/currentweather/currentweather.js
2022-01-14 22:07:21 +01:00
Karsten Hassel
82bb2544de add CHANGELOG and fix weather_spec 2022-01-13 22:46:10 +01:00
Karsten Hassel
c1be0180f9 change weather_spec 2022-01-13 22:33:57 +01:00
Karsten Hassel
2cfafe7bfe improve waitForElement 2022-01-13 21:52:47 +01:00
Karsten Hassel
42b80b18f8 testing wait alternatives 2022-01-13 00:50:15 +01:00
Christopher Fenner
9e4997aa81
Merge branch 'develop' into patch-1 2022-01-12 20:39:09 +01:00
Karsten Hassel
8cb6015930 refactor tests 2022-01-10 23:27:53 +01:00
Christopher Fenner
8417590893
update test case 2022-01-09 11:10:00 +01:00
Karsten Hassel
eb32ec89b4 remove old weather modules 2022-01-08 23:08:41 +01:00
Karsten Hassel
cd1fe4e182 weather test for new absolute property 2022-01-07 21:38:56 +01:00
CFenner
c56b601ab8
adjust test case 2022-01-06 21:49:21 +01:00
Karsten Hassel
5d8f2f5da1 iterate over timezones 2021-12-26 16:27:40 +01:00
Karsten Hassel
a954a62762 added test for calendar recurring event with checks the correct date displayed (related to #2752) 2021-12-26 14:30:38 +01:00
Karsten Hassel
9b83862a96 fixed electron tests with retry, update dependencies 2021-12-22 22:31:39 +01:00
rejas
f54c06fb94 Add test for old items 2021-12-20 13:35:50 +01:00
Karsten Hassel
4a7f498683 replace spectron with playwright, rewrite electron tests 2021-11-27 23:00:02 +01:00
Karsten Hassel
b1a46b365b increase load delay for modules tests 2021-10-22 22:49:10 +02:00
Karsten Hassel
1acbef5bfa increase testTimeout, minor changes tests e2e 2021-10-20 21:05:19 +02:00
Karsten Hassel
0fb9e0bc89 increase test delay for alert module test 2021-10-16 00:25:31 +02:00
Karsten Hassel
0ec80a7791 move weather-test to e2e 2021-10-16 00:05:12 +02:00
Michael Teeuw
5bfbd3eaa0
Merge branch 'develop' into clean-up-updatenotifications-and-nunjuck-templating 2021-10-06 15:21:54 +02:00
Karsten Hassel
1d12e57606 move calendar tests from category electron to e2e 2021-10-04 23:04:28 +02:00
Felix Wiedenbach
1751cabb9d remove obsolete snapshot 2021-10-02 14:56:13 +02:00
Felix Wiedenbach
fc06f13c30 Merge branch 'develop' into clean-up-updatenotifications-and-nunjuck-templating
# Conflicts:
#	CHANGELOG.md
2021-10-02 14:15:54 +02:00
Felix Wiedenbach
b094707324 remove mocking from implementation and use jest to mock git cli instead 2021-10-02 14:08:16 +02:00
Karsten Hassel
b3bddb2c99 fix without_modules.js 2021-09-29 22:01:35 +02:00