@iobroker/legacy-testing 1.0.12 → 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 +4 -1
- package/guiHelper.js +14 -8
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -14,8 +14,11 @@ 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
|
+
|
|
17
20
|
### 1.0.12 (2024-04-27)
|
|
18
|
-
* (bluefox) Allowed setting license into common.licenseInformation.license
|
|
21
|
+
* (bluefox) Allowed setting license into `common.licenseInformation.license`
|
|
19
22
|
|
|
20
23
|
### 1.0.11 (2024-04-14)
|
|
21
24
|
* (bluefox) Added support for the once mode
|
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
|
|
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
|
-
|
|
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.
|
|
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.
|
|
30
|
-
"chai": "^4.
|
|
29
|
+
"mocha": "^10.7.3",
|
|
30
|
+
"chai": "^4.5.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@alcalzone/release-script": "^3.
|
|
33
|
+
"@alcalzone/release-script": "^3.8.0",
|
|
34
34
|
"@alcalzone/release-script-plugin-license": "^3.7.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|