qagentic-reporter 0.1.37 → 0.1.38
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 +56 -62
- package/dist/cypress/index.js.map +1 -1
- package/dist/cypress/index.mjs +56 -62
- package/dist/cypress/index.mjs.map +1 -1
- package/dist/cypress/simple-setup.js +56 -62
- package/dist/cypress/simple-setup.js.map +1 -1
- package/dist/cypress/simple-setup.mjs +56 -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,80 @@ 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
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
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 testName = test.title[test.title.length - 1];
|
|
1048
|
+
const fullTestTitle = test.title.join(", ");
|
|
1049
|
+
const screenshotPaths = [
|
|
1050
|
+
// Mochawesome report assets location with full title
|
|
1051
|
+
path2__namespace.join(
|
|
1052
|
+
process.cwd(),
|
|
1053
|
+
"cypress/reports/assets",
|
|
1054
|
+
testFileName,
|
|
1055
|
+
`${fullTestTitle} -- ${testName} (failed).png`
|
|
1056
|
+
),
|
|
1057
|
+
// Alternative: without full title path
|
|
1058
|
+
path2__namespace.join(
|
|
1059
|
+
process.cwd(),
|
|
1060
|
+
"cypress/reports/assets",
|
|
1061
|
+
testFileName,
|
|
1062
|
+
`${testName} (failed).png`
|
|
1063
|
+
),
|
|
1064
|
+
// Legacy cypress/screenshots location
|
|
1065
|
+
path2__namespace.join(
|
|
1066
|
+
process.cwd(),
|
|
1067
|
+
"cypress/screenshots",
|
|
1068
|
+
`${testFileName} -- ${testName} (failed).png`
|
|
1069
|
+
)
|
|
1070
|
+
];
|
|
1071
|
+
let screenshotFound = false;
|
|
1072
|
+
for (const screenshotPath of screenshotPaths) {
|
|
1073
|
+
if (fs2__namespace.existsSync(screenshotPath)) {
|
|
1074
|
+
try {
|
|
1075
|
+
const screenshotContent = fs2__namespace.readFileSync(screenshotPath);
|
|
1076
|
+
testResult.attachments.push({
|
|
1077
|
+
id: uuid.v4(),
|
|
1078
|
+
name: "screenshot",
|
|
1079
|
+
type: "image/png",
|
|
1080
|
+
extension: "png",
|
|
1081
|
+
content: screenshotContent.toString("base64"),
|
|
1082
|
+
size: screenshotContent.length,
|
|
1083
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1084
|
+
});
|
|
1085
|
+
console.log("[QAagentic] Added screenshot for:", testName);
|
|
1086
|
+
screenshotFound = true;
|
|
1087
|
+
break;
|
|
1088
|
+
} catch (err) {
|
|
1089
|
+
console.warn("[QAagentic] Failed to read screenshot:", err);
|
|
1095
1090
|
}
|
|
1096
1091
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1092
|
+
}
|
|
1093
|
+
if (!screenshotFound) {
|
|
1094
|
+
console.log("[QAagentic] No screenshot found for:", testName);
|
|
1100
1095
|
}
|
|
1101
1096
|
}
|
|
1102
|
-
this.failedTestResults = [];
|
|
1103
1097
|
}
|
|
1104
1098
|
async sendPendingTests() {
|
|
1105
1099
|
console.log("[QAagentic] Sending", this.pendingTests.length, "pending tests to API");
|
|
1106
|
-
for (const testResult of this.pendingTests) {
|
|
1100
|
+
for (const { testResult } of this.pendingTests) {
|
|
1107
1101
|
await this.reporter.reportTest(testResult);
|
|
1108
1102
|
}
|
|
1109
1103
|
this.pendingTests = [];
|