@iobroker/legacy-testing 3.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/build/guiHelper.js +37 -1
- package/package.json +12 -9
package/README.md
CHANGED
|
@@ -23,6 +23,13 @@ The variable is ignored if the admin itself is the adapter under test.
|
|
|
23
23
|
|
|
24
24
|
<!-- ### **WORK IN PROGRESS** -->
|
|
25
25
|
## Changelog
|
|
26
|
+
### 4.0.0 (2026-10-03)
|
|
27
|
+
- (@GermanBluefox) Updated `mocha` to 12.x. The 11.x line pulls in a `serialize-javascript` with a known advisory, and an adapter using this module could not resolve that on its own. Note that `mocha` 12 needs Node.js `^20.19.0 || >=22.12.0`
|
|
28
|
+
- (@GermanBluefox) Breaking change: minimal Node.js version is now 22.19.0.
|
|
29
|
+
|
|
30
|
+
### 3.0.1 (2026-08-13)
|
|
31
|
+
- (@krobipd) `guiHelper.startBrowser`: wait until the admin web server accepts connections before opening the page — on slow CI runners the admin instance reports `alive` before its web server listens, and the single page load failed with `ERR_CONNECTION_REFUSED`.
|
|
32
|
+
|
|
26
33
|
### 3.0.0 (2026-08-03)
|
|
27
34
|
- (@GermanBluefox) Added `ADMIN_VERSION` environment variable to install a specific admin version
|
|
28
35
|
- (@GermanBluefox) Removed `chai`. Use `node:assert` instead
|
package/build/guiHelper.js
CHANGED
|
@@ -16,8 +16,42 @@ exports.screenshot = screenshot;
|
|
|
16
16
|
const puppeteer_1 = __importDefault(require("puppeteer"));
|
|
17
17
|
const colorette_1 = require("colorette");
|
|
18
18
|
const node_fs_1 = require("node:fs");
|
|
19
|
+
const node_http_1 = require("node:http");
|
|
19
20
|
let gBrowser;
|
|
20
21
|
let gPage;
|
|
22
|
+
/**
|
|
23
|
+
* The admin adapter reports "alive" before its web server accepts connections, so on slow
|
|
24
|
+
* machines the first page load can fail with ERR_CONNECTION_REFUSED. Poll the server until
|
|
25
|
+
* it answers (any HTTP status counts as ready). After the timeout the navigation is
|
|
26
|
+
* attempted anyway, so the real error is still reported by the page load itself.
|
|
27
|
+
*/
|
|
28
|
+
function waitForServer(baseUrl, timeoutMs) {
|
|
29
|
+
return new Promise(resolve => {
|
|
30
|
+
const started = Date.now();
|
|
31
|
+
let waitingReported = false;
|
|
32
|
+
const tryOnce = () => {
|
|
33
|
+
const request = (0, node_http_1.get)(baseUrl, response => {
|
|
34
|
+
response.resume();
|
|
35
|
+
resolve();
|
|
36
|
+
});
|
|
37
|
+
request.setTimeout(2000, () => request.destroy(new Error('timeout')));
|
|
38
|
+
request.on('error', () => {
|
|
39
|
+
if (Date.now() - started >= timeoutMs) {
|
|
40
|
+
console.log((0, colorette_1.yellow)(`Web server at ${baseUrl} did not accept connections within ${Math.round(timeoutMs / 1000)} seconds`));
|
|
41
|
+
resolve();
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
if (!waitingReported) {
|
|
45
|
+
waitingReported = true;
|
|
46
|
+
console.log(`Waiting for the web server at ${baseUrl} to accept connections...`);
|
|
47
|
+
}
|
|
48
|
+
setTimeout(tryOnce, 500);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
tryOnce();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
21
55
|
/**
|
|
22
56
|
* This function starts the browser and opens the desired adapter
|
|
23
57
|
*
|
|
@@ -62,7 +96,9 @@ async function startBrowser(adapterName, rootDir, headless, pathUrl) {
|
|
|
62
96
|
if (!pathUrl.startsWith('/')) {
|
|
63
97
|
pathUrl = `/${pathUrl}`;
|
|
64
98
|
}
|
|
65
|
-
|
|
99
|
+
const baseUrl = 'http://127.0.0.1:8081';
|
|
100
|
+
await waitForServer(baseUrl, 30_000);
|
|
101
|
+
await gPage.goto(`${baseUrl}${pathUrl}`, { waitUntil: 'domcontentloaded' });
|
|
66
102
|
// Create directory
|
|
67
103
|
!(0, node_fs_1.existsSync)(`${rootDir}tmp/screenshots`) && (0, node_fs_1.mkdirSync)(`${rootDir}tmp/screenshots`);
|
|
68
104
|
await gPage.screenshot({ path: `${rootDir}tmp/screenshots/00_starting.png` });
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "
|
|
2
|
+
"version": "4.0.0",
|
|
3
3
|
"name": "@iobroker/legacy-testing",
|
|
4
4
|
"main": "build/setup.js",
|
|
5
5
|
"types": "build/setup.d.ts",
|
|
@@ -47,20 +47,23 @@
|
|
|
47
47
|
"email": "dogafox@gmail.com"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"mocha": "^
|
|
50
|
+
"mocha": "^12.0.3"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22.19.0"
|
|
51
54
|
},
|
|
52
55
|
"devDependencies": {
|
|
53
56
|
"@alcalzone/jsonl-db": "^4.0.2",
|
|
54
57
|
"@alcalzone/release-script": "^5.2.1",
|
|
55
58
|
"@alcalzone/release-script-plugin-license": "^5.2.2",
|
|
56
|
-
"@iobroker/db-objects-redis": "^7.2.
|
|
57
|
-
"@iobroker/db-states-redis": "^7.2.
|
|
59
|
+
"@iobroker/db-objects-redis": "^7.2.4",
|
|
60
|
+
"@iobroker/db-states-redis": "^7.2.4",
|
|
58
61
|
"@iobroker/eslint-config": "^2.3.4",
|
|
59
|
-
"@iobroker/types": "^7.2.
|
|
60
|
-
"@tsconfig/
|
|
62
|
+
"@iobroker/types": "^7.2.4",
|
|
63
|
+
"@tsconfig/node22": "^22.0.6",
|
|
61
64
|
"@types/mocha": "^10.0.10",
|
|
62
|
-
"@types/node": "^
|
|
63
|
-
"typescript": "
|
|
65
|
+
"@types/node": "^22.20.5",
|
|
66
|
+
"typescript": "~6.0.3"
|
|
64
67
|
},
|
|
65
68
|
"scripts": {
|
|
66
69
|
"build": "tsc -p tsconfig.build.json",
|
|
@@ -71,6 +74,6 @@
|
|
|
71
74
|
"release-patch": "release-script patch --yes",
|
|
72
75
|
"release-minor": "release-script minor --yes",
|
|
73
76
|
"release-major": "release-script major --yes",
|
|
74
|
-
"update-packages": "
|
|
77
|
+
"update-packages": "npx -y npm-check-updates --upgrade"
|
|
75
78
|
}
|
|
76
79
|
}
|