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.mjs
CHANGED
|
@@ -911,7 +911,6 @@ var QAgenticCypressReporter = class {
|
|
|
911
911
|
end: /* @__PURE__ */ new Date(),
|
|
912
912
|
duration: 0
|
|
913
913
|
};
|
|
914
|
-
this.failedTestResults = [];
|
|
915
914
|
this.pendingTests = [];
|
|
916
915
|
this.projectName = process.env.QAGENTIC_PROJECT_NAME || config.projectId || "Cypress E2E Tests";
|
|
917
916
|
this.environment = process.env.QAGENTIC_ENVIRONMENT || process.env.NODE_ENV || "e2e";
|
|
@@ -997,85 +996,73 @@ var QAgenticCypressReporter = class {
|
|
|
997
996
|
type: testResult.errorType,
|
|
998
997
|
hasStackTrace: !!testResult.stackTrace
|
|
999
998
|
});
|
|
1000
|
-
this.failedTestResults.push({
|
|
1001
|
-
testResult,
|
|
1002
|
-
test
|
|
1003
|
-
});
|
|
1004
999
|
}
|
|
1005
1000
|
this.stats.tests++;
|
|
1006
1001
|
if (test.state === "passed") this.stats.passes++;
|
|
1007
1002
|
if (test.state === "failed") this.stats.failures++;
|
|
1008
1003
|
if (test.state === "pending") this.stats.pending++;
|
|
1009
|
-
this.pendingTests.push(
|
|
1004
|
+
this.pendingTests.push({
|
|
1005
|
+
testResult,
|
|
1006
|
+
test
|
|
1007
|
+
});
|
|
1010
1008
|
} catch (error) {
|
|
1011
1009
|
console.warn("[QAagentic] Failed to report test:", error);
|
|
1012
1010
|
}
|
|
1013
1011
|
}
|
|
1014
1012
|
async attachScreenshots() {
|
|
1015
1013
|
console.log("[QAagentic] Attaching screenshots to pending tests, count:", this.pendingTests.length);
|
|
1016
|
-
for (const testResult of this.pendingTests) {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
size: screenshotContent.length,
|
|
1058
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1059
|
-
};
|
|
1060
|
-
testResult.attachments.push(attachment);
|
|
1061
|
-
console.log("[QAagentic] Added screenshot attachment:", screenshotPath);
|
|
1062
|
-
screenshotFound = true;
|
|
1063
|
-
break;
|
|
1064
|
-
} catch (err) {
|
|
1065
|
-
console.warn("[QAagentic] Failed to read screenshot:", err);
|
|
1066
|
-
}
|
|
1014
|
+
for (const { testResult, test } of this.pendingTests) {
|
|
1015
|
+
if (test.state !== "failed" || !test.invocationDetails?.relativeFile) {
|
|
1016
|
+
continue;
|
|
1017
|
+
}
|
|
1018
|
+
const testFileName = test.invocationDetails.relativeFile.replace(/\.ts$/, "");
|
|
1019
|
+
const fullTestTitle = test.title.join(" -- ");
|
|
1020
|
+
const screenshotPaths = [
|
|
1021
|
+
// Mochawesome report assets location - most recent screenshot (no attempt number)
|
|
1022
|
+
path2.join(
|
|
1023
|
+
process.cwd(),
|
|
1024
|
+
"cypress/reports/assets",
|
|
1025
|
+
testFileName,
|
|
1026
|
+
`${fullTestTitle} (failed).png`
|
|
1027
|
+
),
|
|
1028
|
+
// With attempt number (fallback)
|
|
1029
|
+
path2.join(
|
|
1030
|
+
process.cwd(),
|
|
1031
|
+
"cypress/reports/assets",
|
|
1032
|
+
testFileName,
|
|
1033
|
+
`${fullTestTitle} (failed) (attempt 1).png`
|
|
1034
|
+
)
|
|
1035
|
+
];
|
|
1036
|
+
let screenshotFound = false;
|
|
1037
|
+
for (const screenshotPath of screenshotPaths) {
|
|
1038
|
+
if (fs2.existsSync(screenshotPath)) {
|
|
1039
|
+
try {
|
|
1040
|
+
const screenshotContent = fs2.readFileSync(screenshotPath);
|
|
1041
|
+
testResult.attachments.push({
|
|
1042
|
+
id: v4(),
|
|
1043
|
+
name: "screenshot",
|
|
1044
|
+
type: "image/png",
|
|
1045
|
+
extension: "png",
|
|
1046
|
+
content: screenshotContent.toString("base64"),
|
|
1047
|
+
size: screenshotContent.length,
|
|
1048
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1049
|
+
});
|
|
1050
|
+
console.log("[QAagentic] Added screenshot for:", fullTestTitle);
|
|
1051
|
+
screenshotFound = true;
|
|
1052
|
+
break;
|
|
1053
|
+
} catch (err) {
|
|
1054
|
+
console.warn("[QAagentic] Failed to read screenshot:", err);
|
|
1067
1055
|
}
|
|
1068
1056
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1057
|
+
}
|
|
1058
|
+
if (!screenshotFound) {
|
|
1059
|
+
console.log("[QAagentic] No screenshot found for:", fullTestTitle);
|
|
1072
1060
|
}
|
|
1073
1061
|
}
|
|
1074
|
-
this.failedTestResults = [];
|
|
1075
1062
|
}
|
|
1076
1063
|
async sendPendingTests() {
|
|
1077
1064
|
console.log("[QAagentic] Sending", this.pendingTests.length, "pending tests to API");
|
|
1078
|
-
for (const testResult of this.pendingTests) {
|
|
1065
|
+
for (const { testResult } of this.pendingTests) {
|
|
1079
1066
|
await this.reporter.reportTest(testResult);
|
|
1080
1067
|
}
|
|
1081
1068
|
this.pendingTests = [];
|