qagentic-reporter 0.1.14 → 0.1.16
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.d.mts +1 -1
- package/dist/cypress/index.d.ts +1 -1
- package/dist/cypress/index.js +113 -90
- package/dist/cypress/index.js.map +1 -1
- package/dist/cypress/index.mjs +113 -90
- package/dist/cypress/index.mjs.map +1 -1
- package/dist/cypress/simple-setup.d.mts +1 -6
- package/dist/cypress/simple-setup.d.ts +1 -6
- package/dist/cypress/simple-setup.js +114 -95
- package/dist/cypress/simple-setup.js.map +1 -1
- package/dist/cypress/simple-setup.mjs +115 -93
- package/dist/cypress/simple-setup.mjs.map +1 -1
- package/dist/index.js +26 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -12
- package/dist/index.mjs.map +1 -1
- package/dist/jest/index.js +26 -12
- package/dist/jest/index.js.map +1 -1
- package/dist/jest/index.mjs +26 -12
- package/dist/jest/index.mjs.map +1 -1
- package/dist/playwright/index.js +26 -12
- package/dist/playwright/index.js.map +1 -1
- package/dist/playwright/index.mjs +26 -12
- package/dist/playwright/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cypress/index.mjs
CHANGED
|
@@ -428,18 +428,28 @@ var APIReporter = class {
|
|
|
428
428
|
if (!this.config.api.enabled) return;
|
|
429
429
|
await this.flushBatch();
|
|
430
430
|
try {
|
|
431
|
-
|
|
431
|
+
console.log("[APIReporter] Finalizing run with test counts:", {
|
|
432
|
+
total: run.total,
|
|
433
|
+
passed: run.passed,
|
|
434
|
+
failed: run.failed,
|
|
435
|
+
broken: run.broken,
|
|
436
|
+
skipped: run.skipped
|
|
437
|
+
});
|
|
438
|
+
const patchData = {
|
|
439
|
+
end_time: run.endTime?.toISOString(),
|
|
440
|
+
duration_ms: run.durationMs,
|
|
441
|
+
total: run.total,
|
|
442
|
+
passed: run.passed,
|
|
443
|
+
failed: run.failed,
|
|
444
|
+
broken: run.broken,
|
|
445
|
+
skipped: run.skipped,
|
|
446
|
+
status: "completed"
|
|
447
|
+
};
|
|
448
|
+
console.log("[APIReporter] PATCH to:", `${this.config.api.url}/api/v1/runs/${run.id}`);
|
|
449
|
+
console.log("[APIReporter] PATCH data:", patchData);
|
|
450
|
+
const response = await axios.patch(
|
|
432
451
|
`${this.config.api.url}/api/v1/runs/${run.id}`,
|
|
433
|
-
|
|
434
|
-
end_time: run.endTime?.toISOString(),
|
|
435
|
-
duration_ms: run.durationMs,
|
|
436
|
-
total: run.total,
|
|
437
|
-
passed: run.passed,
|
|
438
|
-
failed: run.failed,
|
|
439
|
-
broken: run.broken,
|
|
440
|
-
skipped: run.skipped,
|
|
441
|
-
status: "completed"
|
|
442
|
-
},
|
|
452
|
+
patchData,
|
|
443
453
|
{
|
|
444
454
|
headers: {
|
|
445
455
|
"Content-Type": "application/json",
|
|
@@ -448,8 +458,12 @@ var APIReporter = class {
|
|
|
448
458
|
timeout: this.config.api.timeout
|
|
449
459
|
}
|
|
450
460
|
);
|
|
461
|
+
console.log("[APIReporter] Run finalized successfully:", response.status);
|
|
451
462
|
} catch (error) {
|
|
452
|
-
console.warn("
|
|
463
|
+
console.warn("[APIReporter] Failed to finalize run with API:");
|
|
464
|
+
console.warn(" Error:", error.message);
|
|
465
|
+
console.warn(" Status:", error.response?.status);
|
|
466
|
+
console.warn(" Data:", error.response?.data);
|
|
453
467
|
}
|
|
454
468
|
}
|
|
455
469
|
async reportTest(test) {
|
|
@@ -851,94 +865,103 @@ function attachJson(data, name = "JSON Data") {
|
|
|
851
865
|
function attachText(text, name = "Text") {
|
|
852
866
|
return attach(text, name, "text/plain", "txt");
|
|
853
867
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
868
|
+
var QAgenticCypressReporter = class {
|
|
869
|
+
constructor(config) {
|
|
870
|
+
this.currentRun = null;
|
|
871
|
+
this.stats = {
|
|
872
|
+
suites: 0,
|
|
873
|
+
tests: 0,
|
|
874
|
+
passes: 0,
|
|
875
|
+
pending: 0,
|
|
876
|
+
failures: 0,
|
|
877
|
+
start: /* @__PURE__ */ new Date(),
|
|
878
|
+
end: /* @__PURE__ */ new Date(),
|
|
879
|
+
duration: 0
|
|
880
|
+
};
|
|
881
|
+
this.projectName = process.env.QAGENTIC_PROJECT_NAME || config.projectId || "Cypress E2E Tests";
|
|
882
|
+
this.environment = process.env.QAGENTIC_ENVIRONMENT || process.env.NODE_ENV || "e2e";
|
|
883
|
+
const apiUrl = process.env.QAGENTIC_API_URL || "http://localhost:8080";
|
|
884
|
+
configure({
|
|
885
|
+
projectName: this.projectName,
|
|
886
|
+
environment: this.environment,
|
|
887
|
+
apiUrl,
|
|
888
|
+
outputDir: "./qagentic-results"
|
|
889
|
+
});
|
|
890
|
+
this.reporter = QAgenticReporter.getInstance();
|
|
891
|
+
this.stats.start = /* @__PURE__ */ new Date();
|
|
892
|
+
}
|
|
893
|
+
async onRunBegin() {
|
|
869
894
|
try {
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
895
|
+
this.currentRun = await this.reporter.startRun({
|
|
896
|
+
name: this.projectName,
|
|
897
|
+
projectName: this.projectName,
|
|
898
|
+
environment: this.environment,
|
|
899
|
+
startTime: this.stats.start
|
|
875
900
|
});
|
|
876
|
-
console.log("[QAagentic] Test run started successfully:", currentRun?.id);
|
|
877
901
|
} catch (error) {
|
|
878
902
|
console.warn("[QAagentic] Failed to start run:", error);
|
|
879
903
|
}
|
|
880
|
-
}
|
|
881
|
-
|
|
904
|
+
}
|
|
905
|
+
async onTestEnd(test) {
|
|
906
|
+
if (!this.currentRun) return;
|
|
882
907
|
try {
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
isRetry: false,
|
|
909
|
-
isFlaky: false
|
|
910
|
-
};
|
|
911
|
-
if (test.err) {
|
|
912
|
-
testResult.errorMessage = test.err.message;
|
|
913
|
-
testResult.stackTrace = test.err.stack;
|
|
914
|
-
testResult.errorType = "AssertionError";
|
|
915
|
-
}
|
|
916
|
-
console.log("[QAagentic] Reporting test:", testResult.name, "-", testResult.status);
|
|
917
|
-
await reporter.reportTest(testResult);
|
|
918
|
-
} catch (error) {
|
|
919
|
-
console.warn("[QAagentic] Failed to report test:", error);
|
|
920
|
-
}
|
|
908
|
+
const testResult = {
|
|
909
|
+
id: v4(),
|
|
910
|
+
name: test.title[test.title.length - 1],
|
|
911
|
+
fullName: test.title.join(" > "),
|
|
912
|
+
status: parseStatus(test.state),
|
|
913
|
+
durationMs: test.duration,
|
|
914
|
+
startTime: new Date(Date.now() - test.duration),
|
|
915
|
+
endTime: /* @__PURE__ */ new Date(),
|
|
916
|
+
labels: {
|
|
917
|
+
suite: test.title.slice(0, -1).join(" > "),
|
|
918
|
+
feature: test.title[0]
|
|
919
|
+
},
|
|
920
|
+
links: [],
|
|
921
|
+
parameters: {},
|
|
922
|
+
steps: [],
|
|
923
|
+
attachments: [],
|
|
924
|
+
filePath: test.invocationDetails?.relativeFile || "",
|
|
925
|
+
retryCount: 0,
|
|
926
|
+
isRetry: false,
|
|
927
|
+
isFlaky: false
|
|
928
|
+
};
|
|
929
|
+
if (test.err) {
|
|
930
|
+
testResult.errorMessage = test.err.message;
|
|
931
|
+
testResult.stackTrace = test.err.stack;
|
|
932
|
+
testResult.errorType = "AssertionError";
|
|
921
933
|
}
|
|
922
|
-
|
|
934
|
+
this.stats.tests++;
|
|
935
|
+
if (test.state === "passed") this.stats.passes++;
|
|
936
|
+
if (test.state === "failed") this.stats.failures++;
|
|
937
|
+
if (test.state === "pending") this.stats.pending++;
|
|
938
|
+
await this.reporter.reportTest(testResult);
|
|
923
939
|
} catch (error) {
|
|
924
|
-
console.warn("[QAagentic]
|
|
940
|
+
console.warn("[QAagentic] Failed to report test:", error);
|
|
925
941
|
}
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
942
|
+
}
|
|
943
|
+
async onRunEnd() {
|
|
944
|
+
if (!this.currentRun) return;
|
|
945
|
+
try {
|
|
946
|
+
this.stats.end = /* @__PURE__ */ new Date();
|
|
947
|
+
this.stats.duration = this.stats.end.getTime() - this.stats.start.getTime();
|
|
948
|
+
this.currentRun.endTime = this.stats.end;
|
|
949
|
+
this.currentRun.durationMs = this.stats.duration;
|
|
950
|
+
this.currentRun.total = this.stats.tests;
|
|
951
|
+
this.currentRun.passed = this.stats.passes;
|
|
952
|
+
this.currentRun.failed = this.stats.failures;
|
|
953
|
+
this.currentRun.skipped = this.stats.pending;
|
|
954
|
+
await this.reporter.endRun();
|
|
955
|
+
} catch (error) {
|
|
956
|
+
console.warn("[QAagentic] Failed to end run:", error);
|
|
940
957
|
}
|
|
941
|
-
}
|
|
958
|
+
}
|
|
959
|
+
};
|
|
960
|
+
function setupQAgentic(on, config) {
|
|
961
|
+
const reporter = new QAgenticCypressReporter(config);
|
|
962
|
+
on("before:run", () => reporter.onRunBegin());
|
|
963
|
+
on("test:after:run", (test) => reporter.onTestEnd(test));
|
|
964
|
+
on("after:run", () => reporter.onRunEnd());
|
|
942
965
|
}
|
|
943
966
|
|
|
944
967
|
// src/cypress/index.ts
|