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.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { S as Severity, b as Status, c as Step, u as attach, x as attachJson, w as attachScreenshot, y as attachText, e as epic, f as feature, l as label, g as severity, s as step, d as story, t as tag } from '../attachments-B2zaEsD5.mjs';
|
|
2
|
-
export {
|
|
2
|
+
export { setupQAgentic } from './simple-setup.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* QAagentic Cypress Plugin
|
package/dist/cypress/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { S as Severity, b as Status, c as Step, u as attach, x as attachJson, w as attachScreenshot, y as attachText, e as epic, f as feature, l as label, g as severity, s as step, d as story, t as tag } from '../attachments-B2zaEsD5.js';
|
|
2
|
-
export {
|
|
2
|
+
export { setupQAgentic } from './simple-setup.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* QAagentic Cypress Plugin
|
package/dist/cypress/index.js
CHANGED
|
@@ -456,18 +456,28 @@ var APIReporter = class {
|
|
|
456
456
|
if (!this.config.api.enabled) return;
|
|
457
457
|
await this.flushBatch();
|
|
458
458
|
try {
|
|
459
|
-
|
|
459
|
+
console.log("[APIReporter] Finalizing run with test counts:", {
|
|
460
|
+
total: run.total,
|
|
461
|
+
passed: run.passed,
|
|
462
|
+
failed: run.failed,
|
|
463
|
+
broken: run.broken,
|
|
464
|
+
skipped: run.skipped
|
|
465
|
+
});
|
|
466
|
+
const patchData = {
|
|
467
|
+
end_time: run.endTime?.toISOString(),
|
|
468
|
+
duration_ms: run.durationMs,
|
|
469
|
+
total: run.total,
|
|
470
|
+
passed: run.passed,
|
|
471
|
+
failed: run.failed,
|
|
472
|
+
broken: run.broken,
|
|
473
|
+
skipped: run.skipped,
|
|
474
|
+
status: "completed"
|
|
475
|
+
};
|
|
476
|
+
console.log("[APIReporter] PATCH to:", `${this.config.api.url}/api/v1/runs/${run.id}`);
|
|
477
|
+
console.log("[APIReporter] PATCH data:", patchData);
|
|
478
|
+
const response = await axios__default.default.patch(
|
|
460
479
|
`${this.config.api.url}/api/v1/runs/${run.id}`,
|
|
461
|
-
|
|
462
|
-
end_time: run.endTime?.toISOString(),
|
|
463
|
-
duration_ms: run.durationMs,
|
|
464
|
-
total: run.total,
|
|
465
|
-
passed: run.passed,
|
|
466
|
-
failed: run.failed,
|
|
467
|
-
broken: run.broken,
|
|
468
|
-
skipped: run.skipped,
|
|
469
|
-
status: "completed"
|
|
470
|
-
},
|
|
480
|
+
patchData,
|
|
471
481
|
{
|
|
472
482
|
headers: {
|
|
473
483
|
"Content-Type": "application/json",
|
|
@@ -476,8 +486,12 @@ var APIReporter = class {
|
|
|
476
486
|
timeout: this.config.api.timeout
|
|
477
487
|
}
|
|
478
488
|
);
|
|
489
|
+
console.log("[APIReporter] Run finalized successfully:", response.status);
|
|
479
490
|
} catch (error) {
|
|
480
|
-
console.warn("
|
|
491
|
+
console.warn("[APIReporter] Failed to finalize run with API:");
|
|
492
|
+
console.warn(" Error:", error.message);
|
|
493
|
+
console.warn(" Status:", error.response?.status);
|
|
494
|
+
console.warn(" Data:", error.response?.data);
|
|
481
495
|
}
|
|
482
496
|
}
|
|
483
497
|
async reportTest(test) {
|
|
@@ -879,94 +893,103 @@ function attachJson(data, name = "JSON Data") {
|
|
|
879
893
|
function attachText(text, name = "Text") {
|
|
880
894
|
return attach(text, name, "text/plain", "txt");
|
|
881
895
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
896
|
+
var QAgenticCypressReporter = class {
|
|
897
|
+
constructor(config) {
|
|
898
|
+
this.currentRun = null;
|
|
899
|
+
this.stats = {
|
|
900
|
+
suites: 0,
|
|
901
|
+
tests: 0,
|
|
902
|
+
passes: 0,
|
|
903
|
+
pending: 0,
|
|
904
|
+
failures: 0,
|
|
905
|
+
start: /* @__PURE__ */ new Date(),
|
|
906
|
+
end: /* @__PURE__ */ new Date(),
|
|
907
|
+
duration: 0
|
|
908
|
+
};
|
|
909
|
+
this.projectName = process.env.QAGENTIC_PROJECT_NAME || config.projectId || "Cypress E2E Tests";
|
|
910
|
+
this.environment = process.env.QAGENTIC_ENVIRONMENT || process.env.NODE_ENV || "e2e";
|
|
911
|
+
const apiUrl = process.env.QAGENTIC_API_URL || "http://localhost:8080";
|
|
912
|
+
configure({
|
|
913
|
+
projectName: this.projectName,
|
|
914
|
+
environment: this.environment,
|
|
915
|
+
apiUrl,
|
|
916
|
+
outputDir: "./qagentic-results"
|
|
917
|
+
});
|
|
918
|
+
this.reporter = QAgenticReporter.getInstance();
|
|
919
|
+
this.stats.start = /* @__PURE__ */ new Date();
|
|
920
|
+
}
|
|
921
|
+
async onRunBegin() {
|
|
897
922
|
try {
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
923
|
+
this.currentRun = await this.reporter.startRun({
|
|
924
|
+
name: this.projectName,
|
|
925
|
+
projectName: this.projectName,
|
|
926
|
+
environment: this.environment,
|
|
927
|
+
startTime: this.stats.start
|
|
903
928
|
});
|
|
904
|
-
console.log("[QAagentic] Test run started successfully:", currentRun?.id);
|
|
905
929
|
} catch (error) {
|
|
906
930
|
console.warn("[QAagentic] Failed to start run:", error);
|
|
907
931
|
}
|
|
908
|
-
}
|
|
909
|
-
|
|
932
|
+
}
|
|
933
|
+
async onTestEnd(test) {
|
|
934
|
+
if (!this.currentRun) return;
|
|
910
935
|
try {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
isRetry: false,
|
|
937
|
-
isFlaky: false
|
|
938
|
-
};
|
|
939
|
-
if (test.err) {
|
|
940
|
-
testResult.errorMessage = test.err.message;
|
|
941
|
-
testResult.stackTrace = test.err.stack;
|
|
942
|
-
testResult.errorType = "AssertionError";
|
|
943
|
-
}
|
|
944
|
-
console.log("[QAagentic] Reporting test:", testResult.name, "-", testResult.status);
|
|
945
|
-
await reporter.reportTest(testResult);
|
|
946
|
-
} catch (error) {
|
|
947
|
-
console.warn("[QAagentic] Failed to report test:", error);
|
|
948
|
-
}
|
|
936
|
+
const testResult = {
|
|
937
|
+
id: uuid.v4(),
|
|
938
|
+
name: test.title[test.title.length - 1],
|
|
939
|
+
fullName: test.title.join(" > "),
|
|
940
|
+
status: parseStatus(test.state),
|
|
941
|
+
durationMs: test.duration,
|
|
942
|
+
startTime: new Date(Date.now() - test.duration),
|
|
943
|
+
endTime: /* @__PURE__ */ new Date(),
|
|
944
|
+
labels: {
|
|
945
|
+
suite: test.title.slice(0, -1).join(" > "),
|
|
946
|
+
feature: test.title[0]
|
|
947
|
+
},
|
|
948
|
+
links: [],
|
|
949
|
+
parameters: {},
|
|
950
|
+
steps: [],
|
|
951
|
+
attachments: [],
|
|
952
|
+
filePath: test.invocationDetails?.relativeFile || "",
|
|
953
|
+
retryCount: 0,
|
|
954
|
+
isRetry: false,
|
|
955
|
+
isFlaky: false
|
|
956
|
+
};
|
|
957
|
+
if (test.err) {
|
|
958
|
+
testResult.errorMessage = test.err.message;
|
|
959
|
+
testResult.stackTrace = test.err.stack;
|
|
960
|
+
testResult.errorType = "AssertionError";
|
|
949
961
|
}
|
|
950
|
-
|
|
962
|
+
this.stats.tests++;
|
|
963
|
+
if (test.state === "passed") this.stats.passes++;
|
|
964
|
+
if (test.state === "failed") this.stats.failures++;
|
|
965
|
+
if (test.state === "pending") this.stats.pending++;
|
|
966
|
+
await this.reporter.reportTest(testResult);
|
|
951
967
|
} catch (error) {
|
|
952
|
-
console.warn("[QAagentic]
|
|
968
|
+
console.warn("[QAagentic] Failed to report test:", error);
|
|
953
969
|
}
|
|
954
|
-
}
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
970
|
+
}
|
|
971
|
+
async onRunEnd() {
|
|
972
|
+
if (!this.currentRun) return;
|
|
973
|
+
try {
|
|
974
|
+
this.stats.end = /* @__PURE__ */ new Date();
|
|
975
|
+
this.stats.duration = this.stats.end.getTime() - this.stats.start.getTime();
|
|
976
|
+
this.currentRun.endTime = this.stats.end;
|
|
977
|
+
this.currentRun.durationMs = this.stats.duration;
|
|
978
|
+
this.currentRun.total = this.stats.tests;
|
|
979
|
+
this.currentRun.passed = this.stats.passes;
|
|
980
|
+
this.currentRun.failed = this.stats.failures;
|
|
981
|
+
this.currentRun.skipped = this.stats.pending;
|
|
982
|
+
await this.reporter.endRun();
|
|
983
|
+
} catch (error) {
|
|
984
|
+
console.warn("[QAagentic] Failed to end run:", error);
|
|
968
985
|
}
|
|
969
|
-
}
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
function setupQAgentic(on, config) {
|
|
989
|
+
const reporter = new QAgenticCypressReporter(config);
|
|
990
|
+
on("before:run", () => reporter.onRunBegin());
|
|
991
|
+
on("test:after:run", (test) => reporter.onTestEnd(test));
|
|
992
|
+
on("after:run", () => reporter.onRunEnd());
|
|
970
993
|
}
|
|
971
994
|
|
|
972
995
|
// src/cypress/index.ts
|