html-reporter 9.10.2 → 9.11.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/build/hermione.js +2 -2
- package/build/hermione.js.map +1 -1
- package/build/lib/cli-commands/gui.js +2 -1
- package/build/lib/cli-commands/gui.js.map +1 -1
- package/build/lib/cli-commands/index.d.ts +5 -3
- package/build/lib/cli-commands/index.js +4 -2
- package/build/lib/cli-commands/index.js.map +1 -1
- package/build/lib/cli-commands/merge-reports.js +2 -1
- package/build/lib/cli-commands/merge-reports.js.map +1 -1
- package/build/lib/cli-commands/remove-unused-screens/index.js +2 -1
- package/build/lib/cli-commands/remove-unused-screens/index.js.map +1 -1
- package/build/lib/common-utils.d.ts +9 -8
- package/build/lib/common-utils.js +11 -11
- package/build/lib/common-utils.js.map +1 -1
- package/build/lib/config/custom-gui-asserts.d.ts +1 -1
- package/build/lib/config/custom-gui-asserts.js +28 -22
- package/build/lib/config/custom-gui-asserts.js.map +1 -1
- package/build/lib/config/index.d.ts +2 -21
- package/build/lib/config/index.js +84 -80
- package/build/lib/config/index.js.map +1 -1
- package/build/lib/constants/browser.d.ts +2 -2
- package/build/lib/constants/browser.js +6 -3
- package/build/lib/constants/browser.js.map +1 -1
- package/build/lib/constants/database.d.ts +32 -25
- package/build/lib/constants/database.js +29 -30
- package/build/lib/constants/database.js.map +1 -1
- package/build/lib/constants/defaults.d.ts +3 -18
- package/build/lib/constants/defaults.js +25 -21
- package/build/lib/constants/defaults.js.map +1 -1
- package/build/lib/constants/diff-modes.d.ts +41 -53
- package/build/lib/constants/diff-modes.js +3 -1
- package/build/lib/constants/diff-modes.js.map +1 -1
- package/build/lib/constants/index.d.ts +9 -0
- package/build/lib/constants/index.js +26 -0
- package/build/lib/constants/index.js.map +1 -0
- package/build/lib/constants/paths.d.ts +2 -2
- package/build/lib/constants/paths.js +5 -5
- package/build/lib/constants/paths.js.map +1 -1
- package/build/lib/constants/plugin-events.d.ts +5 -5
- package/build/lib/constants/plugin-events.js +9 -9
- package/build/lib/constants/plugin-events.js.map +1 -1
- package/build/lib/constants/save-formats.d.ts +3 -1
- package/build/lib/constants/save-formats.js +7 -4
- package/build/lib/constants/save-formats.js.map +1 -1
- package/build/lib/constants/test-statuses.d.ts +18 -8
- package/build/lib/constants/test-statuses.js +22 -11
- package/build/lib/constants/test-statuses.js.map +1 -1
- package/build/lib/constants/view-modes.d.ts +7 -5
- package/build/lib/constants/view-modes.js +11 -8
- package/build/lib/constants/view-modes.js.map +1 -1
- package/build/lib/db-utils/client.d.ts +6 -19
- package/build/lib/db-utils/client.js +1 -0
- package/build/lib/db-utils/client.js.map +1 -1
- package/build/lib/db-utils/common.d.ts +28 -10
- package/build/lib/db-utils/common.js +29 -20
- package/build/lib/db-utils/common.js.map +1 -1
- package/build/lib/db-utils/server.d.ts +6 -16
- package/build/lib/db-utils/server.js +73 -44
- package/build/lib/db-utils/server.js.map +1 -1
- package/build/lib/errors/db-not-initialized-error.d.ts +3 -0
- package/build/lib/errors/db-not-initialized-error.js +10 -0
- package/build/lib/errors/db-not-initialized-error.js.map +1 -0
- package/build/lib/gui/app.d.ts +32 -30
- package/build/lib/gui/index.js +26 -2
- package/build/lib/gui/index.js.map +1 -1
- package/build/lib/gui/tool-runner/index.d.ts +46 -60
- package/build/lib/gui/tool-runner/report-subscriber.js +2 -2
- package/build/lib/gui/tool-runner/report-subscriber.js.map +1 -1
- package/build/lib/local-images-saver.d.ts +2 -4
- package/build/lib/local-images-saver.js +6 -4
- package/build/lib/local-images-saver.js.map +1 -1
- package/build/lib/plugin-adapter.d.ts +14 -29
- package/build/lib/plugin-adapter.js +44 -15
- package/build/lib/plugin-adapter.js.map +1 -1
- package/build/lib/plugin-api.d.ts +31 -55
- package/build/lib/plugin-api.js +20 -12
- package/build/lib/plugin-api.js.map +1 -1
- package/build/lib/plugin-utils.d.ts +2 -3
- package/build/lib/plugin-utils.js +7 -4
- package/build/lib/plugin-utils.js.map +1 -1
- package/build/lib/report-builder/gui.d.ts +49 -34
- package/build/lib/report-builder/gui.js +1 -1
- package/build/lib/report-builder/gui.js.map +1 -1
- package/build/lib/report-builder/static.d.ts +31 -28
- package/build/lib/report-builder/static.js +47 -42
- package/build/lib/report-builder/static.js.map +1 -1
- package/build/lib/reporter-helpers.d.ts +2 -2
- package/build/lib/reporter-helpers.js +4 -4
- package/build/lib/reporter-helpers.js.map +1 -1
- package/build/lib/server-utils.d.ts +57 -40
- package/build/lib/server-utils.js +100 -102
- package/build/lib/server-utils.js.map +1 -1
- package/build/lib/sqlite-adapter.d.ts +66 -76
- package/build/lib/sqlite-adapter.js +59 -58
- package/build/lib/sqlite-adapter.js.map +1 -1
- package/build/lib/static/gui.min.css +1 -1
- package/build/lib/static/gui.min.js +16 -16
- package/build/lib/static/modules/utils.js +5 -5
- package/build/lib/static/modules/utils.js.map +1 -1
- package/build/lib/static/report.min.css +1 -1
- package/build/lib/static/report.min.js +16 -16
- package/build/lib/suite-adapter.d.ts +14 -13
- package/build/lib/suite-adapter.js +24 -19
- package/build/lib/suite-adapter.js.map +1 -1
- package/build/lib/test-adapter.d.ts +75 -109
- package/build/lib/test-adapter.js +105 -69
- package/build/lib/test-adapter.js.map +1 -1
- package/build/lib/tests-tree-builder/base.d.ts +81 -64
- package/build/lib/tests-tree-builder/base.js +22 -16
- package/build/lib/tests-tree-builder/base.js.map +1 -1
- package/build/lib/tests-tree-builder/gui.d.ts +35 -13
- package/build/lib/tests-tree-builder/gui.js +1 -1
- package/build/lib/tests-tree-builder/gui.js.map +1 -1
- package/build/lib/tests-tree-builder/static.d.ts +45 -51
- package/build/lib/tests-tree-builder/static.js +33 -30
- package/build/lib/tests-tree-builder/static.js.map +1 -1
- package/build/lib/types.d.ts +195 -0
- package/build/lib/types.js +3 -0
- package/build/lib/types.js.map +1 -0
- package/build/lib/workers/create-workers.d.ts +14 -2
- package/build/lib/workers/create-workers.js +5 -2
- package/build/lib/workers/create-workers.js.map +1 -1
- package/build/lib/workers/worker.d.ts +2 -1
- package/build/lib/workers/worker.js +11 -11
- package/build/lib/workers/worker.js.map +1 -1
- package/build/package.json +11 -4
- package/package.json +11 -4
|
@@ -1,75 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mapPlugins = exports.forEachPlugin = exports.isUnexpectedPlugin = exports.getPluginMiddleware = exports.getPluginClientScriptPath = exports.runCustomGuiAction = exports.initializeCustomGui = exports.getDataForStaticFile = exports.getConfigForStaticFile = exports.copyToReportDir = exports.writeDatabaseUrlsFile = exports.urlPathNameEndsWith = exports.copyPlugin = exports.copyPlugins = exports.saveStaticFilesToReportDir = exports.getDetailsFileName = exports.shouldUpdateAttempt = exports.prepareCommonJSData = exports.hasImage = exports.logError = exports.logPathToHtmlReport = exports.fileExists = exports.makeDirFor = exports.deleteFile = exports.copyFileAsync = exports.createPath = exports.getDiffAbsolutePath = exports.getCurrentAbsolutePath = exports.getReferenceAbsolutePath = exports.getDiffPath = exports.getCurrentPath = exports.getReferencePath = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const url_1 = __importDefault(require("url"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
10
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
11
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
12
|
+
const common_utils_1 = require("./common-utils");
|
|
13
|
+
const constants_1 = require("./constants");
|
|
10
14
|
const DATA_FILE_NAME = 'data.js';
|
|
11
15
|
const getReferencePath = (testResult, stateName) => createPath('ref', testResult, stateName);
|
|
16
|
+
exports.getReferencePath = getReferencePath;
|
|
12
17
|
const getCurrentPath = (testResult, stateName) => createPath('current', testResult, stateName);
|
|
18
|
+
exports.getCurrentPath = getCurrentPath;
|
|
13
19
|
const getDiffPath = (testResult, stateName) => createPath('diff', testResult, stateName);
|
|
20
|
+
exports.getDiffPath = getDiffPath;
|
|
14
21
|
const getReferenceAbsolutePath = (testResult, reportDir, stateName) => {
|
|
15
|
-
const referenceImagePath = getReferencePath(testResult, stateName);
|
|
16
|
-
return
|
|
22
|
+
const referenceImagePath = (0, exports.getReferencePath)(testResult, stateName);
|
|
23
|
+
return path_1.default.resolve(reportDir, referenceImagePath);
|
|
17
24
|
};
|
|
25
|
+
exports.getReferenceAbsolutePath = getReferenceAbsolutePath;
|
|
18
26
|
const getCurrentAbsolutePath = (testResult, reportDir, stateName) => {
|
|
19
|
-
const currentImagePath = getCurrentPath(testResult, stateName);
|
|
20
|
-
return
|
|
27
|
+
const currentImagePath = (0, exports.getCurrentPath)(testResult, stateName);
|
|
28
|
+
return path_1.default.resolve(reportDir, currentImagePath);
|
|
21
29
|
};
|
|
30
|
+
exports.getCurrentAbsolutePath = getCurrentAbsolutePath;
|
|
22
31
|
const getDiffAbsolutePath = (testResult, reportDir, stateName) => {
|
|
23
|
-
const diffImagePath = getDiffPath(testResult, stateName);
|
|
24
|
-
return
|
|
32
|
+
const diffImagePath = (0, exports.getDiffPath)(testResult, stateName);
|
|
33
|
+
return path_1.default.resolve(reportDir, diffImagePath);
|
|
25
34
|
};
|
|
35
|
+
exports.getDiffAbsolutePath = getDiffAbsolutePath;
|
|
26
36
|
/**
|
|
27
37
|
* @param {String} kind - одно из значений 'ref', 'current', 'diff'
|
|
28
|
-
* @param {
|
|
38
|
+
* @param {TestAdapter} result
|
|
29
39
|
* @param {String} stateName - имя стэйта для теста
|
|
30
40
|
* @returns {String}
|
|
31
41
|
*/
|
|
32
42
|
function createPath(kind, result, stateName) {
|
|
33
43
|
const attempt = result.attempt || 0;
|
|
34
|
-
const imageDir =
|
|
44
|
+
const imageDir = lodash_1.default.compact([constants_1.IMAGES_PATH, result.imageDir, stateName]);
|
|
35
45
|
const components = imageDir.concat(`${result.browserId}~${kind}_${attempt}.png`);
|
|
36
|
-
return
|
|
46
|
+
return path_1.default.join(...components);
|
|
37
47
|
}
|
|
48
|
+
exports.createPath = createPath;
|
|
38
49
|
function copyFileAsync(srcPath, destPath, { reportDir = '', overwrite = true } = {}) {
|
|
39
|
-
const resolvedDestPath =
|
|
40
|
-
return makeDirFor(resolvedDestPath).then(() =>
|
|
50
|
+
const resolvedDestPath = path_1.default.resolve(reportDir, destPath);
|
|
51
|
+
return makeDirFor(resolvedDestPath).then(() => fs_extra_1.default.copy(srcPath, resolvedDestPath, { overwrite }));
|
|
41
52
|
}
|
|
42
|
-
|
|
43
|
-
* @param {String} filePath
|
|
44
|
-
* @returns {Promise}
|
|
45
|
-
*/
|
|
53
|
+
exports.copyFileAsync = copyFileAsync;
|
|
46
54
|
function deleteFile(filePath) {
|
|
47
|
-
return
|
|
55
|
+
return fs_extra_1.default.remove(filePath);
|
|
48
56
|
}
|
|
49
|
-
|
|
50
|
-
* @param {String} destPath
|
|
51
|
-
*/
|
|
57
|
+
exports.deleteFile = deleteFile;
|
|
52
58
|
function makeDirFor(destPath) {
|
|
53
|
-
return
|
|
59
|
+
return fs_extra_1.default.mkdirs(path_1.default.dirname(destPath));
|
|
54
60
|
}
|
|
61
|
+
exports.makeDirFor = makeDirFor;
|
|
55
62
|
function fileExists(path) {
|
|
56
|
-
return
|
|
63
|
+
return fs_extra_1.default.existsSync(path);
|
|
57
64
|
}
|
|
65
|
+
exports.fileExists = fileExists;
|
|
58
66
|
function logPathToHtmlReport(pluginConfig) {
|
|
59
|
-
const reportPath = `file://${
|
|
60
|
-
logger.log(`Your HTML report is here: ${
|
|
61
|
-
logger.log(`To open it use: ${
|
|
67
|
+
const reportPath = `file://${path_1.default.resolve(pluginConfig.path, 'index.html')}`;
|
|
68
|
+
common_utils_1.logger.log(`Your HTML report is here: ${chalk_1.default.yellow(reportPath)}`);
|
|
69
|
+
common_utils_1.logger.log(`To open it use: ${chalk_1.default.yellow('npx hermione gui')} or ${chalk_1.default.yellow(`npx http-server ${pluginConfig.path}`)}`);
|
|
62
70
|
}
|
|
71
|
+
exports.logPathToHtmlReport = logPathToHtmlReport;
|
|
63
72
|
function logError(e) {
|
|
64
|
-
logger.error(`Html-reporter runtime error: ${e.stack}`);
|
|
73
|
+
common_utils_1.logger.error(`Html-reporter runtime error: ${e.stack}`);
|
|
65
74
|
}
|
|
75
|
+
exports.logError = logError;
|
|
66
76
|
function hasImage(formattedResult) {
|
|
67
|
-
return !!formattedResult.getImagesInfo(
|
|
68
|
-
!!formattedResult.getCurrImg()
|
|
77
|
+
return !!formattedResult.getImagesInfo().length ||
|
|
78
|
+
!!formattedResult.getCurrImg()?.path ||
|
|
69
79
|
!!formattedResult.screenshot;
|
|
70
80
|
}
|
|
81
|
+
exports.hasImage = hasImage;
|
|
71
82
|
function prepareCommonJSData(data) {
|
|
72
|
-
const stringifiedData = JSON.stringify(data, (
|
|
83
|
+
const stringifiedData = JSON.stringify(data, (_key, val) => {
|
|
73
84
|
return typeof val === 'function' ? val.toString() : val;
|
|
74
85
|
});
|
|
75
86
|
return [
|
|
@@ -77,55 +88,61 @@ function prepareCommonJSData(data) {
|
|
|
77
88
|
'try { module.exports = data; } catch(e) {}'
|
|
78
89
|
].join('\n');
|
|
79
90
|
}
|
|
91
|
+
exports.prepareCommonJSData = prepareCommonJSData;
|
|
80
92
|
function shouldUpdateAttempt(status) {
|
|
81
|
-
return ![SKIPPED, UPDATED, RUNNING, IDLE].includes(status);
|
|
93
|
+
return ![constants_1.SKIPPED, constants_1.UPDATED, constants_1.RUNNING, constants_1.IDLE].includes(status);
|
|
82
94
|
}
|
|
95
|
+
exports.shouldUpdateAttempt = shouldUpdateAttempt;
|
|
83
96
|
function getDetailsFileName(testId, browserId, attempt) {
|
|
84
97
|
return `${testId}-${browserId}_${Number(attempt) + 1}_${Date.now()}.json`;
|
|
85
98
|
}
|
|
99
|
+
exports.getDetailsFileName = getDetailsFileName;
|
|
86
100
|
async function saveStaticFilesToReportDir(hermione, pluginConfig, destPath) {
|
|
87
|
-
const staticFolder =
|
|
88
|
-
await
|
|
101
|
+
const staticFolder = path_1.default.resolve(__dirname, './static');
|
|
102
|
+
await fs_extra_1.default.ensureDir(destPath);
|
|
89
103
|
await Promise.all([
|
|
90
|
-
|
|
104
|
+
fs_extra_1.default.writeFile(path_1.default.resolve(destPath, DATA_FILE_NAME), prepareCommonJSData(getDataForStaticFile(hermione, pluginConfig)), 'utf8'),
|
|
91
105
|
copyToReportDir(destPath, ['report.min.js', 'report.min.css'], staticFolder),
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
fs.copy(require.resolve('@gemini-testing/sql.js'), path.resolve(destPath, 'sql-wasm.js')),
|
|
106
|
+
fs_extra_1.default.copy(path_1.default.resolve(staticFolder, 'index.html'), path_1.default.resolve(destPath, 'index.html')),
|
|
107
|
+
fs_extra_1.default.copy(path_1.default.resolve(staticFolder, 'icons'), path_1.default.resolve(destPath, 'icons')),
|
|
108
|
+
fs_extra_1.default.copy(require.resolve('@gemini-testing/sql.js'), path_1.default.resolve(destPath, 'sql-wasm.js')),
|
|
96
109
|
copyPlugins(pluginConfig, destPath)
|
|
97
110
|
]);
|
|
98
111
|
}
|
|
112
|
+
exports.saveStaticFilesToReportDir = saveStaticFilesToReportDir;
|
|
99
113
|
async function copyPlugins({ plugins, pluginsEnabled }, destPath) {
|
|
100
|
-
if (!pluginsEnabled || !plugins
|
|
114
|
+
if (!pluginsEnabled || !plugins?.length) {
|
|
101
115
|
return;
|
|
102
116
|
}
|
|
103
117
|
try {
|
|
104
|
-
const pluginsPath =
|
|
105
|
-
await
|
|
118
|
+
const pluginsPath = path_1.default.resolve(destPath, 'plugins');
|
|
119
|
+
await fs_extra_1.default.ensureDir(pluginsPath);
|
|
106
120
|
await Promise.all(mapPlugins(plugins, pluginName => copyPlugin(pluginName, pluginsPath)));
|
|
107
121
|
}
|
|
108
|
-
catch (e) {
|
|
122
|
+
catch (e) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
109
123
|
logError(e);
|
|
110
124
|
}
|
|
111
125
|
}
|
|
126
|
+
exports.copyPlugins = copyPlugins;
|
|
112
127
|
async function copyPlugin(pluginName, pluginsPath) {
|
|
113
128
|
const pluginPath = getPluginClientScriptPath(pluginName);
|
|
114
129
|
if (!pluginPath) {
|
|
115
130
|
return;
|
|
116
131
|
}
|
|
117
|
-
const destPluginPath =
|
|
118
|
-
await
|
|
119
|
-
await
|
|
132
|
+
const destPluginPath = path_1.default.resolve(pluginsPath, pluginName, 'plugin.js');
|
|
133
|
+
await fs_extra_1.default.ensureDir(path_1.default.dirname(destPluginPath));
|
|
134
|
+
await fs_extra_1.default.copy(pluginPath, destPluginPath);
|
|
120
135
|
}
|
|
136
|
+
exports.copyPlugin = copyPlugin;
|
|
121
137
|
function urlPathNameEndsWith(currentUrl, searchString) {
|
|
122
138
|
try {
|
|
123
|
-
return
|
|
139
|
+
return url_1.default.parse(currentUrl).pathname?.endsWith(searchString) || false;
|
|
124
140
|
}
|
|
125
141
|
catch (e) {
|
|
126
142
|
return false;
|
|
127
143
|
}
|
|
128
144
|
}
|
|
145
|
+
exports.urlPathNameEndsWith = urlPathNameEndsWith;
|
|
129
146
|
async function writeDatabaseUrlsFile(destPath, srcPaths) {
|
|
130
147
|
const jsonUrls = srcPaths.filter(p => urlPathNameEndsWith(p, '.json'));
|
|
131
148
|
const dbUrls = srcPaths.filter(p => urlPathNameEndsWith(p, '.db'));
|
|
@@ -133,25 +150,19 @@ async function writeDatabaseUrlsFile(destPath, srcPaths) {
|
|
|
133
150
|
dbUrls,
|
|
134
151
|
jsonUrls
|
|
135
152
|
};
|
|
136
|
-
await
|
|
153
|
+
await fs_extra_1.default.writeJson(path_1.default.resolve(destPath, 'databaseUrls.json'), data);
|
|
137
154
|
}
|
|
155
|
+
exports.writeDatabaseUrlsFile = writeDatabaseUrlsFile;
|
|
138
156
|
function copyToReportDir(destPath, files, sourceDirectory) {
|
|
139
157
|
return Promise.all(files.map(fileName => {
|
|
140
|
-
const from =
|
|
141
|
-
const to =
|
|
142
|
-
return
|
|
158
|
+
const from = path_1.default.resolve(sourceDirectory, fileName);
|
|
159
|
+
const to = path_1.default.resolve(destPath, fileName);
|
|
160
|
+
return fs_extra_1.default.copy(from, to);
|
|
143
161
|
}));
|
|
144
162
|
}
|
|
145
|
-
|
|
146
|
-
return {
|
|
147
|
-
skips: [],
|
|
148
|
-
config: getConfigForStaticFile(pluginConfig),
|
|
149
|
-
apiValues: hermione.htmlReporter.values,
|
|
150
|
-
date: new Date().toString()
|
|
151
|
-
};
|
|
152
|
-
}
|
|
163
|
+
exports.copyToReportDir = copyToReportDir;
|
|
153
164
|
function getConfigForStaticFile(pluginConfig) {
|
|
154
|
-
return
|
|
165
|
+
return lodash_1.default.pick(pluginConfig, [
|
|
155
166
|
'defaultView',
|
|
156
167
|
'diffMode',
|
|
157
168
|
'baseHost',
|
|
@@ -163,39 +174,53 @@ function getConfigForStaticFile(pluginConfig) {
|
|
|
163
174
|
'plugins'
|
|
164
175
|
]);
|
|
165
176
|
}
|
|
177
|
+
exports.getConfigForStaticFile = getConfigForStaticFile;
|
|
178
|
+
function getDataForStaticFile(hermione, pluginConfig) {
|
|
179
|
+
const htmlReporter = hermione.htmlReporter;
|
|
180
|
+
return {
|
|
181
|
+
skips: [],
|
|
182
|
+
config: getConfigForStaticFile(pluginConfig),
|
|
183
|
+
apiValues: htmlReporter.values,
|
|
184
|
+
date: new Date().toString()
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
exports.getDataForStaticFile = getDataForStaticFile;
|
|
166
188
|
async function initializeCustomGui(hermione, { customGui }) {
|
|
167
|
-
await Promise.all(
|
|
168
|
-
.flatMap()
|
|
169
|
-
.
|
|
170
|
-
.map((ctx) => ctx.initialize({ hermione, ctx }))
|
|
189
|
+
await Promise.all((0, lodash_1.default)(customGui)
|
|
190
|
+
.flatMap(lodash_1.default.identity)
|
|
191
|
+
.map((ctx) => ctx.initialize?.({ hermione, ctx }))
|
|
171
192
|
.value());
|
|
172
193
|
}
|
|
194
|
+
exports.initializeCustomGui = initializeCustomGui;
|
|
173
195
|
async function runCustomGuiAction(hermione, { customGui }, payload) {
|
|
174
196
|
const { sectionName, groupIndex, controlIndex } = payload;
|
|
175
197
|
const ctx = customGui[sectionName][groupIndex];
|
|
176
198
|
const control = ctx.controls[controlIndex];
|
|
177
199
|
await ctx.action({ hermione, control, ctx });
|
|
178
200
|
}
|
|
201
|
+
exports.runCustomGuiAction = runCustomGuiAction;
|
|
179
202
|
function getPluginClientScriptPath(pluginName) {
|
|
180
203
|
try {
|
|
181
204
|
return require.resolve(`${pluginName}/plugin.js`);
|
|
182
205
|
}
|
|
183
|
-
catch (e) {
|
|
206
|
+
catch (e) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
184
207
|
logError(e);
|
|
185
208
|
return null;
|
|
186
209
|
}
|
|
187
210
|
}
|
|
211
|
+
exports.getPluginClientScriptPath = getPluginClientScriptPath;
|
|
188
212
|
function getPluginMiddleware(pluginName) {
|
|
189
213
|
try {
|
|
190
214
|
return require(`${pluginName}/middleware.js`);
|
|
191
215
|
}
|
|
192
|
-
catch (e) {
|
|
216
|
+
catch (e) { // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
193
217
|
if (e.code !== 'MODULE_NOT_FOUND') {
|
|
194
218
|
logError(e);
|
|
195
219
|
}
|
|
196
220
|
return null;
|
|
197
221
|
}
|
|
198
222
|
}
|
|
223
|
+
exports.getPluginMiddleware = getPluginMiddleware;
|
|
199
224
|
function isUnexpectedPlugin(plugins, pluginName) {
|
|
200
225
|
for (const { name } of plugins) {
|
|
201
226
|
if (name === pluginName) {
|
|
@@ -204,6 +229,7 @@ function isUnexpectedPlugin(plugins, pluginName) {
|
|
|
204
229
|
}
|
|
205
230
|
return true;
|
|
206
231
|
}
|
|
232
|
+
exports.isUnexpectedPlugin = isUnexpectedPlugin;
|
|
207
233
|
function forEachPlugin(plugins, callback) {
|
|
208
234
|
const seen = new Set();
|
|
209
235
|
for (const plugin of plugins) {
|
|
@@ -213,39 +239,11 @@ function forEachPlugin(plugins, callback) {
|
|
|
213
239
|
}
|
|
214
240
|
}
|
|
215
241
|
}
|
|
242
|
+
exports.forEachPlugin = forEachPlugin;
|
|
216
243
|
function mapPlugins(plugins, callback) {
|
|
217
244
|
const result = [];
|
|
218
245
|
forEachPlugin(plugins, pluginName => result.push(callback(pluginName)));
|
|
219
246
|
return result;
|
|
220
247
|
}
|
|
221
|
-
|
|
222
|
-
getDetailsFileName,
|
|
223
|
-
getReferencePath,
|
|
224
|
-
getCurrentPath,
|
|
225
|
-
getDiffPath,
|
|
226
|
-
hasImage,
|
|
227
|
-
getReferenceAbsolutePath,
|
|
228
|
-
getCurrentAbsolutePath,
|
|
229
|
-
getDiffAbsolutePath,
|
|
230
|
-
copyFileAsync,
|
|
231
|
-
deleteFile,
|
|
232
|
-
makeDirFor,
|
|
233
|
-
fileExists,
|
|
234
|
-
logPathToHtmlReport,
|
|
235
|
-
logError,
|
|
236
|
-
require,
|
|
237
|
-
prepareCommonJSData,
|
|
238
|
-
shouldUpdateAttempt,
|
|
239
|
-
saveStaticFilesToReportDir,
|
|
240
|
-
copyToReportDir,
|
|
241
|
-
writeDatabaseUrlsFile,
|
|
242
|
-
getConfigForStaticFile,
|
|
243
|
-
getPluginClientScriptPath,
|
|
244
|
-
getPluginMiddleware,
|
|
245
|
-
isUnexpectedPlugin,
|
|
246
|
-
forEachPlugin,
|
|
247
|
-
mapPlugins,
|
|
248
|
-
initializeCustomGui,
|
|
249
|
-
runCustomGuiAction
|
|
250
|
-
};
|
|
248
|
+
exports.mapPlugins = mapPlugins;
|
|
251
249
|
//# sourceMappingURL=server-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.js","sourceRoot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AAE,CAAC;IACvB,aAAa,CAAC,OAAO,EAAE,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACxE,OAAO,MAAM,CAAC;AAClB,CAAC;AAJD,gCAIC"}
|
|
@@ -1,78 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
select: string;
|
|
29
|
-
where: string;
|
|
30
|
-
orderBy: string;
|
|
31
|
-
orderDescending: boolean;
|
|
32
|
-
limit: number;
|
|
33
|
-
noCache: boolean;
|
|
34
|
-
}, ...queryArgs: string[]): any;
|
|
35
|
-
write(testResult: any): void;
|
|
36
|
-
/**
|
|
37
|
-
* Delete records from database
|
|
38
|
-
* @param {Object} deleteParams
|
|
39
|
-
* @param {string} deleteParams.where - `WHERE ${where}`
|
|
40
|
-
* @param {string} deleteParams.orderBy - `ORDER BY ${orderBy}`
|
|
41
|
-
* @param {boolean} deleteParams.orderDescending - ASCending / DESCending
|
|
42
|
-
* @param {number} deleteParams.limit - `LIMIT ${limit}`
|
|
43
|
-
* @param {...string} deleteArgs
|
|
44
|
-
*/
|
|
45
|
-
delete({ where, orderBy, orderDescending, limit }?: {
|
|
46
|
-
where: string;
|
|
47
|
-
orderBy: string;
|
|
48
|
-
orderDescending: boolean;
|
|
49
|
-
limit: number;
|
|
50
|
-
}, ...deleteArgs: string[]): void;
|
|
51
|
-
_createSentence({ where, orderBy, orderDescending, limit }: {
|
|
52
|
-
where: any;
|
|
53
|
-
orderBy: any;
|
|
54
|
-
orderDescending: any;
|
|
55
|
-
limit: any;
|
|
56
|
-
}): string;
|
|
57
|
-
_parseTestResult({ suitePath, suiteName, testResult }: {
|
|
58
|
-
suitePath: any;
|
|
59
|
-
suiteName: any;
|
|
60
|
-
testResult: any;
|
|
61
|
-
}): {
|
|
62
|
-
suitePath: any;
|
|
63
|
-
suiteName: any;
|
|
64
|
-
name: any;
|
|
65
|
-
suiteUrl: any;
|
|
66
|
-
metaInfo: any;
|
|
67
|
-
history: any;
|
|
68
|
-
description: any;
|
|
69
|
-
error: any;
|
|
70
|
-
skipReason: any;
|
|
71
|
-
imagesInfo: any;
|
|
72
|
-
screenshot: any;
|
|
73
|
-
multipleTabs: any;
|
|
74
|
-
status: any;
|
|
75
|
-
timestamp: any;
|
|
1
|
+
import type Hermione from 'hermione';
|
|
2
|
+
import { TestStatus } from './constants';
|
|
3
|
+
import type { ErrorDetails, HtmlReporterApi, ImageInfoFull } from './types';
|
|
4
|
+
interface QueryParams {
|
|
5
|
+
select?: string;
|
|
6
|
+
where?: string;
|
|
7
|
+
orderBy?: string;
|
|
8
|
+
orderDescending?: boolean;
|
|
9
|
+
limit?: number;
|
|
10
|
+
noCache?: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface DeleteParams {
|
|
13
|
+
where?: string;
|
|
14
|
+
orderBy?: string;
|
|
15
|
+
orderDescending?: boolean;
|
|
16
|
+
limit?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PreparedTestResult {
|
|
19
|
+
name: string;
|
|
20
|
+
suiteUrl: string;
|
|
21
|
+
metaInfo: Record<string, unknown>;
|
|
22
|
+
history: string[];
|
|
23
|
+
description: unknown;
|
|
24
|
+
error?: {
|
|
25
|
+
message?: string;
|
|
26
|
+
stack?: string;
|
|
27
|
+
stateName?: string;
|
|
76
28
|
};
|
|
77
|
-
|
|
29
|
+
skipReason?: string;
|
|
30
|
+
imagesInfo: ImageInfoFull[];
|
|
31
|
+
screenshot: boolean;
|
|
32
|
+
multipleTabs: boolean;
|
|
33
|
+
status: TestStatus;
|
|
34
|
+
timestamp?: number;
|
|
35
|
+
errorDetails?: ErrorDetails;
|
|
36
|
+
}
|
|
37
|
+
interface ParseTestResultParams {
|
|
38
|
+
suiteName: string;
|
|
39
|
+
suitePath: string[];
|
|
40
|
+
testResult: PreparedTestResult;
|
|
41
|
+
}
|
|
42
|
+
interface ParsedTestResult extends PreparedTestResult {
|
|
43
|
+
suiteName: ParseTestResultParams['suiteName'];
|
|
44
|
+
suitePath: ParseTestResultParams['suitePath'];
|
|
45
|
+
}
|
|
46
|
+
interface SqliteAdapterOptions {
|
|
47
|
+
hermione: Hermione & HtmlReporterApi;
|
|
48
|
+
reportPath: string;
|
|
49
|
+
reuse?: boolean;
|
|
50
|
+
}
|
|
51
|
+
export declare class SqliteAdapter {
|
|
52
|
+
private _hermione;
|
|
53
|
+
private _reportPath;
|
|
54
|
+
private _reuse;
|
|
55
|
+
private _db;
|
|
56
|
+
private _queryCache;
|
|
57
|
+
static create<T extends SqliteAdapter>(this: new (options: SqliteAdapterOptions) => T, options: SqliteAdapterOptions): T;
|
|
58
|
+
constructor({ hermione, reportPath, reuse }: SqliteAdapterOptions);
|
|
59
|
+
init(): Promise<void>;
|
|
60
|
+
close(): void;
|
|
61
|
+
query<T = unknown>(queryParams?: QueryParams, ...queryArgs: string[]): T;
|
|
62
|
+
write(testResult: ParseTestResultParams): void;
|
|
63
|
+
delete(deleteParams?: DeleteParams, ...deleteArgs: string[]): void;
|
|
64
|
+
private _createSentence;
|
|
65
|
+
_parseTestResult({ suitePath, suiteName, testResult }: ParseTestResultParams): ParsedTestResult;
|
|
66
|
+
private _createValuesArray;
|
|
78
67
|
}
|
|
68
|
+
export {};
|