@elliemae/encw-leak-runner 1.0.2
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/.eslintrc.cjs +10 -0
- package/.stylelintignore +4 -0
- package/CHANGELOG.md +51 -0
- package/README.md +309 -0
- package/babel.config.cjs +2 -0
- package/bin/leak-runner.ts +9 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/bin/leak-runner.js +792 -0
- package/dist/cjs/analysis/thresholdEvaluator.js +46 -0
- package/dist/cjs/browser/iframeHeapProfiler.js +46 -0
- package/dist/cjs/cli/command.js +16 -0
- package/dist/cjs/cli/commands/listCommand.js +47 -0
- package/dist/cjs/cli/commands/runCommand.js +111 -0
- package/dist/cjs/cli/index.js +42 -0
- package/dist/cjs/config/missingRequiredParamError.js +34 -0
- package/dist/cjs/config/requiredEnvParams.js +57 -0
- package/dist/cjs/config/runnerConfigLoader.js +73 -0
- package/dist/cjs/config/runnerConfigSchema.js +40 -0
- package/dist/cjs/config/sources/cliOverrideConfigSource.js +44 -0
- package/dist/cjs/config/sources/configSource.js +35 -0
- package/dist/cjs/config/sources/envVarConfigSource.js +41 -0
- package/dist/cjs/config/sources/fileConfigSource.js +62 -0
- package/dist/cjs/index.js +52 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/registry/scenarioRegistry.js +51 -0
- package/dist/cjs/reporting/consoleReporter.js +60 -0
- package/dist/cjs/reporting/junitReporter.js +75 -0
- package/dist/cjs/reporting/reporter.js +16 -0
- package/dist/cjs/runner/aiEnhancementStep.js +39 -0
- package/dist/cjs/runner/batchRunner.js +76 -0
- package/dist/cjs/runner/scenarioRunner.js +165 -0
- package/dist/cjs/scenarios/index.js +29 -0
- package/dist/cjs/scenarios/one-admin/export-navigation.scenario.js +50 -0
- package/dist/cjs/scenarios/one-admin/index.js +27 -0
- package/dist/cjs/scenarios/one-admin/page-models/ExportPageModel.js +43 -0
- package/dist/cjs/scenarios/one-admin/page-models/SelectSettingsPageModel.js +47 -0
- package/dist/cjs/scenarios/one-admin/page-models/index.js +26 -0
- package/dist/cjs/types/config.js +27 -0
- package/dist/cjs/types/results.js +16 -0
- package/dist/cjs/types/scenario.js +16 -0
- package/dist/esm/analysis/thresholdEvaluator.js +26 -0
- package/dist/esm/browser/iframeHeapProfiler.js +26 -0
- package/dist/esm/cli/command.js +0 -0
- package/dist/esm/cli/commands/listCommand.js +27 -0
- package/dist/esm/cli/commands/runCommand.js +93 -0
- package/dist/esm/cli/index.js +22 -0
- package/dist/esm/config/missingRequiredParamError.js +14 -0
- package/dist/esm/config/requiredEnvParams.js +37 -0
- package/dist/esm/config/runnerConfigLoader.js +53 -0
- package/dist/esm/config/runnerConfigSchema.js +20 -0
- package/dist/esm/config/sources/cliOverrideConfigSource.js +24 -0
- package/dist/esm/config/sources/configSource.js +15 -0
- package/dist/esm/config/sources/envVarConfigSource.js +21 -0
- package/dist/esm/config/sources/fileConfigSource.js +34 -0
- package/dist/esm/index.js +35 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/registry/scenarioRegistry.js +31 -0
- package/dist/esm/reporting/consoleReporter.js +40 -0
- package/dist/esm/reporting/junitReporter.js +45 -0
- package/dist/esm/reporting/reporter.js +0 -0
- package/dist/esm/runner/aiEnhancementStep.js +22 -0
- package/dist/esm/runner/batchRunner.js +56 -0
- package/dist/esm/runner/scenarioRunner.js +137 -0
- package/dist/esm/scenarios/index.js +9 -0
- package/dist/esm/scenarios/one-admin/export-navigation.scenario.js +33 -0
- package/dist/esm/scenarios/one-admin/index.js +7 -0
- package/dist/esm/scenarios/one-admin/page-models/ExportPageModel.js +23 -0
- package/dist/esm/scenarios/one-admin/page-models/SelectSettingsPageModel.js +27 -0
- package/dist/esm/scenarios/one-admin/page-models/index.js +6 -0
- package/dist/esm/types/config.js +7 -0
- package/dist/esm/types/results.js +0 -0
- package/dist/esm/types/scenario.js +0 -0
- package/dist/types/bin/leak-runner.d.ts +2 -0
- package/dist/types/lib/analysis/tests/thresholdEvaluator.test.d.ts +1 -0
- package/dist/types/lib/analysis/thresholdEvaluator.d.ts +6 -0
- package/dist/types/lib/browser/iframeHeapProfiler.d.ts +9 -0
- package/dist/types/lib/browser/tests/iframeHeapProfiler.test.d.ts +1 -0
- package/dist/types/lib/cli/command.d.ts +17 -0
- package/dist/types/lib/cli/commands/listCommand.d.ts +5 -0
- package/dist/types/lib/cli/commands/runCommand.d.ts +7 -0
- package/dist/types/lib/cli/index.d.ts +4 -0
- package/dist/types/lib/config/missingRequiredParamError.d.ts +4 -0
- package/dist/types/lib/config/requiredEnvParams.d.ts +16 -0
- package/dist/types/lib/config/runnerConfigLoader.d.ts +13 -0
- package/dist/types/lib/config/runnerConfigSchema.d.ts +78 -0
- package/dist/types/lib/config/sources/cliOverrideConfigSource.d.ts +14 -0
- package/dist/types/lib/config/sources/configSource.d.ts +14 -0
- package/dist/types/lib/config/sources/envVarConfigSource.d.ts +7 -0
- package/dist/types/lib/config/sources/fileConfigSource.d.ts +9 -0
- package/dist/types/lib/config/tests/cliOverrideConfigSource.test.d.ts +1 -0
- package/dist/types/lib/config/tests/envVarConfigSource.test.d.ts +1 -0
- package/dist/types/lib/config/tests/fileConfigSource.test.d.ts +1 -0
- package/dist/types/lib/config/tests/requiredEnvParams.test.d.ts +1 -0
- package/dist/types/lib/config/tests/runnerConfigLoader.test.d.ts +1 -0
- package/dist/types/lib/index.d.ts +18 -0
- package/dist/types/lib/registry/scenarioRegistry.d.ts +18 -0
- package/dist/types/lib/registry/tests/scenarioRegistry.test.d.ts +1 -0
- package/dist/types/lib/reporting/consoleReporter.d.ts +5 -0
- package/dist/types/lib/reporting/junitReporter.d.ts +5 -0
- package/dist/types/lib/reporting/reporter.d.ts +4 -0
- package/dist/types/lib/reporting/tests/consoleReporter.test.d.ts +1 -0
- package/dist/types/lib/reporting/tests/junitReporter.test.d.ts +1 -0
- package/dist/types/lib/runner/aiEnhancementStep.d.ts +15 -0
- package/dist/types/lib/runner/batchRunner.d.ts +14 -0
- package/dist/types/lib/runner/scenarioRunner.d.ts +15 -0
- package/dist/types/lib/runner/tests/aiEnhancementStep.test.d.ts +1 -0
- package/dist/types/lib/runner/tests/batchRunner.test.d.ts +1 -0
- package/dist/types/lib/runner/tests/scenarioRunner.test.d.ts +1 -0
- package/dist/types/lib/scenarios/index.d.ts +2 -0
- package/dist/types/lib/scenarios/one-admin/export-navigation.scenario.d.ts +2 -0
- package/dist/types/lib/scenarios/one-admin/index.d.ts +2 -0
- package/dist/types/lib/scenarios/one-admin/page-models/ExportPageModel.d.ts +8 -0
- package/dist/types/lib/scenarios/one-admin/page-models/SelectSettingsPageModel.d.ts +10 -0
- package/dist/types/lib/scenarios/one-admin/page-models/index.d.ts +2 -0
- package/dist/types/lib/types/config.d.ts +26 -0
- package/dist/types/lib/types/results.d.ts +19 -0
- package/dist/types/lib/types/scenario.d.ts +17 -0
- package/jest.config.cjs +9 -0
- package/leak-runner.config.json +13 -0
- package/leak-runner.schema.json +27 -0
- package/lib/analysis/tests/thresholdEvaluator.test.ts +125 -0
- package/lib/analysis/thresholdEvaluator.ts +36 -0
- package/lib/browser/iframeHeapProfiler.ts +30 -0
- package/lib/browser/tests/iframeHeapProfiler.test.ts +71 -0
- package/lib/cli/command.ts +19 -0
- package/lib/cli/commands/listCommand.ts +36 -0
- package/lib/cli/commands/runCommand.ts +126 -0
- package/lib/cli/index.ts +25 -0
- package/lib/config/missingRequiredParamError.ts +10 -0
- package/lib/config/requiredEnvParams.ts +50 -0
- package/lib/config/runnerConfigLoader.ts +84 -0
- package/lib/config/runnerConfigSchema.ts +27 -0
- package/lib/config/sources/cliOverrideConfigSource.ts +30 -0
- package/lib/config/sources/configSource.ts +27 -0
- package/lib/config/sources/envVarConfigSource.ts +23 -0
- package/lib/config/sources/fileConfigSource.ts +39 -0
- package/lib/config/tests/cliOverrideConfigSource.test.ts +25 -0
- package/lib/config/tests/envVarConfigSource.test.ts +57 -0
- package/lib/config/tests/fileConfigSource.test.ts +49 -0
- package/lib/config/tests/requiredEnvParams.test.ts +113 -0
- package/lib/config/tests/runnerConfigLoader.test.ts +59 -0
- package/lib/index.ts +37 -0
- package/lib/registry/scenarioRegistry.ts +48 -0
- package/lib/registry/tests/scenarioRegistry.test.ts +96 -0
- package/lib/reporting/consoleReporter.ts +48 -0
- package/lib/reporting/junitReporter.ts +62 -0
- package/lib/reporting/reporter.ts +5 -0
- package/lib/reporting/tests/consoleReporter.test.ts +82 -0
- package/lib/reporting/tests/junitReporter.test.ts +103 -0
- package/lib/runner/aiEnhancementStep.ts +39 -0
- package/lib/runner/batchRunner.ts +71 -0
- package/lib/runner/scenarioRunner.ts +189 -0
- package/lib/runner/tests/aiEnhancementStep.test.ts +174 -0
- package/lib/runner/tests/batchRunner.test.ts +133 -0
- package/lib/runner/tests/scenarioRunner.test.ts +162 -0
- package/lib/scenarios/index.ts +8 -0
- package/lib/scenarios/one-admin/export-navigation.scenario.ts +38 -0
- package/lib/scenarios/one-admin/index.ts +6 -0
- package/lib/scenarios/one-admin/page-models/ExportPageModel.ts +26 -0
- package/lib/scenarios/one-admin/page-models/SelectSettingsPageModel.ts +30 -0
- package/lib/scenarios/one-admin/page-models/index.ts +2 -0
- package/lib/types/config.ts +34 -0
- package/lib/types/results.ts +22 -0
- package/lib/types/scenario.ts +18 -0
- package/package.json +46 -0
- package/reports/analysis/index.html +116 -0
- package/reports/analysis/thresholdEvaluator.ts.html +193 -0
- package/reports/base.css +224 -0
- package/reports/block-navigation.js +87 -0
- package/reports/browser/iframeHeapProfiler.ts.html +175 -0
- package/reports/browser/index.html +116 -0
- package/reports/cli/commands/index.html +131 -0
- package/reports/cli/commands/listCommand.ts.html +193 -0
- package/reports/cli/commands/runCommand.ts.html +463 -0
- package/reports/cli/index.html +116 -0
- package/reports/cli/index.ts.html +160 -0
- package/reports/config/index.html +161 -0
- package/reports/config/missingRequiredParamError.ts.html +115 -0
- package/reports/config/requiredEnvParams.ts.html +235 -0
- package/reports/config/runnerConfigLoader.ts.html +337 -0
- package/reports/config/runnerConfigSchema.ts.html +166 -0
- package/reports/config/sources/cliOverrideConfigSource.ts.html +175 -0
- package/reports/config/sources/configSource.ts.html +166 -0
- package/reports/config/sources/envVarConfigSource.ts.html +154 -0
- package/reports/config/sources/fileConfigSource.ts.html +202 -0
- package/reports/config/sources/index.html +161 -0
- package/reports/favicon.png +0 -0
- package/reports/index.html +296 -0
- package/reports/lcov-report/analysis/index.html +116 -0
- package/reports/lcov-report/analysis/thresholdEvaluator.ts.html +193 -0
- package/reports/lcov-report/base.css +224 -0
- package/reports/lcov-report/block-navigation.js +87 -0
- package/reports/lcov-report/browser/iframeHeapProfiler.ts.html +175 -0
- package/reports/lcov-report/browser/index.html +116 -0
- package/reports/lcov-report/cli/commands/index.html +131 -0
- package/reports/lcov-report/cli/commands/listCommand.ts.html +193 -0
- package/reports/lcov-report/cli/commands/runCommand.ts.html +463 -0
- package/reports/lcov-report/cli/index.html +116 -0
- package/reports/lcov-report/cli/index.ts.html +160 -0
- package/reports/lcov-report/config/index.html +161 -0
- package/reports/lcov-report/config/missingRequiredParamError.ts.html +115 -0
- package/reports/lcov-report/config/requiredEnvParams.ts.html +235 -0
- package/reports/lcov-report/config/runnerConfigLoader.ts.html +337 -0
- package/reports/lcov-report/config/runnerConfigSchema.ts.html +166 -0
- package/reports/lcov-report/config/sources/cliOverrideConfigSource.ts.html +175 -0
- package/reports/lcov-report/config/sources/configSource.ts.html +166 -0
- package/reports/lcov-report/config/sources/envVarConfigSource.ts.html +154 -0
- package/reports/lcov-report/config/sources/fileConfigSource.ts.html +202 -0
- package/reports/lcov-report/config/sources/index.html +161 -0
- package/reports/lcov-report/favicon.png +0 -0
- package/reports/lcov-report/index.html +296 -0
- package/reports/lcov-report/prettify.css +1 -0
- package/reports/lcov-report/prettify.js +2 -0
- package/reports/lcov-report/registry/index.html +116 -0
- package/reports/lcov-report/registry/scenarioRegistry.ts.html +229 -0
- package/reports/lcov-report/reporting/consoleReporter.ts.html +229 -0
- package/reports/lcov-report/reporting/index.html +131 -0
- package/reports/lcov-report/reporting/junitReporter.ts.html +271 -0
- package/reports/lcov-report/runner/aiEnhancementStep.ts.html +202 -0
- package/reports/lcov-report/runner/batchRunner.ts.html +298 -0
- package/reports/lcov-report/runner/index.html +146 -0
- package/reports/lcov-report/runner/scenarioRunner.ts.html +652 -0
- package/reports/lcov-report/scenarios/index.html +116 -0
- package/reports/lcov-report/scenarios/index.ts.html +109 -0
- package/reports/lcov-report/scenarios/one-admin/export-navigation.scenario.ts.html +199 -0
- package/reports/lcov-report/scenarios/one-admin/index.html +131 -0
- package/reports/lcov-report/scenarios/one-admin/index.ts.html +103 -0
- package/reports/lcov-report/scenarios/one-admin/page-models/ExportPageModel.ts.html +163 -0
- package/reports/lcov-report/scenarios/one-admin/page-models/SelectSettingsPageModel.ts.html +175 -0
- package/reports/lcov-report/scenarios/one-admin/page-models/index.html +131 -0
- package/reports/lcov-report/sort-arrow-sprite.png +0 -0
- package/reports/lcov-report/sorter.js +210 -0
- package/reports/lcov-report/types/config.ts.html +187 -0
- package/reports/lcov-report/types/index.html +116 -0
- package/reports/lcov.info +883 -0
- package/reports/prettify.css +1 -0
- package/reports/prettify.js +2 -0
- package/reports/registry/index.html +116 -0
- package/reports/registry/scenarioRegistry.ts.html +229 -0
- package/reports/reporting/consoleReporter.ts.html +229 -0
- package/reports/reporting/index.html +131 -0
- package/reports/reporting/junitReporter.ts.html +271 -0
- package/reports/runner/aiEnhancementStep.ts.html +202 -0
- package/reports/runner/batchRunner.ts.html +298 -0
- package/reports/runner/index.html +146 -0
- package/reports/runner/scenarioRunner.ts.html +652 -0
- package/reports/scenarios/index.html +116 -0
- package/reports/scenarios/index.ts.html +109 -0
- package/reports/scenarios/one-admin/export-navigation.scenario.ts.html +199 -0
- package/reports/scenarios/one-admin/index.html +131 -0
- package/reports/scenarios/one-admin/index.ts.html +103 -0
- package/reports/scenarios/one-admin/page-models/ExportPageModel.ts.html +163 -0
- package/reports/scenarios/one-admin/page-models/SelectSettingsPageModel.ts.html +175 -0
- package/reports/scenarios/one-admin/page-models/index.html +131 -0
- package/reports/sort-arrow-sprite.png +0 -0
- package/reports/sorter.js +210 -0
- package/reports/types/config.ts.html +187 -0
- package/reports/types/index.html +116 -0
- package/stylelint.config.cjs +2 -0
- package/test-report.xml +100 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var fileConfigSource_exports = {};
|
|
30
|
+
__export(fileConfigSource_exports, {
|
|
31
|
+
FileConfigSource: () => FileConfigSource
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(fileConfigSource_exports);
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
35
|
+
var import_runnerConfigSchema = require("../runnerConfigSchema.js");
|
|
36
|
+
class FileConfigSource {
|
|
37
|
+
constructor(filePath) {
|
|
38
|
+
this.filePath = filePath;
|
|
39
|
+
}
|
|
40
|
+
filePath;
|
|
41
|
+
priority = 1;
|
|
42
|
+
name = "file";
|
|
43
|
+
load() {
|
|
44
|
+
if (!import_node_fs.default.existsSync(this.filePath)) return {};
|
|
45
|
+
const raw = import_node_fs.default.readFileSync(this.filePath, "utf8");
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(raw);
|
|
49
|
+
} catch (err) {
|
|
50
|
+
throw new Error(
|
|
51
|
+
`Failed to parse config file ${this.filePath}: ${err.message}`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
const result = import_runnerConfigSchema.runnerConfigFileSchema.safeParse(parsed);
|
|
55
|
+
if (!result.success) {
|
|
56
|
+
const issues = result.error.issues.map((i) => ` - ${i.path.join(".")}: ${i.message}`).join("\n");
|
|
57
|
+
throw new Error(`Invalid config file ${this.filePath}:
|
|
58
|
+
${issues}`);
|
|
59
|
+
}
|
|
60
|
+
return result.data;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
__export(index_exports, {
|
|
21
|
+
BatchRunner: () => import_batchRunner.BatchRunner,
|
|
22
|
+
CliOverrideConfigSource: () => import_cliOverrideConfigSource.CliOverrideConfigSource,
|
|
23
|
+
ConsoleReporter: () => import_consoleReporter.ConsoleReporter,
|
|
24
|
+
DEFAULT_THRESHOLDS: () => import_config.DEFAULT_THRESHOLDS,
|
|
25
|
+
EnvVarConfigSource: () => import_envVarConfigSource.EnvVarConfigSource,
|
|
26
|
+
FileConfigSource: () => import_fileConfigSource.FileConfigSource,
|
|
27
|
+
IframeHeapProfiler: () => import_iframeHeapProfiler.IframeHeapProfiler,
|
|
28
|
+
JunitReporter: () => import_junitReporter.JunitReporter,
|
|
29
|
+
MissingRequiredParamError: () => import_requiredEnvParams.MissingRequiredParamError,
|
|
30
|
+
RequiredEnvParamsResolver: () => import_requiredEnvParams.RequiredEnvParamsResolver,
|
|
31
|
+
RunnerConfigLoader: () => import_runnerConfigLoader.RunnerConfigLoader,
|
|
32
|
+
ScenarioRegistry: () => import_scenarioRegistry.ScenarioRegistry,
|
|
33
|
+
ScenarioRunner: () => import_scenarioRunner.ScenarioRunner,
|
|
34
|
+
ThresholdEvaluator: () => import_thresholdEvaluator.ThresholdEvaluator,
|
|
35
|
+
buildProgram: () => import_cli.buildProgram,
|
|
36
|
+
defaultDeps: () => import_cli.defaultDeps
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(index_exports);
|
|
39
|
+
var import_config = require("./types/config.js");
|
|
40
|
+
var import_scenarioRegistry = require("./registry/scenarioRegistry.js");
|
|
41
|
+
var import_batchRunner = require("./runner/batchRunner.js");
|
|
42
|
+
var import_scenarioRunner = require("./runner/scenarioRunner.js");
|
|
43
|
+
var import_iframeHeapProfiler = require("./browser/iframeHeapProfiler.js");
|
|
44
|
+
var import_thresholdEvaluator = require("./analysis/thresholdEvaluator.js");
|
|
45
|
+
var import_consoleReporter = require("./reporting/consoleReporter.js");
|
|
46
|
+
var import_junitReporter = require("./reporting/junitReporter.js");
|
|
47
|
+
var import_runnerConfigLoader = require("./config/runnerConfigLoader.js");
|
|
48
|
+
var import_fileConfigSource = require("./config/sources/fileConfigSource.js");
|
|
49
|
+
var import_envVarConfigSource = require("./config/sources/envVarConfigSource.js");
|
|
50
|
+
var import_cliOverrideConfigSource = require("./config/sources/cliOverrideConfigSource.js");
|
|
51
|
+
var import_requiredEnvParams = require("./config/requiredEnvParams.js");
|
|
52
|
+
var import_cli = require("./cli/index.js");
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var scenarioRegistry_exports = {};
|
|
20
|
+
__export(scenarioRegistry_exports, {
|
|
21
|
+
ScenarioRegistry: () => ScenarioRegistry
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(scenarioRegistry_exports);
|
|
24
|
+
class ScenarioRegistry {
|
|
25
|
+
entries = /* @__PURE__ */ new Map();
|
|
26
|
+
register(group) {
|
|
27
|
+
group.scenarios.forEach((scenario) => {
|
|
28
|
+
const key = `${group.microapp}/${scenario.id}`;
|
|
29
|
+
if (this.entries.has(key)) {
|
|
30
|
+
throw new Error(`Duplicate scenario: ${key}`);
|
|
31
|
+
}
|
|
32
|
+
this.entries.set(key, scenario);
|
|
33
|
+
});
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
get(key) {
|
|
37
|
+
return this.entries.get(key);
|
|
38
|
+
}
|
|
39
|
+
has(key) {
|
|
40
|
+
return this.entries.has(key);
|
|
41
|
+
}
|
|
42
|
+
size() {
|
|
43
|
+
return this.entries.size;
|
|
44
|
+
}
|
|
45
|
+
list() {
|
|
46
|
+
return Array.from(this.entries.entries()).map(([key, scenario]) => ({ key, scenario })).sort((a, b) => a.key.localeCompare(b.key));
|
|
47
|
+
}
|
|
48
|
+
filterByTag(tag) {
|
|
49
|
+
return this.list().filter((entry) => entry.scenario.tags?.includes(tag));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var consoleReporter_exports = {};
|
|
20
|
+
__export(consoleReporter_exports, {
|
|
21
|
+
ConsoleReporter: () => ConsoleReporter
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(consoleReporter_exports);
|
|
24
|
+
const GREEN = "\x1B[32m";
|
|
25
|
+
const RED = "\x1B[31m";
|
|
26
|
+
const BOLD = "\x1B[1m";
|
|
27
|
+
const RESET = "\x1B[0m";
|
|
28
|
+
function formatDuration(ms) {
|
|
29
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
30
|
+
}
|
|
31
|
+
function printLine(text) {
|
|
32
|
+
process.stdout.write(`${text}
|
|
33
|
+
`);
|
|
34
|
+
}
|
|
35
|
+
function printScenario(result) {
|
|
36
|
+
const status = result.passed ? `${GREEN}PASSED${RESET}` : `${RED}FAILED${RESET}`;
|
|
37
|
+
const duration = formatDuration(result.durationMs);
|
|
38
|
+
printLine(` ${status} ${BOLD}${result.name}${RESET} (${duration})`);
|
|
39
|
+
if (!result.passed && result.thresholdResult.reason) {
|
|
40
|
+
printLine(` ${RED}\u2192 ${result.thresholdResult.reason}${RESET}`);
|
|
41
|
+
}
|
|
42
|
+
if (!result.passed && result.error) {
|
|
43
|
+
printLine(` ${RED}\u2192 Error: ${result.error.message}${RESET}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
class ConsoleReporter {
|
|
47
|
+
write(summary) {
|
|
48
|
+
printLine("");
|
|
49
|
+
printLine(`${BOLD}MEMORY LEAK RUN RESULTS${RESET}`);
|
|
50
|
+
printLine("\u2500".repeat(50));
|
|
51
|
+
summary.results.forEach(printScenario);
|
|
52
|
+
printLine("\u2500".repeat(50));
|
|
53
|
+
const total = summary.results.length;
|
|
54
|
+
const duration = formatDuration(summary.totalDurationMs);
|
|
55
|
+
printLine(
|
|
56
|
+
`${summary.passCount} passed, ${summary.failCount} failed of ${total} scenarios (${duration})`
|
|
57
|
+
);
|
|
58
|
+
printLine("");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var junitReporter_exports = {};
|
|
30
|
+
__export(junitReporter_exports, {
|
|
31
|
+
JunitReporter: () => JunitReporter
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(junitReporter_exports);
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
35
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
|
+
function escapeXml(str) {
|
|
37
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
38
|
+
}
|
|
39
|
+
function formatSeconds(ms) {
|
|
40
|
+
return (ms / 1e3).toFixed(1);
|
|
41
|
+
}
|
|
42
|
+
function renderTestCase(result) {
|
|
43
|
+
const timeAttr = `time="${formatSeconds(result.durationMs)}"`;
|
|
44
|
+
const open = ` <testcase name="${escapeXml(
|
|
45
|
+
result.name
|
|
46
|
+
)}" classname="memory-leak" ${timeAttr}>`;
|
|
47
|
+
if (result.passed) {
|
|
48
|
+
return `${open}
|
|
49
|
+
</testcase>`;
|
|
50
|
+
}
|
|
51
|
+
const message = result.thresholdResult.reason ?? result.error?.message ?? "Unknown failure";
|
|
52
|
+
const body = result.thresholdResult.reason ? `See leak-reports/${result.name}.md for full analysis` : result.error?.stack ?? "";
|
|
53
|
+
return `${open}
|
|
54
|
+
<failure message="${escapeXml(message)}">
|
|
55
|
+
${escapeXml(body)}
|
|
56
|
+
</failure>
|
|
57
|
+
</testcase>`;
|
|
58
|
+
}
|
|
59
|
+
class JunitReporter {
|
|
60
|
+
write(summary, outputDir) {
|
|
61
|
+
const totalTime = formatSeconds(summary.totalDurationMs);
|
|
62
|
+
const testCases = summary.results.map(renderTestCase).join("\n");
|
|
63
|
+
const xml = [
|
|
64
|
+
'<?xml version="1.0" encoding="UTF-8"?>',
|
|
65
|
+
`<testsuites name="encw-leak-runner" time="${totalTime}">`,
|
|
66
|
+
` <testsuite name="microapp-memory-leaks" tests="${summary.results.length}" failures="${summary.failCount}" time="${totalTime}">`,
|
|
67
|
+
testCases,
|
|
68
|
+
" </testsuite>",
|
|
69
|
+
"</testsuites>"
|
|
70
|
+
].join("\n");
|
|
71
|
+
import_node_fs.default.mkdirSync(outputDir, { recursive: true });
|
|
72
|
+
import_node_fs.default.writeFileSync(import_node_path.default.join(outputDir, "test-results.xml"), xml, "utf8");
|
|
73
|
+
return Promise.resolve();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var reporter_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(reporter_exports);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var aiEnhancementStep_exports = {};
|
|
20
|
+
__export(aiEnhancementStep_exports, {
|
|
21
|
+
enhanceMarkdownIfConfigured: () => enhanceMarkdownIfConfigured
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(aiEnhancementStep_exports);
|
|
24
|
+
var import_encw_heap_doctor = require("@elliemae/encw-heap-doctor");
|
|
25
|
+
async function enhanceMarkdownIfConfigured(report, config, scenarioName) {
|
|
26
|
+
if (!config.ai?.apiKey) return report.markdown;
|
|
27
|
+
try {
|
|
28
|
+
const enhancer = new import_encw_heap_doctor.AiEnhancer(config.ai);
|
|
29
|
+
await enhancer.enhance(report.afterAnalysis.leakResults);
|
|
30
|
+
return (0, import_encw_heap_doctor.renderComparisonMarkdown)(report);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
33
|
+
process.stderr.write(
|
|
34
|
+
`Genice enhancement failed for ${scenarioName}: ${message}; writing report without AI section.
|
|
35
|
+
`
|
|
36
|
+
);
|
|
37
|
+
return report.markdown;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var batchRunner_exports = {};
|
|
20
|
+
__export(batchRunner_exports, {
|
|
21
|
+
BatchRunner: () => BatchRunner
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(batchRunner_exports);
|
|
24
|
+
var import_scenarioRunner = require("./scenarioRunner.js");
|
|
25
|
+
function buildSummary(results) {
|
|
26
|
+
return {
|
|
27
|
+
results,
|
|
28
|
+
totalDurationMs: results.reduce((acc, r) => acc + r.durationMs, 0),
|
|
29
|
+
passCount: results.filter((r) => r.passed).length,
|
|
30
|
+
failCount: results.filter((r) => !r.passed).length
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
class BatchRunner {
|
|
34
|
+
constructor(config, registry) {
|
|
35
|
+
this.config = config;
|
|
36
|
+
this.registry = registry;
|
|
37
|
+
this.scenarioRunner = new import_scenarioRunner.ScenarioRunner(config);
|
|
38
|
+
}
|
|
39
|
+
config;
|
|
40
|
+
registry;
|
|
41
|
+
scenarioRunner;
|
|
42
|
+
async runAll() {
|
|
43
|
+
const scenarios = this.registry.list().map((entry) => entry.scenario);
|
|
44
|
+
return this.executeScenarios(scenarios);
|
|
45
|
+
}
|
|
46
|
+
async runByTag(tag) {
|
|
47
|
+
const scenarios = this.registry.filterByTag(tag).map((entry) => entry.scenario);
|
|
48
|
+
return this.executeScenarios(scenarios);
|
|
49
|
+
}
|
|
50
|
+
async runByName(key) {
|
|
51
|
+
const scenario = this.registry.get(key);
|
|
52
|
+
if (!scenario) {
|
|
53
|
+
throw new Error(`No scenario registered with key "${key}"`);
|
|
54
|
+
}
|
|
55
|
+
return this.executeScenarios([scenario]);
|
|
56
|
+
}
|
|
57
|
+
async executeScenarios(scenarios) {
|
|
58
|
+
const results = await scenarios.reduce(
|
|
59
|
+
async (acc, scenario) => {
|
|
60
|
+
const prior = await acc;
|
|
61
|
+
const result = await this.runOne(scenario);
|
|
62
|
+
return [...prior, result];
|
|
63
|
+
},
|
|
64
|
+
Promise.resolve([])
|
|
65
|
+
);
|
|
66
|
+
return buildSummary(results);
|
|
67
|
+
}
|
|
68
|
+
async runOne(scenario) {
|
|
69
|
+
const browser = await this.scenarioRunner.launchBrowser();
|
|
70
|
+
try {
|
|
71
|
+
return await this.scenarioRunner.run(scenario, browser);
|
|
72
|
+
} finally {
|
|
73
|
+
await browser.close();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var scenarioRunner_exports = {};
|
|
30
|
+
__export(scenarioRunner_exports, {
|
|
31
|
+
ScenarioRunner: () => ScenarioRunner
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(scenarioRunner_exports);
|
|
34
|
+
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
35
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
36
|
+
var import_test = require("@playwright/test");
|
|
37
|
+
var import_smoked_suite = require("@elliemae/smoked-suite");
|
|
38
|
+
var import_iframeHeapProfiler = require("../browser/iframeHeapProfiler.js");
|
|
39
|
+
var import_thresholdEvaluator = require("../analysis/thresholdEvaluator.js");
|
|
40
|
+
var import_config = require("../types/config.js");
|
|
41
|
+
var import_aiEnhancementStep = require("./aiEnhancementStep.js");
|
|
42
|
+
async function resolveIframe(page, selector) {
|
|
43
|
+
const handle = await page.locator(selector).elementHandle();
|
|
44
|
+
if (!handle) throw new Error(`Iframe not found for selector: ${selector}`);
|
|
45
|
+
const frame = await handle.contentFrame();
|
|
46
|
+
if (!frame)
|
|
47
|
+
throw new Error(`Could not get content frame for selector: ${selector}`);
|
|
48
|
+
return frame;
|
|
49
|
+
}
|
|
50
|
+
async function forceGarbageCollection(page) {
|
|
51
|
+
const session = await page.context().newCDPSession(page);
|
|
52
|
+
await session.send("HeapProfiler.enable");
|
|
53
|
+
await session.send("HeapProfiler.collectGarbage");
|
|
54
|
+
await session.send("HeapProfiler.disable");
|
|
55
|
+
await session.detach();
|
|
56
|
+
await page.waitForTimeout(2e3);
|
|
57
|
+
}
|
|
58
|
+
function cleanupSnapshots(paths) {
|
|
59
|
+
if (paths.before && import_node_fs.default.existsSync(paths.before)) import_node_fs.default.unlinkSync(paths.before);
|
|
60
|
+
if (paths.after && import_node_fs.default.existsSync(paths.after)) import_node_fs.default.unlinkSync(paths.after);
|
|
61
|
+
}
|
|
62
|
+
class ScenarioRunner {
|
|
63
|
+
constructor(config) {
|
|
64
|
+
this.config = config;
|
|
65
|
+
}
|
|
66
|
+
config;
|
|
67
|
+
async launchBrowser() {
|
|
68
|
+
return import_test.chromium.launch({ headless: this.config.runner.headless });
|
|
69
|
+
}
|
|
70
|
+
async run(scenario, browser) {
|
|
71
|
+
const startTime = Date.now();
|
|
72
|
+
const context = await browser.newContext({
|
|
73
|
+
baseURL: this.config.env.baseUrl
|
|
74
|
+
});
|
|
75
|
+
const page = await context.newPage();
|
|
76
|
+
const paths = { before: "", after: "" };
|
|
77
|
+
let report = null;
|
|
78
|
+
let error = null;
|
|
79
|
+
try {
|
|
80
|
+
report = await this.runScenarioInPage(page, scenario, paths);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
error = err instanceof Error ? err : new Error(String(err));
|
|
83
|
+
} finally {
|
|
84
|
+
await context.close();
|
|
85
|
+
cleanupSnapshots(paths);
|
|
86
|
+
}
|
|
87
|
+
return this.buildResult({ scenario, report, error, startTime });
|
|
88
|
+
}
|
|
89
|
+
async runScenarioInPage(page, scenario, paths) {
|
|
90
|
+
const snapshotsDir = import_node_path.default.join(this.config.runner.outputDir, "snapshots");
|
|
91
|
+
const { profiler, frame } = await this.setupAndProfile(
|
|
92
|
+
page,
|
|
93
|
+
scenario,
|
|
94
|
+
snapshotsDir
|
|
95
|
+
);
|
|
96
|
+
paths.before = await profiler.captureSnapshot("before");
|
|
97
|
+
await this.repeatScenarioActions(scenario, page, frame);
|
|
98
|
+
await forceGarbageCollection(page);
|
|
99
|
+
paths.after = await profiler.captureSnapshot("after");
|
|
100
|
+
const report = await profiler.compare(
|
|
101
|
+
"before",
|
|
102
|
+
"after",
|
|
103
|
+
this.config.runner.topN
|
|
104
|
+
);
|
|
105
|
+
if (report) await this.writeReport(report, scenario);
|
|
106
|
+
return report;
|
|
107
|
+
}
|
|
108
|
+
async setupAndProfile(page, scenario, snapshotsDir) {
|
|
109
|
+
const auth = new import_smoked_suite.AuthManager();
|
|
110
|
+
const pageSetup = new import_smoked_suite.PageSetup();
|
|
111
|
+
await pageSetup.apply(page);
|
|
112
|
+
await auth.login(page, {
|
|
113
|
+
username: this.config.env.userId,
|
|
114
|
+
password: this.config.env.password,
|
|
115
|
+
instanceId: this.config.env.instanceId
|
|
116
|
+
});
|
|
117
|
+
await page.goto(scenario.url());
|
|
118
|
+
const frame = await resolveIframe(page, scenario.microappSelector);
|
|
119
|
+
import_node_fs.default.mkdirSync(snapshotsDir, { recursive: true });
|
|
120
|
+
const profiler = new import_iframeHeapProfiler.IframeHeapProfiler(page, frame, snapshotsDir);
|
|
121
|
+
return { profiler, frame };
|
|
122
|
+
}
|
|
123
|
+
async repeatScenarioActions(scenario, page, frame) {
|
|
124
|
+
const repeatCount = scenario.repeat?.() ?? 3;
|
|
125
|
+
for (let i = 0; i < repeatCount; i += 1) {
|
|
126
|
+
await scenario.action(page, frame);
|
|
127
|
+
if (scenario.back) {
|
|
128
|
+
await scenario.back(page);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
async writeReport(report, scenario) {
|
|
133
|
+
const reportPath = import_node_path.default.join(
|
|
134
|
+
this.config.runner.outputDir,
|
|
135
|
+
`${scenario.id}.md`
|
|
136
|
+
);
|
|
137
|
+
import_node_fs.default.mkdirSync(import_node_path.default.dirname(reportPath), { recursive: true });
|
|
138
|
+
const markdown = await (0, import_aiEnhancementStep.enhanceMarkdownIfConfigured)(
|
|
139
|
+
report,
|
|
140
|
+
this.config,
|
|
141
|
+
scenario.name
|
|
142
|
+
);
|
|
143
|
+
import_node_fs.default.writeFileSync(reportPath, markdown);
|
|
144
|
+
}
|
|
145
|
+
buildResult(input) {
|
|
146
|
+
const { scenario, report, error, startTime } = input;
|
|
147
|
+
const thresholds = {
|
|
148
|
+
...import_config.DEFAULT_THRESHOLDS,
|
|
149
|
+
...scenario.thresholds
|
|
150
|
+
};
|
|
151
|
+
const failureFallback = {
|
|
152
|
+
passed: false,
|
|
153
|
+
reason: error?.message ?? "Snapshot capture failed"
|
|
154
|
+
};
|
|
155
|
+
const thresholdResult = report && !error ? import_thresholdEvaluator.ThresholdEvaluator.evaluate(report, thresholds) : failureFallback;
|
|
156
|
+
return {
|
|
157
|
+
name: scenario.name,
|
|
158
|
+
passed: thresholdResult.passed,
|
|
159
|
+
thresholdResult,
|
|
160
|
+
report,
|
|
161
|
+
durationMs: Date.now() - startTime,
|
|
162
|
+
error
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var scenarios_exports = {};
|
|
20
|
+
__export(scenarios_exports, {
|
|
21
|
+
scenarioRegistry: () => scenarioRegistry
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(scenarios_exports);
|
|
24
|
+
var import_scenarioRegistry = require("../registry/scenarioRegistry.js");
|
|
25
|
+
var import_one_admin = require("./one-admin/index.js");
|
|
26
|
+
const scenarioRegistry = new import_scenarioRegistry.ScenarioRegistry().register({
|
|
27
|
+
microapp: "one-admin",
|
|
28
|
+
scenarios: import_one_admin.oneAdminScenarios
|
|
29
|
+
});
|