@iobroker/legacy-testing 1.0.11 → 1.0.13

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
@@ -14,6 +14,12 @@ Set process.env.JS_CONTROLLER_VERSION to version e.g. `5.0.5-alpha.0-20230617-46
14
14
 
15
15
  ## Changelog
16
16
  <!-- ### **WORK IN PROGRESS** -->
17
+ ### 1.0.13 (2024-08-18)
18
+ * (bluefox) Improve the GUI tests
19
+
20
+ ### 1.0.12 (2024-04-27)
21
+ * (bluefox) Allowed setting license into `common.licenseInformation.license`
22
+
17
23
  ### 1.0.11 (2024-04-14)
18
24
  * (bluefox) Added support for the once mode
19
25
 
package/guiHelper.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* This file helps to start and stop the browser and make screenshots of desired adapter
2
- * Do not forget to include into package.json:
2
+ * Do not forget to include in package.json:
3
3
  * "devDependencies": {
4
4
  * "puppeteer": "^21.4.1",
5
5
  * "colorette": "^1.2.1"
@@ -7,7 +7,7 @@
7
7
  **/
8
8
  const puppeteer = require('puppeteer');
9
9
  const { blue, cyan, red, yellow } = require('colorette');
10
- const fs = require('fs');
10
+ const fs = require('node:fs');
11
11
 
12
12
  let gBrowser;
13
13
  let gPage;
@@ -16,15 +16,16 @@ let gPage;
16
16
  * @param {string} adapterName - could be just an adapter name or adapter name with path, like 'device-manager/tab_m.html'
17
17
  * @param {string} rootDir
18
18
  * @param {boolean} headless
19
+ * @param {pathUrl} string
19
20
  */
20
- async function startBrowser(adapterName, rootDir, headless) {
21
+ async function startBrowser(adapterName, rootDir, headless, pathUrl) {
21
22
  if (!rootDir.endsWith('/')) {
22
23
  rootDir += '/';
23
24
  }
24
25
 
25
26
  const browser = await puppeteer.launch({
26
27
  headless: headless === undefined ? false : headless,
27
- args: ['--no-sandbox', '--disable-setuid-sandbox']
28
+ args: ['--no-sandbox', '--disable-setuid-sandbox'],
28
29
  });
29
30
  const pages = await browser.pages();
30
31
  const timeout = 5000;
@@ -33,7 +34,7 @@ async function startBrowser(adapterName, rootDir, headless) {
33
34
  await pages[0].setViewport( {
34
35
  width: 1920,
35
36
  height: 1080,
36
- deviceScaleFactor: 1
37
+ deviceScaleFactor: 1,
37
38
  });
38
39
 
39
40
  gBrowser = browser;
@@ -47,7 +48,7 @@ async function startBrowser(adapterName, rootDir, headless) {
47
48
  LOG: text => text,
48
49
  ERR: red,
49
50
  WAR: yellow,
50
- INF: cyan
51
+ INF: cyan,
51
52
  };
52
53
 
53
54
  const color = colors[type] || blue;
@@ -55,7 +56,12 @@ async function startBrowser(adapterName, rootDir, headless) {
55
56
  })
56
57
  .on('pageerror', ({ message }) => console.log(red(`[BROWSER] ${message}`)));
57
58
 
58
- await gPage.goto(`http://127.0.0.1:8081/adapter/${adapterName.includes('/') ? (!adapterName.includes('?') ? `${adapterName}?` : adapterName) : `${adapterName}/index_m.html?`}&newReact=true&0&react=dark`, { waitUntil: 'domcontentloaded' });
59
+ pathUrl = pathUrl || `/adapter/${adapterName.includes('/') ? (!adapterName.includes('?') ? `${adapterName}?` : adapterName) : `${adapterName}/index_m.html?`}&newReact=true&0&react=dark`;
60
+ if (!pathUrl.startsWith('/')) {
61
+ pathUrl = `/${pathUrl}`;
62
+ }
63
+
64
+ await gPage.goto(`http://127.0.0.1:8081${pathUrl}`, { waitUntil: 'domcontentloaded' });
59
65
 
60
66
  // Create directory
61
67
  !fs.existsSync(`${rootDir}tmp/screenshots`) && fs.mkdirSync(`${rootDir}tmp/screenshots`);
@@ -80,5 +86,5 @@ async function screenshot(rootDir, page, fileName) {
80
86
  module.exports = {
81
87
  startBrowser,
82
88
  stopBrowser,
83
- screenshot
89
+ screenshot,
84
90
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.11",
2
+ "version": "1.0.13",
3
3
  "name": "@iobroker/legacy-testing",
4
4
  "main": "setup.js",
5
5
  "files": [
@@ -26,11 +26,11 @@
26
26
  "email": "dogafox@gmail.com"
27
27
  },
28
28
  "dependencies": {
29
- "mocha": "^10.4.0",
30
- "chai": "^4.4.1"
29
+ "mocha": "^10.7.3",
30
+ "chai": "^4.5.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@alcalzone/release-script": "^3.7.0",
33
+ "@alcalzone/release-script": "^3.8.0",
34
34
  "@alcalzone/release-script-plugin-license": "^3.7.0"
35
35
  },
36
36
  "scripts": {
@@ -37,7 +37,7 @@ describe('Test package.json and io-package.json', () => {
37
37
  expect(npmPackage.author, 'ERROR: Author in package.json needs to exist').to.exist;
38
38
  expect(ioPackage.common.authors, 'ERROR: Authors in io-package.json needs to exist').to.exist;
39
39
 
40
- expect(ioPackage.common.license, 'ERROR: License missing in io-package in common.license').to.exist;
40
+ expect(ioPackage.common.license || ioPackage.common.licenseInformation?.license, 'ERROR: License missing in io-package in common.license or in common.licenseInformation.license').to.exist;
41
41
 
42
42
  if (ioPackage.common.name.includes('template')) {
43
43
  if (Array.isArray(ioPackage.common.authors)) {