qagentic-reporter 0.1.37 → 0.1.39
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/dist/cypress/index.js +49 -62
- package/dist/cypress/index.js.map +1 -1
- package/dist/cypress/index.mjs +49 -62
- package/dist/cypress/index.mjs.map +1 -1
- package/dist/cypress/simple-setup.js +49 -62
- package/dist/cypress/simple-setup.js.map +1 -1
- package/dist/cypress/simple-setup.mjs +49 -62
- package/dist/cypress/simple-setup.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cypress/index.js
CHANGED
|
@@ -939,7 +939,6 @@ var QAgenticCypressReporter = class {
|
|
|
939
939
|
end: /* @__PURE__ */ new Date(),
|
|
940
940
|
duration: 0
|
|
941
941
|
};
|
|
942
|
-
this.failedTestResults = [];
|
|
943
942
|
this.pendingTests = [];
|
|
944
943
|
this.projectName = process.env.QAGENTIC_PROJECT_NAME || config.projectId || "Cypress E2E Tests";
|
|
945
944
|
this.environment = process.env.QAGENTIC_ENVIRONMENT || process.env.NODE_ENV || "e2e";
|
|
@@ -1025,85 +1024,73 @@ var QAgenticCypressReporter = class {
|
|
|
1025
1024
|
type: testResult.errorType,
|
|
1026
1025
|
hasStackTrace: !!testResult.stackTrace
|
|
1027
1026
|
});
|
|
1028
|
-
this.failedTestResults.push({
|
|
1029
|
-
testResult,
|
|
1030
|
-
test
|
|
1031
|
-
});
|
|
1032
1027
|
}
|
|
1033
1028
|
this.stats.tests++;
|
|
1034
1029
|
if (test.state === "passed") this.stats.passes++;
|
|
1035
1030
|
if (test.state === "failed") this.stats.failures++;
|
|
1036
1031
|
if (test.state === "pending") this.stats.pending++;
|
|
1037
|
-
this.pendingTests.push(
|
|
1032
|
+
this.pendingTests.push({
|
|
1033
|
+
testResult,
|
|
1034
|
+
test
|
|
1035
|
+
});
|
|
1038
1036
|
} catch (error) {
|
|
1039
1037
|
console.warn("[QAagentic] Failed to report test:", error);
|
|
1040
1038
|
}
|
|
1041
1039
|
}
|
|
1042
1040
|
async attachScreenshots() {
|
|
1043
1041
|
console.log("[QAagentic] Attaching screenshots to pending tests, count:", this.pendingTests.length);
|
|
1044
|
-
for (const testResult of this.pendingTests) {
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
size: screenshotContent.length,
|
|
1086
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1087
|
-
};
|
|
1088
|
-
testResult.attachments.push(attachment);
|
|
1089
|
-
console.log("[QAagentic] Added screenshot attachment:", screenshotPath);
|
|
1090
|
-
screenshotFound = true;
|
|
1091
|
-
break;
|
|
1092
|
-
} catch (err) {
|
|
1093
|
-
console.warn("[QAagentic] Failed to read screenshot:", err);
|
|
1094
|
-
}
|
|
1042
|
+
for (const { testResult, test } of this.pendingTests) {
|
|
1043
|
+
if (test.state !== "failed" || !test.invocationDetails?.relativeFile) {
|
|
1044
|
+
continue;
|
|
1045
|
+
}
|
|
1046
|
+
const testFileName = test.invocationDetails.relativeFile.replace(/\.ts$/, "");
|
|
1047
|
+
const fullTestTitle = test.title.join(" -- ");
|
|
1048
|
+
const screenshotPaths = [
|
|
1049
|
+
// Mochawesome report assets location - most recent screenshot (no attempt number)
|
|
1050
|
+
path2__namespace.join(
|
|
1051
|
+
process.cwd(),
|
|
1052
|
+
"cypress/reports/assets",
|
|
1053
|
+
testFileName,
|
|
1054
|
+
`${fullTestTitle} (failed).png`
|
|
1055
|
+
),
|
|
1056
|
+
// With attempt number (fallback)
|
|
1057
|
+
path2__namespace.join(
|
|
1058
|
+
process.cwd(),
|
|
1059
|
+
"cypress/reports/assets",
|
|
1060
|
+
testFileName,
|
|
1061
|
+
`${fullTestTitle} (failed) (attempt 1).png`
|
|
1062
|
+
)
|
|
1063
|
+
];
|
|
1064
|
+
let screenshotFound = false;
|
|
1065
|
+
for (const screenshotPath of screenshotPaths) {
|
|
1066
|
+
if (fs2__namespace.existsSync(screenshotPath)) {
|
|
1067
|
+
try {
|
|
1068
|
+
const screenshotContent = fs2__namespace.readFileSync(screenshotPath);
|
|
1069
|
+
testResult.attachments.push({
|
|
1070
|
+
id: uuid.v4(),
|
|
1071
|
+
name: "screenshot",
|
|
1072
|
+
type: "image/png",
|
|
1073
|
+
extension: "png",
|
|
1074
|
+
content: screenshotContent.toString("base64"),
|
|
1075
|
+
size: screenshotContent.length,
|
|
1076
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1077
|
+
});
|
|
1078
|
+
console.log("[QAagentic] Added screenshot for:", fullTestTitle);
|
|
1079
|
+
screenshotFound = true;
|
|
1080
|
+
break;
|
|
1081
|
+
} catch (err) {
|
|
1082
|
+
console.warn("[QAagentic] Failed to read screenshot:", err);
|
|
1095
1083
|
}
|
|
1096
1084
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1085
|
+
}
|
|
1086
|
+
if (!screenshotFound) {
|
|
1087
|
+
console.log("[QAagentic] No screenshot found for:", fullTestTitle);
|
|
1100
1088
|
}
|
|
1101
1089
|
}
|
|
1102
|
-
this.failedTestResults = [];
|
|
1103
1090
|
}
|
|
1104
1091
|
async sendPendingTests() {
|
|
1105
1092
|
console.log("[QAagentic] Sending", this.pendingTests.length, "pending tests to API");
|
|
1106
|
-
for (const testResult of this.pendingTests) {
|
|
1093
|
+
for (const { testResult } of this.pendingTests) {
|
|
1107
1094
|
await this.reporter.reportTest(testResult);
|
|
1108
1095
|
}
|
|
1109
1096
|
this.pendingTests = [];
|