mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-22 03:30:29 +00:00
The weather e2e tests are failing sometimes, failing is not really reproducable. After changing `updateDom(0)` to `updateDom(300)` in `weather.js` it seems to work (we will se if it really works in the long term). This PR contains some other weather e2e changes/cleanups/simplifying.
25 lines
682 B
JavaScript
25 lines
682 B
JavaScript
const { injectMockData, cleanupMockData } = require("../../utils/weather_mocker");
|
|
const helpers = require("./global-setup");
|
|
|
|
exports.getText = async (element, result) => {
|
|
const elem = await helpers.waitForElement(element);
|
|
expect(elem).not.toBeNull();
|
|
expect(
|
|
elem.textContent
|
|
.trim()
|
|
.replace(/(\r\n|\n|\r)/gm, "")
|
|
.replace(/[ ]+/g, " ")
|
|
).toBe(result);
|
|
return true;
|
|
};
|
|
|
|
exports.startApplication = async (configFileName, additionalMockData) => {
|
|
await helpers.startApplication(injectMockData(configFileName, additionalMockData));
|
|
await helpers.getDocument();
|
|
};
|
|
|
|
exports.stopApplication = async () => {
|
|
await helpers.stopApplication();
|
|
cleanupMockData();
|
|
};
|