@open-qa/qa 0.1.0-alpha.3 → 0.1.0-alpha.5
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/THIRD_PARTY.md +5 -0
- package/drizzle/0017_provider_notifications.sql +13 -0
- package/drizzle/0018_classification_registry.sql +39 -0
- package/drizzle/0019_trial_audit.sql +44 -0
- package/drizzle/meta/0017_snapshot.json +2092 -0
- package/drizzle/meta/0018_snapshot.json +2102 -0
- package/drizzle/meta/0019_snapshot.json +2451 -0
- package/drizzle/meta/_journal.json +21 -0
- package/package.json +12 -7
- package/src/access-binding.d.ts +8 -0
- package/src/access-binding.js +26 -0
- package/src/adapters/classification-write.d.ts +87 -0
- package/src/adapters/classification-write.js +64 -0
- package/src/adapters/e2b-executor.js +4 -0
- package/src/adapters/file-run-store.d.ts +186 -41
- package/src/adapters/file-run-store.js +87 -19
- package/src/adapters/file-trial-audit.d.ts +280 -0
- package/src/adapters/file-trial-audit.js +105 -0
- package/src/adapters/pg-classification-store.d.ts +98 -20
- package/src/adapters/pg-classification-store.js +84 -44
- package/src/adapters/pg-run-store.d.ts +1 -0
- package/src/adapters/pg-run-store.js +70 -9
- package/src/adapters/run-metadata.d.ts +2 -0
- package/src/adapters/run-metadata.js +10 -0
- package/src/adapters/secret-manager-credential-resolver.d.ts +1 -1
- package/src/attempt-audit.d.ts +363 -0
- package/src/attempt-audit.js +253 -0
- package/src/audit-command.d.ts +13 -0
- package/src/audit-command.js +77 -0
- package/src/classification-command.d.ts +14 -9
- package/src/classification-command.js +119 -26
- package/src/classification-model.d.ts +10 -3
- package/src/classification-model.js +40 -24
- package/src/classification-notifier.d.ts +4 -3
- package/src/classification-notifier.js +26 -6
- package/src/classify-runs.d.ts +2 -1
- package/src/classify-runs.js +39 -3
- package/src/cli-program.js +54 -8
- package/src/commands.d.ts +1 -0
- package/src/commands.js +2 -0
- package/src/db/database.d.ts +7 -0
- package/src/db/database.js +15 -0
- package/src/db/event-chunks.d.ts +38 -29
- package/src/db/flow-status.d.ts +7 -3
- package/src/db/flow-status.js +240 -16
- package/src/db/queries.d.ts +24 -1
- package/src/db/queries.js +22 -0
- package/src/db/schema.d.ts +333 -4
- package/src/db/schema.js +83 -11
- package/src/db/trial-audit.d.ts +526 -0
- package/src/db/trial-audit.js +84 -0
- package/src/doctor-command.js +2 -1
- package/src/draft-api.d.ts +25 -421
- package/src/draft-api.js +10 -3
- package/src/engine.d.ts +47 -4
- package/src/engine.js +97 -8
- package/src/execution-snapshot.d.ts +1 -1
- package/src/execution-snapshot.js +24 -18
- package/src/export-command.d.ts +6 -0
- package/src/export-command.js +106 -0
- package/src/flow-check.js +1 -1
- package/src/flow-loader.d.ts +72 -6
- package/src/flow-loader.js +76 -12
- package/src/http-stage-client.d.ts +98 -1
- package/src/independent-model.js +53 -6
- package/src/judge-review-store.d.ts +13 -0
- package/src/judge-review-store.js +58 -0
- package/src/local-host-executor.d.ts +3 -1
- package/src/local-host-executor.js +2 -0
- package/src/quarantine-command.d.ts +5 -1
- package/src/quarantine-command.js +56 -13
- package/src/remote-command.js +2 -0
- package/src/report/browser.css +1 -1
- package/src/report/browser.js +41 -41
- package/src/report/ctrf.d.ts +983 -0
- package/src/report/ctrf.js +306 -0
- package/src/report/generate.d.ts +1 -1
- package/src/report/generate.js +29 -6
- package/src/report/load.d.ts +738 -42
- package/src/report/load.js +78 -6
- package/src/result-notifier.js +1 -1
- package/src/result-trace.d.ts +62 -0
- package/src/result-trace.js +81 -0
- package/src/run-command.d.ts +9 -0
- package/src/run-command.js +300 -63
- package/src/run-setup-error.d.ts +11 -0
- package/src/run-setup-error.js +18 -0
- package/src/server/app.js +5 -4
- package/src/server/index.d.ts +2 -0
- package/src/server/index.js +11 -2
- package/src/server/repository.d.ts +166 -29
- package/src/server/repository.js +14 -2
- package/src/studio-command.d.ts +1 -0
- package/src/studio-command.js +11 -0
- package/src/studio-control.d.ts +5 -0
- package/src/studio-control.js +207 -0
- package/src/studio-review.d.ts +24 -0
- package/src/studio-review.js +64 -0
- package/src/studio-worker.d.ts +1 -0
- package/src/studio-worker.js +48 -0
- package/src/system-config.d.ts +2 -2
- package/src/system-config.js +5 -4
- package/src/trial-audit.d.ts +630 -0
- package/src/trial-audit.js +272 -0
- package/src/visual-baseline.d.ts +4 -0
- package/src/visual-baseline.js +42 -0
- package/src/webhook-notification.d.ts +15 -0
- package/src/webhook-notification.js +61 -0
- package/src/worker/execution.d.ts +2 -1
- package/src/worker/execution.js +122 -3
- package/src/worker/index.d.ts +4 -0
- package/src/worker/index.js +10 -1
- package/src/worker/quarantine-notifications.js +2 -2
- package/src/worker/queue.d.ts +6 -2
- package/src/worker/queue.js +80 -19
- package/src/worker/result-notifications.d.ts +10 -2
- package/src/worker/result-notifications.js +120 -23
- package/src/worker/store.js +6 -3
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import {
|
|
2
|
+
artifactPathSchema,
|
|
3
|
+
projectIdSchema,
|
|
4
|
+
readExecutionSnapshot,
|
|
5
|
+
readResultTrace,
|
|
6
|
+
resultOutcome,
|
|
7
|
+
summarizeAcceptance
|
|
8
|
+
} from "@open-qa/qa-engine/protocol";
|
|
9
|
+
import { extname } from "node:path";
|
|
10
|
+
import { artifactScanSchema } from "../artifact-scan.js";
|
|
11
|
+
import { resultCaseId, resultExecutionId } from "../result-trace.js";
|
|
12
|
+
import { projectAttemptAudit } from "../attempt-audit.js";
|
|
13
|
+
function compare(a, b) {
|
|
14
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
15
|
+
}
|
|
16
|
+
function identity(item) {
|
|
17
|
+
const { id, flow, metadata } = item.run;
|
|
18
|
+
const read = readResultTrace(metadata?.resultTrace);
|
|
19
|
+
const trace = read.status === "recorded" && read.trace.attemptId === id && read.trace.caseId === resultCaseId(read.trace.projectId, read.trace.traceability?.caseId ?? flow) ? read.trace : void 0;
|
|
20
|
+
const legacyRetry = projectIdSchema.safeParse(metadata?.retryOf);
|
|
21
|
+
const legacyBatch = projectIdSchema.safeParse(metadata?.batchId);
|
|
22
|
+
return {
|
|
23
|
+
trace,
|
|
24
|
+
readStatus: read.status === "recorded" && !trace ? "invalid" : read.status,
|
|
25
|
+
..."schemaVersion" in read && { schemaVersion: read.schemaVersion },
|
|
26
|
+
retryOf: trace ? trace.retryOf : legacyRetry.success ? legacyRetry.data : null,
|
|
27
|
+
batchId: item.batchId ?? (trace ? trace.batchId : legacyBatch.success ? legacyBatch.data : null)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function caseScope(item, trace, batchId) {
|
|
31
|
+
return trace && batchId ? JSON.stringify([trace.projectId, batchId, item.run.flow]) : void 0;
|
|
32
|
+
}
|
|
33
|
+
function hasCaseDefinition(trace) {
|
|
34
|
+
return trace.started || trace.caseRevision !== null || trace.acceptance !== void 0 || trace.traceability !== void 0;
|
|
35
|
+
}
|
|
36
|
+
function queuedCaseIds(input, related) {
|
|
37
|
+
const scopes = /* @__PURE__ */ new Set();
|
|
38
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
39
|
+
for (const item of input) {
|
|
40
|
+
const { trace, batchId } = identity(item);
|
|
41
|
+
const scope = caseScope(item, trace, batchId);
|
|
42
|
+
if (trace && scope && !hasCaseDefinition(trace)) scopes.add(scope);
|
|
43
|
+
}
|
|
44
|
+
if (!scopes.size) return candidates;
|
|
45
|
+
for (const item of [...input, ...related]) {
|
|
46
|
+
const { trace, batchId } = identity(item);
|
|
47
|
+
const scope = caseScope(item, trace, batchId);
|
|
48
|
+
if (!trace || !scope || !scopes.has(scope) || !hasCaseDefinition(trace)) continue;
|
|
49
|
+
const known = candidates.get(scope);
|
|
50
|
+
candidates.set(scope, known === void 0 || known === trace.caseId ? trace.caseId : null);
|
|
51
|
+
}
|
|
52
|
+
return candidates;
|
|
53
|
+
}
|
|
54
|
+
function selectReportAttempts(runs, id, batch) {
|
|
55
|
+
if (batch) return runs.filter((run) => identity(run).batchId === id);
|
|
56
|
+
if (!runs.some(({ run }) => run.id === id)) return [];
|
|
57
|
+
const links = /* @__PURE__ */ new Map();
|
|
58
|
+
for (const item of runs) {
|
|
59
|
+
const retryOf = identity(item).retryOf;
|
|
60
|
+
if (!retryOf) continue;
|
|
61
|
+
const { id: id2 } = item.run;
|
|
62
|
+
links.set(id2, [...links.get(id2) ?? [], retryOf]);
|
|
63
|
+
links.set(retryOf, [...links.get(retryOf) ?? [], id2]);
|
|
64
|
+
}
|
|
65
|
+
const selected = /* @__PURE__ */ new Set([id]);
|
|
66
|
+
for (const member of selected) for (const link of links.get(member) ?? []) selected.add(link);
|
|
67
|
+
return runs.filter(({ run }) => selected.has(run.id));
|
|
68
|
+
}
|
|
69
|
+
const MIME = /* @__PURE__ */ new Map([
|
|
70
|
+
[".html", "text/html"],
|
|
71
|
+
[".png", "image/png"],
|
|
72
|
+
[".jpeg", "image/jpeg"],
|
|
73
|
+
[".jpg", "image/jpeg"],
|
|
74
|
+
[".json", "application/json"],
|
|
75
|
+
[".ndjson", "application/x-ndjson"],
|
|
76
|
+
[".gz", "application/gzip"],
|
|
77
|
+
[".webm", "video/webm"]
|
|
78
|
+
]);
|
|
79
|
+
function attachments(item, trace) {
|
|
80
|
+
const scan = artifactScanSchema.safeParse(item.run.metadata?.artifactScan);
|
|
81
|
+
if (!scan.success || scan.data.status !== "passed") return [];
|
|
82
|
+
const references = new Map(trace?.evidence?.map(({ path, ...context }) => [path, context]));
|
|
83
|
+
return Object.entries(scan.data.files).filter(
|
|
84
|
+
([path, sha256]) => artifactPathSchema.safeParse(path).success && /^[a-f0-9]{64}$/.test(sha256)
|
|
85
|
+
).sort(([a], [b]) => compare(a, b)).map(([path, sha256]) => ({
|
|
86
|
+
name: path,
|
|
87
|
+
path: `runs/${item.run.id}/${path}`,
|
|
88
|
+
contentType: MIME.get(extname(path)) ?? "application/octet-stream",
|
|
89
|
+
extra: { openQa: { sha256, context: references.get(path) ?? null } }
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
function projectAttempt(item, project, caseIds) {
|
|
93
|
+
const { run, result } = item;
|
|
94
|
+
const { trace, readStatus, schemaVersion, retryOf, batchId } = identity(item);
|
|
95
|
+
const read = readExecutionSnapshot(run.metadata?.executionSnapshot);
|
|
96
|
+
const snapshot = read.status === "recorded" ? read.snapshot : void 0;
|
|
97
|
+
const projectId = trace?.projectId ?? snapshot?.projectId ?? project ?? null;
|
|
98
|
+
const scope = trace && !hasCaseDefinition(trace) ? caseScope(item, trace, batchId) : void 0;
|
|
99
|
+
const testId = (scope ? caseIds.get(scope) : void 0) ?? trace?.caseId ?? (projectId ? resultCaseId(projectId, run.flow) : null);
|
|
100
|
+
const outcome = resultOutcome(result?.verdict, trace?.outcome, trace?.started);
|
|
101
|
+
const status = outcome === "passed" || outcome === "failed" || outcome === "skipped" ? outcome : outcome === "not-run" || outcome === "unfinished" ? "pending" : "other";
|
|
102
|
+
const reason = result?.reason ?? null;
|
|
103
|
+
const context = trace?.context;
|
|
104
|
+
const startedAt = trace?.started === false ? null : run.startedAt;
|
|
105
|
+
const finishedAt = result?.finishedAt ?? null;
|
|
106
|
+
const durationMs = finishedAt === null || startedAt === null ? null : Math.max(0, finishedAt - startedAt);
|
|
107
|
+
const evidence = attachments(item, trace);
|
|
108
|
+
const legacyTarget = run.metadata?.target;
|
|
109
|
+
return {
|
|
110
|
+
attemptId: run.id,
|
|
111
|
+
status,
|
|
112
|
+
...reason !== null && { message: reason },
|
|
113
|
+
...startedAt !== null && { start: Math.floor(startedAt) },
|
|
114
|
+
...finishedAt !== null && { stop: Math.floor(finishedAt) },
|
|
115
|
+
duration: Math.floor(durationMs ?? 0),
|
|
116
|
+
...evidence.length > 0 && { attachments: evidence },
|
|
117
|
+
extra: {
|
|
118
|
+
openQa: {
|
|
119
|
+
traceStatus: readStatus,
|
|
120
|
+
...schemaVersion !== void 0 && { traceSchemaVersion: schemaVersion },
|
|
121
|
+
projectId,
|
|
122
|
+
caseId: testId,
|
|
123
|
+
caseRevision: trace?.caseRevision ?? snapshot?.definitions.flow.sha256 ?? null,
|
|
124
|
+
retryOf,
|
|
125
|
+
batchId,
|
|
126
|
+
trial: trace?.trial ?? null,
|
|
127
|
+
quarantined: item.quarantined ?? null,
|
|
128
|
+
attemptAudit: projectAttemptAudit(run.metadata, result?.usage, item.judgeReviews),
|
|
129
|
+
target: trace?.target ?? snapshot?.target.name ?? (typeof legacyTarget === "string" && /^[a-zA-Z0-9_.-]{1,128}$/.test(legacyTarget) ? legacyTarget : null),
|
|
130
|
+
targetRevision: trace?.targetRevision ?? (snapshot && "revision" in snapshot.target ? snapshot.target.revision : null) ?? null,
|
|
131
|
+
commit: trace?.commit ?? snapshot?.versions.commit ?? null,
|
|
132
|
+
parameters: trace?.parameters ?? null,
|
|
133
|
+
parameterFingerprint: trace?.parameterFingerprint ?? null,
|
|
134
|
+
environmentFingerprint: trace?.environmentFingerprint ?? null,
|
|
135
|
+
rawVerdict: result?.verdict ?? null,
|
|
136
|
+
rawReason: reason,
|
|
137
|
+
covers: trace?.covers ?? [],
|
|
138
|
+
risk: trace?.traceability?.risk ?? null,
|
|
139
|
+
owner: trace?.traceability?.owner ?? null,
|
|
140
|
+
acceptanceSuite: trace?.acceptance ? { source: trace.acceptance.source, revision: trace.acceptance.revision } : null,
|
|
141
|
+
ci: {
|
|
142
|
+
pipeline: context?.ci?.pipeline ?? null,
|
|
143
|
+
task: context?.ci?.task ?? null,
|
|
144
|
+
runId: context?.ci?.runId ?? null,
|
|
145
|
+
runUrl: context?.ci?.runUrl ?? null
|
|
146
|
+
},
|
|
147
|
+
build: { id: context?.build?.id ?? null, url: context?.build?.url ?? null },
|
|
148
|
+
correlation: {
|
|
149
|
+
trace_id: context?.correlation?.traceId ?? null,
|
|
150
|
+
span_id: context?.correlation?.spanId ?? null,
|
|
151
|
+
request_id: context?.correlation?.requestId ?? null
|
|
152
|
+
},
|
|
153
|
+
productPr: context?.productPr ?? null,
|
|
154
|
+
qa: { issue: context?.qa?.issue ?? null, pr: context?.qa?.pr ?? null },
|
|
155
|
+
defects: context?.defects?.flatMap(({ url, acceptance }) => {
|
|
156
|
+
const ids = acceptance.filter((id) => trace?.covers?.includes(id));
|
|
157
|
+
return ids.length ? [{ url, acceptance: ids }] : [];
|
|
158
|
+
}) ?? [],
|
|
159
|
+
findings: (item.findings ?? []).map((finding, index) => ({
|
|
160
|
+
...finding,
|
|
161
|
+
id: `finding:${run.id}:${index + 1}`,
|
|
162
|
+
evidence: evidence.filter(
|
|
163
|
+
({ name, extra }) => finding.shots.includes(name) || finding.eventSeqs.includes(extra.openQa.context?.eventSeq ?? 0)
|
|
164
|
+
).map(({ path }) => path)
|
|
165
|
+
})),
|
|
166
|
+
engineResult: trace?.engineResult ?? null,
|
|
167
|
+
errorReason: result?.errorReason ?? null,
|
|
168
|
+
outcome,
|
|
169
|
+
startedAt,
|
|
170
|
+
queuedAt: startedAt === null ? run.startedAt : null,
|
|
171
|
+
finishedAt,
|
|
172
|
+
durationMs
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
function buildCtrfReport(input, options) {
|
|
178
|
+
const records = new Map(input.map((item) => [item.run.id, item]));
|
|
179
|
+
if (records.size !== input.length) throw new Error("Duplicate attempt in QA report");
|
|
180
|
+
const caseIds = queuedCaseIds(input, options.relatedAttempts ?? []);
|
|
181
|
+
const children = /* @__PURE__ */ new Map();
|
|
182
|
+
const roots = /* @__PURE__ */ new Map();
|
|
183
|
+
for (const item of input) {
|
|
184
|
+
const { retryOf } = identity(item);
|
|
185
|
+
if (retryOf) {
|
|
186
|
+
if (children.has(retryOf)) throw new Error(`Multiple retries of QA attempt ${retryOf}`);
|
|
187
|
+
children.set(retryOf, item);
|
|
188
|
+
}
|
|
189
|
+
if (!retryOf || !records.has(retryOf)) roots.set(retryOf ?? item.run.id, item);
|
|
190
|
+
}
|
|
191
|
+
let visited = 0;
|
|
192
|
+
const tests = [...roots.entries()].sort(([a], [b]) => compare(a, b)).map(([root, entry]) => {
|
|
193
|
+
const history = [];
|
|
194
|
+
let item = entry;
|
|
195
|
+
const missingPredecessor = root === entry.run.id ? null : root;
|
|
196
|
+
const executionId = resultExecutionId(root);
|
|
197
|
+
const batches = /* @__PURE__ */ new Set();
|
|
198
|
+
const projects = /* @__PURE__ */ new Set();
|
|
199
|
+
while (item) {
|
|
200
|
+
if (item.run.flow !== entry.run.flow) throw new Error(`Retry changes QA flow for ${root}`);
|
|
201
|
+
const { trace, batchId } = identity(item);
|
|
202
|
+
if (trace && !missingPredecessor && trace.executionId !== executionId)
|
|
203
|
+
throw new Error(`Retry changes QA execution ID for ${root}`);
|
|
204
|
+
const attempt2 = projectAttempt(item, options.project, caseIds);
|
|
205
|
+
if (batchId) batches.add(batchId);
|
|
206
|
+
if (attempt2.extra.openQa.projectId) projects.add(attempt2.extra.openQa.projectId);
|
|
207
|
+
const ordinal = history.length + (missingPredecessor ? 2 : 1);
|
|
208
|
+
history.push({ ...attempt2, attempt: trace?.attempt ?? ordinal });
|
|
209
|
+
visited++;
|
|
210
|
+
item = children.get(item.run.id);
|
|
211
|
+
}
|
|
212
|
+
if (batches.size > 1 || projects.size > 1)
|
|
213
|
+
throw new Error(`Retry changes QA batch or project for ${root}`);
|
|
214
|
+
const { attempt, ...final } = history.pop();
|
|
215
|
+
const qa = final.extra.openQa;
|
|
216
|
+
const flaky = final.status === "passed" && qa.targetRevision !== null && history.some(
|
|
217
|
+
({ status, extra: { openQa: prior } }) => status === "failed" && prior.targetRevision === qa.targetRevision && prior.caseRevision === qa.caseRevision && prior.parameterFingerprint === qa.parameterFingerprint && prior.target === qa.target
|
|
218
|
+
);
|
|
219
|
+
const [projectId] = projects;
|
|
220
|
+
const caseId = qa.caseId ?? (projectId ? resultCaseId(projectId, entry.run.flow) : null);
|
|
221
|
+
const complete = !missingPredecessor && history.every((row, index) => row.attempt === index + 1);
|
|
222
|
+
return {
|
|
223
|
+
...final,
|
|
224
|
+
name: entry.run.flow,
|
|
225
|
+
...caseId && { testId: caseId },
|
|
226
|
+
executionId,
|
|
227
|
+
...qa.rawVerdict && { rawStatus: qa.rawVerdict },
|
|
228
|
+
...qa.parameters?.device && { device: qa.parameters.device },
|
|
229
|
+
...flaky && { flaky },
|
|
230
|
+
// CTRF numbers retry history starting at one. Record a missing predecessor
|
|
231
|
+
// explicitly in the extension instead of claiming the history is complete.
|
|
232
|
+
...complete && history.length > 0 && {
|
|
233
|
+
retries: history.length,
|
|
234
|
+
retryAttempts: history
|
|
235
|
+
},
|
|
236
|
+
extra: {
|
|
237
|
+
openQa: {
|
|
238
|
+
...qa,
|
|
239
|
+
caseId,
|
|
240
|
+
attempt,
|
|
241
|
+
missingPredecessor,
|
|
242
|
+
...!complete && history.length > 0 && { recordedPriorAttempts: history }
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
if (visited !== records.size) throw new Error("Cycle in QA retry history");
|
|
248
|
+
const start = input.reduce((min, item) => Math.min(min, item.run.startedAt), Infinity);
|
|
249
|
+
const stop = input.reduce(
|
|
250
|
+
(max, item) => Math.max(max, item.result?.finishedAt ?? item.run.startedAt),
|
|
251
|
+
0
|
|
252
|
+
);
|
|
253
|
+
const totals = { passed: 0, failed: 0, skipped: 0, pending: 0, other: 0, flaky: 0 };
|
|
254
|
+
const cases = /* @__PURE__ */ new Set();
|
|
255
|
+
for (const test of tests) {
|
|
256
|
+
totals[test.status]++;
|
|
257
|
+
if (test.flaky) totals.flaky++;
|
|
258
|
+
if (test.testId) cases.add(test.testId);
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
reportFormat: "CTRF",
|
|
262
|
+
specVersion: "0.3.0",
|
|
263
|
+
runId: options.id,
|
|
264
|
+
extra: {
|
|
265
|
+
openQa: {
|
|
266
|
+
schemaVersion: 2,
|
|
267
|
+
trials: options.trials ?? [],
|
|
268
|
+
quarantine: tests.flatMap(
|
|
269
|
+
({ extra: { openQa: qa }, attemptId }) => qa.quarantined && qa.outcome !== "passed" ? [{ attemptId, caseId: qa.caseId, outcome: qa.outcome, covers: qa.covers }] : []
|
|
270
|
+
),
|
|
271
|
+
acceptance: summarizeAcceptance(
|
|
272
|
+
input.map((item) => ({
|
|
273
|
+
attemptId: item.run.id,
|
|
274
|
+
flow: item.run.flow,
|
|
275
|
+
trace: identity(item).trace,
|
|
276
|
+
verdict: item.result?.verdict,
|
|
277
|
+
reason: item.result?.reason
|
|
278
|
+
}))
|
|
279
|
+
)
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
results: {
|
|
283
|
+
tool: { name: "open-qa" },
|
|
284
|
+
summary: {
|
|
285
|
+
tests: tests.length,
|
|
286
|
+
...totals,
|
|
287
|
+
start: Number.isFinite(start) ? Math.floor(start) : 0,
|
|
288
|
+
stop: Math.floor(stop),
|
|
289
|
+
extra: {
|
|
290
|
+
openQa: {
|
|
291
|
+
uniqueCases: cases.size,
|
|
292
|
+
unidentifiedExecutions: tests.filter((test) => !test.testId).length,
|
|
293
|
+
...options.quarantineOverdue?.length && {
|
|
294
|
+
quarantineOverdue: options.quarantineOverdue
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
tests
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
export {
|
|
304
|
+
buildCtrfReport,
|
|
305
|
+
selectReportAttempts
|
|
306
|
+
};
|
package/src/report/generate.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function generateReport(root: string, runId: string): Promise<string>;
|
|
1
|
+
export declare function generateReport(root: string, runId: string, projectId?: string): Promise<string>;
|
package/src/report/generate.js
CHANGED
|
@@ -31,18 +31,41 @@ function browserAssets() {
|
|
|
31
31
|
return { js, css };
|
|
32
32
|
})();
|
|
33
33
|
}
|
|
34
|
-
async function generateReport(root, runId) {
|
|
35
|
-
const {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
async function generateReport(root, runId, projectId) {
|
|
35
|
+
const {
|
|
36
|
+
events,
|
|
37
|
+
replay,
|
|
38
|
+
resources,
|
|
39
|
+
healShots,
|
|
40
|
+
executionSnapshot,
|
|
41
|
+
classificationHistory,
|
|
42
|
+
result,
|
|
43
|
+
attemptAudit,
|
|
44
|
+
trial,
|
|
45
|
+
quarantined,
|
|
46
|
+
quarantineOverdueSince
|
|
47
|
+
} = await loadReport(root, runId, projectId);
|
|
39
48
|
const { js, css } = await browserAssets();
|
|
40
49
|
const payload = JSON.stringify({
|
|
41
50
|
data: reportData(events, { verdict: result?.verdict, reason: result?.reason }),
|
|
42
51
|
replay,
|
|
43
52
|
resources,
|
|
44
53
|
healShots,
|
|
45
|
-
executionSnapshot
|
|
54
|
+
executionSnapshot,
|
|
55
|
+
classificationHistory,
|
|
56
|
+
attemptAudit,
|
|
57
|
+
trial: trial && {
|
|
58
|
+
groupId: trial.group.groupId,
|
|
59
|
+
planned: trial.group.planned,
|
|
60
|
+
first: trial.first,
|
|
61
|
+
final: trial.final,
|
|
62
|
+
completed: trial.completed,
|
|
63
|
+
finishedAt: trial.finishedAt,
|
|
64
|
+
assumptions: trial.confidence.assumptions,
|
|
65
|
+
counts: trial.counts
|
|
66
|
+
},
|
|
67
|
+
quarantined,
|
|
68
|
+
...quarantineOverdueSince !== null && { quarantineOverdueSince }
|
|
46
69
|
}).replaceAll("<", "\\u003c");
|
|
47
70
|
const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline' data: blob:; img-src data: blob:; font-src data: blob:; frame-src 'self' about:; connect-src 'none'; media-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'"><meta name="viewport" content="width=device-width,initial-scale=1"><title>open-qa \xB7 Run report</title><style>${css.replaceAll("</style", "<\\/style")}</style></head><body><main id="report"></main><script id="report-data" type="application/json">${payload}<\/script><script>${js.replaceAll("<\/script", "<\\/script")}<\/script></body></html>`;
|
|
48
71
|
const path = join(root, "runs", runId, "report.html");
|