2023-01-11 21:47:20 +01:00
|
|
|
const { injectMockData } = require("../../utils/weather_mocker");
|
2023-03-22 23:53:10 +01:00
|
|
|
const helpers = require("./global-setup");
|
2022-10-04 10:15:24 +02:00
|
|
|
|
|
|
|
exports.getText = async (element, result) => {
|
|
|
|
const elem = await helpers.waitForElement(element);
|
2023-11-20 20:11:41 +01:00
|
|
|
expect(elem).not.toBeNull();
|
2022-10-04 10:15:24 +02:00
|
|
|
expect(
|
|
|
|
elem.textContent
|
|
|
|
.trim()
|
|
|
|
.replace(/(\r\n|\n|\r)/gm, "")
|
|
|
|
.replace(/[ ]+/g, " ")
|
|
|
|
).toBe(result);
|
2023-11-22 23:37:17 +01:00
|
|
|
return true;
|
2022-10-04 10:15:24 +02:00
|
|
|
};
|
|
|
|
|
2023-01-11 21:47:20 +01:00
|
|
|
exports.startApp = async (configFileName, additionalMockData) => {
|
2023-09-22 14:45:46 +02:00
|
|
|
await helpers.startApplication(injectMockData(configFileName, additionalMockData));
|
2022-10-04 10:15:24 +02:00
|
|
|
await helpers.getDocument();
|
|
|
|
};
|