artes 1.7.4 → 1.7.6
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 +781 -779
- package/assets/styles.css +4 -4
- package/cucumber.config.js +253 -253
- package/docs/ciExecutors.md +198 -198
- package/docs/emulationDevicesList.md +152 -152
- package/docs/functionDefinitions.md +2401 -2401
- package/docs/stepDefinitions.md +435 -433
- package/executer.js +266 -264
- package/index.js +50 -50
- package/package.json +56 -56
- package/src/helper/contextManager/browserManager.js +74 -74
- package/src/helper/contextManager/requestManager.js +23 -23
- package/src/helper/controller/elementController.js +210 -210
- package/src/helper/controller/findDuplicateTestNames.js +69 -69
- package/src/helper/controller/getEnvInfo.js +94 -94
- package/src/helper/controller/getExecutor.js +109 -109
- package/src/helper/controller/pomCollector.js +83 -83
- package/src/helper/controller/reportCustomizer.js +485 -485
- package/src/helper/controller/screenComparer.js +97 -108
- package/src/helper/controller/status-formatter.js +137 -137
- package/src/helper/controller/testCoverageCalculator.js +111 -111
- package/src/helper/executers/cleaner.js +23 -23
- package/src/helper/executers/exporter.js +19 -19
- package/src/helper/executers/helper.js +193 -191
- package/src/helper/executers/projectCreator.js +226 -222
- package/src/helper/executers/reportGenerator.js +91 -91
- package/src/helper/executers/testRunner.js +28 -28
- package/src/helper/executers/versionChecker.js +31 -31
- package/src/helper/imports/commons.js +65 -65
- package/src/helper/stepFunctions/APIActions.js +495 -495
- package/src/helper/stepFunctions/assertions.js +986 -986
- package/src/helper/stepFunctions/browserActions.js +87 -87
- package/src/helper/stepFunctions/elementInteractions.js +60 -60
- package/src/helper/stepFunctions/exporter.js +19 -19
- package/src/helper/stepFunctions/frameActions.js +72 -72
- package/src/helper/stepFunctions/keyboardActions.js +66 -66
- package/src/helper/stepFunctions/mouseActions.js +84 -84
- package/src/helper/stepFunctions/pageActions.js +43 -43
- package/src/hooks/context.js +15 -15
- package/src/hooks/hooks.js +287 -279
- package/src/stepDefinitions/API.steps.js +310 -310
- package/src/stepDefinitions/assertions.steps.js +1303 -1280
- package/src/stepDefinitions/browser.steps.js +74 -74
- package/src/stepDefinitions/frameActions.steps.js +76 -76
- package/src/stepDefinitions/keyboardActions.steps.js +264 -264
- package/src/stepDefinitions/mouseActions.steps.js +378 -378
- package/src/stepDefinitions/page.steps.js +71 -71
- package/src/stepDefinitions/random.steps.js +191 -191
|
@@ -1,108 +1,97 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
require("allure-cucumberjs");
|
|
4
|
-
const allure = require("allure-js-commons");
|
|
5
|
-
const sharp = require("sharp");
|
|
6
|
-
const pixelmatch = require("pixelmatch");
|
|
7
|
-
const { PNG } = require("pngjs");
|
|
8
|
-
const { moduleConfig } = require("artes/src/helper/imports/commons");
|
|
9
|
-
|
|
10
|
-
async function screenComparer(baselineFilename, screenshotFn, options = {}) {
|
|
11
|
-
const { maxDiffPercent = 0.01, threshold = 0.1 } = options;
|
|
12
|
-
|
|
13
|
-
const baselinePath = path.join(moduleConfig.projectPath, baselineFilename);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`actual_${baselineFilename}
|
|
18
|
-
|
|
19
|
-
const diffPath = path.join(
|
|
20
|
-
moduleConfig.projectPath,
|
|
21
|
-
"visualComparison",
|
|
22
|
-
`diff_${baselineFilename}`,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const width =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
.
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
.
|
|
45
|
-
.
|
|
46
|
-
.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
diff
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
force: true,
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
if (mismatchRatio > maxDiffPercent) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
`Screenshot mismatch: ${(mismatchRatio * 100).toFixed(2)}% pixels differ (max allowed: ${maxDiffPercent * 100}%)`,
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
module.exports = { screenComparer };
|
|
1
|
+
const path = require("path");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
require("allure-cucumberjs");
|
|
4
|
+
const allure = require("allure-js-commons");
|
|
5
|
+
const sharp = require("sharp");
|
|
6
|
+
const pixelmatch = require("pixelmatch");
|
|
7
|
+
const { PNG } = require("pngjs");
|
|
8
|
+
const { moduleConfig } = require("artes/src/helper/imports/commons");
|
|
9
|
+
|
|
10
|
+
async function screenComparer(baselineFilename, screenshotFn, options = {}) {
|
|
11
|
+
const { maxDiffPercent = 0.01, threshold = 0.1, comparePath } = options;
|
|
12
|
+
|
|
13
|
+
const baselinePath = path.join(moduleConfig.projectPath, baselineFilename);
|
|
14
|
+
|
|
15
|
+
const actualPath = comparePath
|
|
16
|
+
? path.join(moduleConfig.projectPath, comparePath)
|
|
17
|
+
: path.join(moduleConfig.projectPath, "visualComparison", `actual_${baselineFilename}`);
|
|
18
|
+
|
|
19
|
+
const diffPath = path.join(
|
|
20
|
+
moduleConfig.projectPath,
|
|
21
|
+
"visualComparison",
|
|
22
|
+
`diff_${baselineFilename}`,
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const visualComparisonDir = path.join(moduleConfig.projectPath, "visualComparison");
|
|
26
|
+
if (!fs.existsSync(visualComparisonDir)) {
|
|
27
|
+
fs.mkdirSync(visualComparisonDir, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!comparePath) {
|
|
31
|
+
await screenshotFn(actualPath);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const { width, height } = await sharp(actualPath).metadata();
|
|
35
|
+
|
|
36
|
+
const baselineBuffer = await sharp(baselinePath)
|
|
37
|
+
.resize(width, height, { fit: "fill" })
|
|
38
|
+
.ensureAlpha()
|
|
39
|
+
.raw()
|
|
40
|
+
.toBuffer();
|
|
41
|
+
|
|
42
|
+
const actualBuffer = await sharp(actualPath)
|
|
43
|
+
.resize(width, height, { fit: "fill" })
|
|
44
|
+
.ensureAlpha()
|
|
45
|
+
.raw()
|
|
46
|
+
.toBuffer();
|
|
47
|
+
|
|
48
|
+
const diffImg = new PNG({ width, height });
|
|
49
|
+
|
|
50
|
+
const mismatchedPixels = pixelmatch(
|
|
51
|
+
baselineBuffer,
|
|
52
|
+
actualBuffer,
|
|
53
|
+
diffImg.data,
|
|
54
|
+
width,
|
|
55
|
+
height,
|
|
56
|
+
{ threshold, includeAA: false },
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
fs.writeFileSync(diffPath, PNG.sync.write(diffImg));
|
|
60
|
+
|
|
61
|
+
const totalPixels = width * height;
|
|
62
|
+
const mismatchRatio = mismatchedPixels / totalPixels;
|
|
63
|
+
|
|
64
|
+
const expectedBase64 = (await sharp(baselinePath).resize(width, height, { fit: "fill" }).png().toBuffer()).toString("base64");
|
|
65
|
+
const actualBase64 = (await sharp(actualPath).png().toBuffer()).toString("base64");
|
|
66
|
+
const diffBase64 = (await sharp(diffPath).png().toBuffer()).toString("base64");
|
|
67
|
+
|
|
68
|
+
const content = JSON.stringify({
|
|
69
|
+
expected: `data:image/png;base64,${expectedBase64}`,
|
|
70
|
+
actual: `data:image/png;base64,${actualBase64}`,
|
|
71
|
+
diff: `data:image/png;base64,${diffBase64}`,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
await allure.attachment(
|
|
75
|
+
"Screenshot diff details",
|
|
76
|
+
`Mismatched pixels: ${mismatchedPixels} / ${totalPixels} (${(mismatchRatio * 100).toFixed(2)}%) Max allowed: ${maxDiffPercent * 100}%`,
|
|
77
|
+
"text/plain",
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
await allure.attachment(
|
|
81
|
+
"Screenshot diff",
|
|
82
|
+
content,
|
|
83
|
+
"application/vnd.allure.image.diff",
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
if (fs.existsSync(visualComparisonDir)) {
|
|
87
|
+
fs.rmSync(visualComparisonDir, { recursive: true, force: true });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (mismatchRatio > maxDiffPercent) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Screenshot mismatch: ${(mismatchRatio * 100).toFixed(2)}% pixels differ (max allowed: ${maxDiffPercent * 100}%)`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = { screenComparer };
|
|
@@ -1,137 +1,137 @@
|
|
|
1
|
-
const { Formatter } = require("@cucumber/cucumber");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
class StatusFormatter extends Formatter {
|
|
6
|
-
constructor(options) {
|
|
7
|
-
super(options);
|
|
8
|
-
|
|
9
|
-
const outputDir = "./test-status";
|
|
10
|
-
if (!fs.existsSync(outputDir)) {
|
|
11
|
-
fs.mkdirSync(outputDir, { recursive: true });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const workerId = process.env.CUCUMBER_WORKER_ID || "0";
|
|
15
|
-
this.workerId = workerId;
|
|
16
|
-
this.outputFile = path.join(outputDir, `test-results-${workerId}.txt`);
|
|
17
|
-
this.outputDir = outputDir;
|
|
18
|
-
|
|
19
|
-
fs.writeFileSync(this.outputFile, "", "utf8");
|
|
20
|
-
|
|
21
|
-
this.pickles = new Map();
|
|
22
|
-
this.testCases = new Map();
|
|
23
|
-
this.testCaseStartedIdToAttempt = new Map();
|
|
24
|
-
|
|
25
|
-
const { eventBroadcaster } = options;
|
|
26
|
-
|
|
27
|
-
eventBroadcaster.on("envelope", (envelope) => {
|
|
28
|
-
if (envelope.pickle) {
|
|
29
|
-
this.pickles.set(envelope.pickle.id, envelope.pickle);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (envelope.testCase) {
|
|
33
|
-
this.testCases.set(envelope.testCase.id, envelope.testCase);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (envelope.testCaseStarted) {
|
|
37
|
-
this.testCaseStartedIdToAttempt.set(
|
|
38
|
-
envelope.testCaseStarted.id,
|
|
39
|
-
envelope.testCaseStarted.testCaseId,
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (envelope.testCaseFinished) {
|
|
44
|
-
this.handleTestCaseFinished(envelope.testCaseFinished);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (envelope.testRunFinished) {
|
|
48
|
-
this.handleTestRunFinished();
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
getFormattedTimestamp() {
|
|
54
|
-
const now = new Date();
|
|
55
|
-
const YYYY = now.getFullYear();
|
|
56
|
-
const MM = String(now.getMonth() + 1).padStart(2, "0");
|
|
57
|
-
const DD = String(now.getDate()).padStart(2, "0");
|
|
58
|
-
const hh = String(now.getHours()).padStart(2, "0");
|
|
59
|
-
const mm = String(now.getMinutes()).padStart(2, "0");
|
|
60
|
-
const ss = String(now.getSeconds()).padStart(2, "0");
|
|
61
|
-
const ms = String(now.getMilliseconds()).padStart(3, "0");
|
|
62
|
-
|
|
63
|
-
return `${YYYY}${MM}${DD}-${hh}${mm}${ss}-${ms}`;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
handleTestCaseFinished(testCaseFinished) {
|
|
67
|
-
try {
|
|
68
|
-
const timestamp = this.getFormattedTimestamp();
|
|
69
|
-
|
|
70
|
-
const testCaseId = this.testCaseStartedIdToAttempt.get(
|
|
71
|
-
testCaseFinished.testCaseStartedId,
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
if (!testCaseId) return;
|
|
75
|
-
|
|
76
|
-
const testCase = this.testCases.get(testCaseId);
|
|
77
|
-
if (!testCase) return;
|
|
78
|
-
|
|
79
|
-
const pickle = this.pickles.get(testCase.pickleId);
|
|
80
|
-
if (!pickle) return;
|
|
81
|
-
|
|
82
|
-
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(
|
|
83
|
-
testCaseFinished.testCaseStartedId,
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
const status = testCaseAttempt?.worstTestStepResult?.status || "UNKNOWN";
|
|
87
|
-
|
|
88
|
-
const info = {
|
|
89
|
-
name: pickle.name,
|
|
90
|
-
id: pickle.id,
|
|
91
|
-
uri: pickle.uri,
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const line = `${timestamp} | ${status.toUpperCase()} | ${info.name} | ${info.id} | ${info.uri}\n`;
|
|
95
|
-
|
|
96
|
-
fs.appendFileSync(this.outputFile, line, "utf8");
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error("Error in handleTestCaseFinished:", error);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
handleTestRunFinished() {
|
|
103
|
-
if (this.workerId !== "0") {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
setTimeout(() => {
|
|
108
|
-
this.mergeResults();
|
|
109
|
-
}, 1000);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
mergeResults() {
|
|
113
|
-
try {
|
|
114
|
-
const testStatusFile = path.join(this.outputDir, "test-status.txt");
|
|
115
|
-
|
|
116
|
-
const files = fs
|
|
117
|
-
.readdirSync(this.outputDir)
|
|
118
|
-
.filter((f) => f.startsWith("test-results-") && f.endsWith(".txt"))
|
|
119
|
-
.sort();
|
|
120
|
-
|
|
121
|
-
if (files.length === 0) {
|
|
122
|
-
console.log("No result files found to merge");
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const combined = files
|
|
127
|
-
.map((f) => fs.readFileSync(path.join(this.outputDir, f), "utf8"))
|
|
128
|
-
.join("");
|
|
129
|
-
|
|
130
|
-
fs.writeFileSync(testStatusFile, combined, "utf8");
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error("Error merging results:", error);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
module.exports = StatusFormatter;
|
|
1
|
+
const { Formatter } = require("@cucumber/cucumber");
|
|
2
|
+
const fs = require("fs");
|
|
3
|
+
const path = require("path");
|
|
4
|
+
|
|
5
|
+
class StatusFormatter extends Formatter {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(options);
|
|
8
|
+
|
|
9
|
+
const outputDir = "./test-status";
|
|
10
|
+
if (!fs.existsSync(outputDir)) {
|
|
11
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const workerId = process.env.CUCUMBER_WORKER_ID || "0";
|
|
15
|
+
this.workerId = workerId;
|
|
16
|
+
this.outputFile = path.join(outputDir, `test-results-${workerId}.txt`);
|
|
17
|
+
this.outputDir = outputDir;
|
|
18
|
+
|
|
19
|
+
fs.writeFileSync(this.outputFile, "", "utf8");
|
|
20
|
+
|
|
21
|
+
this.pickles = new Map();
|
|
22
|
+
this.testCases = new Map();
|
|
23
|
+
this.testCaseStartedIdToAttempt = new Map();
|
|
24
|
+
|
|
25
|
+
const { eventBroadcaster } = options;
|
|
26
|
+
|
|
27
|
+
eventBroadcaster.on("envelope", (envelope) => {
|
|
28
|
+
if (envelope.pickle) {
|
|
29
|
+
this.pickles.set(envelope.pickle.id, envelope.pickle);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (envelope.testCase) {
|
|
33
|
+
this.testCases.set(envelope.testCase.id, envelope.testCase);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (envelope.testCaseStarted) {
|
|
37
|
+
this.testCaseStartedIdToAttempt.set(
|
|
38
|
+
envelope.testCaseStarted.id,
|
|
39
|
+
envelope.testCaseStarted.testCaseId,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (envelope.testCaseFinished) {
|
|
44
|
+
this.handleTestCaseFinished(envelope.testCaseFinished);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (envelope.testRunFinished) {
|
|
48
|
+
this.handleTestRunFinished();
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
getFormattedTimestamp() {
|
|
54
|
+
const now = new Date();
|
|
55
|
+
const YYYY = now.getFullYear();
|
|
56
|
+
const MM = String(now.getMonth() + 1).padStart(2, "0");
|
|
57
|
+
const DD = String(now.getDate()).padStart(2, "0");
|
|
58
|
+
const hh = String(now.getHours()).padStart(2, "0");
|
|
59
|
+
const mm = String(now.getMinutes()).padStart(2, "0");
|
|
60
|
+
const ss = String(now.getSeconds()).padStart(2, "0");
|
|
61
|
+
const ms = String(now.getMilliseconds()).padStart(3, "0");
|
|
62
|
+
|
|
63
|
+
return `${YYYY}${MM}${DD}-${hh}${mm}${ss}-${ms}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
handleTestCaseFinished(testCaseFinished) {
|
|
67
|
+
try {
|
|
68
|
+
const timestamp = this.getFormattedTimestamp();
|
|
69
|
+
|
|
70
|
+
const testCaseId = this.testCaseStartedIdToAttempt.get(
|
|
71
|
+
testCaseFinished.testCaseStartedId,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
if (!testCaseId) return;
|
|
75
|
+
|
|
76
|
+
const testCase = this.testCases.get(testCaseId);
|
|
77
|
+
if (!testCase) return;
|
|
78
|
+
|
|
79
|
+
const pickle = this.pickles.get(testCase.pickleId);
|
|
80
|
+
if (!pickle) return;
|
|
81
|
+
|
|
82
|
+
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(
|
|
83
|
+
testCaseFinished.testCaseStartedId,
|
|
84
|
+
);
|
|
85
|
+
|
|
86
|
+
const status = testCaseAttempt?.worstTestStepResult?.status || "UNKNOWN";
|
|
87
|
+
|
|
88
|
+
const info = {
|
|
89
|
+
name: pickle.name,
|
|
90
|
+
id: pickle.id,
|
|
91
|
+
uri: pickle.uri,
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const line = `${timestamp} | ${status.toUpperCase()} | ${info.name} | ${info.id} | ${info.uri}\n`;
|
|
95
|
+
|
|
96
|
+
fs.appendFileSync(this.outputFile, line, "utf8");
|
|
97
|
+
} catch (error) {
|
|
98
|
+
console.error("Error in handleTestCaseFinished:", error);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
handleTestRunFinished() {
|
|
103
|
+
if (this.workerId !== "0") {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
this.mergeResults();
|
|
109
|
+
}, 1000);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
mergeResults() {
|
|
113
|
+
try {
|
|
114
|
+
const testStatusFile = path.join(this.outputDir, "test-status.txt");
|
|
115
|
+
|
|
116
|
+
const files = fs
|
|
117
|
+
.readdirSync(this.outputDir)
|
|
118
|
+
.filter((f) => f.startsWith("test-results-") && f.endsWith(".txt"))
|
|
119
|
+
.sort();
|
|
120
|
+
|
|
121
|
+
if (files.length === 0) {
|
|
122
|
+
console.log("No result files found to merge");
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const combined = files
|
|
127
|
+
.map((f) => fs.readFileSync(path.join(this.outputDir, f), "utf8"))
|
|
128
|
+
.join("");
|
|
129
|
+
|
|
130
|
+
fs.writeFileSync(testStatusFile, combined, "utf8");
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error("Error merging results:", error);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
module.exports = StatusFormatter;
|