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.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,80 @@ 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
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
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 testName = test.title[test.title.length - 1];
|
|
1020
|
+
const fullTestTitle = test.title.join(", ");
|
|
1021
|
+
const screenshotPaths = [
|
|
1022
|
+
// Mochawesome report assets location with full title
|
|
1023
|
+
path2.join(
|
|
1024
|
+
process.cwd(),
|
|
1025
|
+
"cypress/reports/assets",
|
|
1026
|
+
testFileName,
|
|
1027
|
+
`${fullTestTitle} -- ${testName} (failed).png`
|
|
1028
|
+
),
|
|
1029
|
+
// Alternative: without full title path
|
|
1030
|
+
path2.join(
|
|
1031
|
+
process.cwd(),
|
|
1032
|
+
"cypress/reports/assets",
|
|
1033
|
+
testFileName,
|
|
1034
|
+
`${testName} (failed).png`
|
|
1035
|
+
),
|
|
1036
|
+
// Legacy cypress/screenshots location
|
|
1037
|
+
path2.join(
|
|
1038
|
+
process.cwd(),
|
|
1039
|
+
"cypress/screenshots",
|
|
1040
|
+
`${testFileName} -- ${testName} (failed).png`
|
|
1041
|
+
)
|
|
1042
|
+
];
|
|
1043
|
+
let screenshotFound = false;
|
|
1044
|
+
for (const screenshotPath of screenshotPaths) {
|
|
1045
|
+
if (fs2.existsSync(screenshotPath)) {
|
|
1046
|
+
try {
|
|
1047
|
+
const screenshotContent = fs2.readFileSync(screenshotPath);
|
|
1048
|
+
testResult.attachments.push({
|
|
1049
|
+
id: v4(),
|
|
1050
|
+
name: "screenshot",
|
|
1051
|
+
type: "image/png",
|
|
1052
|
+
extension: "png",
|
|
1053
|
+
content: screenshotContent.toString("base64"),
|
|
1054
|
+
size: screenshotContent.length,
|
|
1055
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1056
|
+
});
|
|
1057
|
+
console.log("[QAagentic] Added screenshot for:", testName);
|
|
1058
|
+
screenshotFound = true;
|
|
1059
|
+
break;
|
|
1060
|
+
} catch (err) {
|
|
1061
|
+
console.warn("[QAagentic] Failed to read screenshot:", err);
|
|
1067
1062
|
}
|
|
1068
1063
|
}
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1064
|
+
}
|
|
1065
|
+
if (!screenshotFound) {
|
|
1066
|
+
console.log("[QAagentic] No screenshot found for:", testName);
|
|
1072
1067
|
}
|
|
1073
1068
|
}
|
|
1074
|
-
this.failedTestResults = [];
|
|
1075
1069
|
}
|
|
1076
1070
|
async sendPendingTests() {
|
|
1077
1071
|
console.log("[QAagentic] Sending", this.pendingTests.length, "pending tests to API");
|
|
1078
|
-
for (const testResult of this.pendingTests) {
|
|
1072
|
+
for (const { testResult } of this.pendingTests) {
|
|
1079
1073
|
await this.reporter.reportTest(testResult);
|
|
1080
1074
|
}
|
|
1081
1075
|
this.pendingTests = [];
|