qagentic-reporter 0.1.15 → 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 +87 -78
- package/dist/cypress/index.js.map +1 -1
- package/dist/cypress/index.mjs +87 -78
- 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 +88 -83
- package/dist/cypress/simple-setup.js.map +1 -1
- package/dist/cypress/simple-setup.mjs +89 -81
- package/dist/cypress/simple-setup.mjs.map +1 -1
- package/package.json +1 -1
package/dist/cypress/index.mjs
CHANGED
|
@@ -865,94 +865,103 @@ function attachJson(data, name = "JSON Data") {
|
|
|
865
865
|
function attachText(text, name = "Text") {
|
|
866
866
|
return attach(text, name, "text/plain", "txt");
|
|
867
867
|
}
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
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() {
|
|
883
894
|
try {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
895
|
+
this.currentRun = await this.reporter.startRun({
|
|
896
|
+
name: this.projectName,
|
|
897
|
+
projectName: this.projectName,
|
|
898
|
+
environment: this.environment,
|
|
899
|
+
startTime: this.stats.start
|
|
889
900
|
});
|
|
890
|
-
console.log("[QAagentic] Test run started successfully:", currentRun?.id);
|
|
891
901
|
} catch (error) {
|
|
892
902
|
console.warn("[QAagentic] Failed to start run:", error);
|
|
893
903
|
}
|
|
894
|
-
}
|
|
895
|
-
|
|
904
|
+
}
|
|
905
|
+
async onTestEnd(test) {
|
|
906
|
+
if (!this.currentRun) return;
|
|
896
907
|
try {
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
isRetry: false,
|
|
923
|
-
isFlaky: false
|
|
924
|
-
};
|
|
925
|
-
if (test.err) {
|
|
926
|
-
testResult.errorMessage = test.err.message;
|
|
927
|
-
testResult.stackTrace = test.err.stack;
|
|
928
|
-
testResult.errorType = "AssertionError";
|
|
929
|
-
}
|
|
930
|
-
console.log("[QAagentic] Reporting test:", testResult.name, "-", testResult.status);
|
|
931
|
-
await reporter.reportTest(testResult);
|
|
932
|
-
} catch (error) {
|
|
933
|
-
console.warn("[QAagentic] Failed to report test:", error);
|
|
934
|
-
}
|
|
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";
|
|
935
933
|
}
|
|
936
|
-
|
|
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);
|
|
937
939
|
} catch (error) {
|
|
938
|
-
console.warn("[QAagentic]
|
|
940
|
+
console.warn("[QAagentic] Failed to report test:", error);
|
|
939
941
|
}
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
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);
|
|
954
957
|
}
|
|
955
|
-
}
|
|
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());
|
|
956
965
|
}
|
|
957
966
|
|
|
958
967
|
// src/cypress/index.ts
|