@iobroker/legacy-testing 3.0.0 → 3.0.1

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 CHANGED
@@ -23,6 +23,9 @@ The variable is ignored if the admin itself is the adapter under test.
23
23
 
24
24
  <!-- ### **WORK IN PROGRESS** -->
25
25
  ## Changelog
26
+ ### 3.0.1 (2026-08-13)
27
+ - (@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`.
28
+
26
29
  ### 3.0.0 (2026-08-03)
27
30
  - (@GermanBluefox) Added `ADMIN_VERSION` environment variable to install a specific admin version
28
31
  - (@GermanBluefox) Removed `chai`. Use `node:assert` instead
@@ -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
- await gPage.goto(`http://127.0.0.1:8081${pathUrl}`, { waitUntil: 'domcontentloaded' });
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": "3.0.0",
2
+ "version": "3.0.1",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "build/setup.js",
5
5
  "types": "build/setup.d.ts",