tolkira 0.1.2 → 0.2.0
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/DESIGN.md +12 -7
- package/GLOSSARY.md +15 -0
- package/README.md +16 -6
- package/dist/cli.js +517 -88
- package/dist/cli.js.map +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +470 -87
- package/dist/index.js.map +3 -3
- package/dist/input/junit.d.ts +3 -1
- package/dist/input/load.d.ts +11 -0
- package/dist/render/escape.d.ts +1 -1
- package/dist/render/html.d.ts +1 -0
- package/dist/report/model.d.ts +4 -1
- package/dist/summary.d.ts +1 -0
- package/docs/COMPATIBILITY.md +14 -4
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -7,8 +7,7 @@ import path2 from "node:path";
|
|
|
7
7
|
import {
|
|
8
8
|
AttachmentContentEncoding,
|
|
9
9
|
HookType,
|
|
10
|
-
TestStepResultStatus
|
|
11
|
-
version as messagesVersion
|
|
10
|
+
TestStepResultStatus
|
|
12
11
|
} from "@cucumber/messages";
|
|
13
12
|
function isRecord(value) {
|
|
14
13
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
@@ -143,13 +142,13 @@ function createIdFactory(prefix) {
|
|
|
143
142
|
}
|
|
144
143
|
function normalizeUri(uri, index) {
|
|
145
144
|
if (!uri) return `features/legacy-${index}.feature`;
|
|
146
|
-
const slashed = uri.replace(/\\/g, "/");
|
|
145
|
+
const slashed = uri.replace(/\\/g, "/").replace(/^file:\/\/+/i, "");
|
|
147
146
|
const normalized = slashed.replace(/^\.\//, "");
|
|
148
147
|
if (/^[a-z]:\//i.test(normalized) || slashed.startsWith("/")) {
|
|
149
148
|
const marker = slashed.lastIndexOf("/features/");
|
|
150
149
|
if (marker >= 0) return slashed.slice(marker + 1);
|
|
151
150
|
const parts = slashed.split("/").filter(Boolean);
|
|
152
|
-
return parts.
|
|
151
|
+
return parts[parts.length - 1] ?? `features/legacy-${index}.feature`;
|
|
153
152
|
}
|
|
154
153
|
return normalized || `features/legacy-${index}.feature`;
|
|
155
154
|
}
|
|
@@ -373,11 +372,11 @@ function parseLegacyValue(parsed, source, options = {}) {
|
|
|
373
372
|
const statuses = [];
|
|
374
373
|
let attachmentCounter = 0;
|
|
375
374
|
const meta = {
|
|
376
|
-
protocolVersion:
|
|
375
|
+
protocolVersion: "",
|
|
377
376
|
implementation: { name: "tolkira-legacy-json" },
|
|
378
|
-
runtime: { name: "
|
|
379
|
-
os: { name:
|
|
380
|
-
cpu: { name:
|
|
377
|
+
runtime: { name: "" },
|
|
378
|
+
os: { name: "" },
|
|
379
|
+
cpu: { name: "" }
|
|
381
380
|
};
|
|
382
381
|
envelopes.push({ meta });
|
|
383
382
|
envelopes.push({ testRunStarted: { id: runId, timestamp: timestamp(startedAt) } });
|
|
@@ -589,7 +588,7 @@ function parseLegacyValue(parsed, source, options = {}) {
|
|
|
589
588
|
envelopes.push({
|
|
590
589
|
gherkinDocument: { uri, feature: featureNode, comments: [] }
|
|
591
590
|
});
|
|
592
|
-
envelopes.push(
|
|
591
|
+
for (const envelope of scenarioEnvelopes) envelopes.push(envelope);
|
|
593
592
|
}
|
|
594
593
|
const success = !statuses.some(
|
|
595
594
|
(status) => status === TestStepResultStatus.FAILED || status === TestStepResultStatus.AMBIGUOUS || status === TestStepResultStatus.UNDEFINED
|
|
@@ -884,7 +883,7 @@ function looksLikeJUnit(content) {
|
|
|
884
883
|
const trimmed = content.replace(/^\uFEFF/, "").trimStart();
|
|
885
884
|
return trimmed.startsWith("<") && /<testsuites?\b/i.test(trimmed);
|
|
886
885
|
}
|
|
887
|
-
async function parseJUnitXml(content, source) {
|
|
886
|
+
async function parseJUnitXml(content, source, options = {}) {
|
|
888
887
|
const { XMLParser, XMLValidator } = await import("fast-xml-parser");
|
|
889
888
|
assertValidEntities(content, source);
|
|
890
889
|
const validation = XMLValidator.validate(content);
|
|
@@ -921,7 +920,9 @@ async function parseJUnitXml(content, source) {
|
|
|
921
920
|
const legacy = suites.map(
|
|
922
921
|
(suite, index) => featureFromSuite(suite, source, index)
|
|
923
922
|
);
|
|
924
|
-
const envelopes = parseLegacyValue(legacy, source, {
|
|
923
|
+
const envelopes = parseLegacyValue(legacy, source, {
|
|
924
|
+
idPrefix: options.idPrefix ?? "junit"
|
|
925
|
+
});
|
|
925
926
|
for (const envelope of envelopes) {
|
|
926
927
|
if (envelope.meta) {
|
|
927
928
|
envelope.meta.implementation = { name: "JUnit XML", version: "" };
|
|
@@ -1165,7 +1166,7 @@ function sniffLegacy(content) {
|
|
|
1165
1166
|
}
|
|
1166
1167
|
}
|
|
1167
1168
|
function looksLikeMessages(content) {
|
|
1168
|
-
const firstLine = content.split(/\r?\n
|
|
1169
|
+
const firstLine = content.replace(/^\uFEFF/, "").split(/\r?\n/, 20).map((line) => line.trim()).find(Boolean);
|
|
1169
1170
|
if (!firstLine) return false;
|
|
1170
1171
|
try {
|
|
1171
1172
|
return isEnvelopeLike(JSON.parse(firstLine));
|
|
@@ -1189,7 +1190,23 @@ async function canonicalPath(file) {
|
|
|
1189
1190
|
return path2.resolve(file);
|
|
1190
1191
|
}
|
|
1191
1192
|
}
|
|
1192
|
-
|
|
1193
|
+
function collectGherkinIds(value) {
|
|
1194
|
+
const ids = [];
|
|
1195
|
+
const visit = (node) => {
|
|
1196
|
+
if (Array.isArray(node)) {
|
|
1197
|
+
for (const child of node) visit(child);
|
|
1198
|
+
return;
|
|
1199
|
+
}
|
|
1200
|
+
if (!node || typeof node !== "object") return;
|
|
1201
|
+
for (const [key, child] of Object.entries(node)) {
|
|
1202
|
+
if (key === "id" && typeof child === "string") ids.push(child);
|
|
1203
|
+
else visit(child);
|
|
1204
|
+
}
|
|
1205
|
+
};
|
|
1206
|
+
visit(value);
|
|
1207
|
+
return ids;
|
|
1208
|
+
}
|
|
1209
|
+
async function loadInputs(inputs) {
|
|
1193
1210
|
const requested = Array.isArray(inputs) ? inputs : [inputs];
|
|
1194
1211
|
if (requested.length === 0) {
|
|
1195
1212
|
throw new Error("No input files provided.");
|
|
@@ -1220,7 +1237,7 @@ async function loadEnvelopes(inputs) {
|
|
|
1220
1237
|
const ordered = [...files.values()].sort(
|
|
1221
1238
|
(a, b) => a.file.localeCompare(b.file)
|
|
1222
1239
|
);
|
|
1223
|
-
const
|
|
1240
|
+
const groups = [];
|
|
1224
1241
|
const seenContent = /* @__PURE__ */ new Set();
|
|
1225
1242
|
let totalBytes = 0;
|
|
1226
1243
|
for (const [index, input] of ordered.entries()) {
|
|
@@ -1237,41 +1254,105 @@ async function loadEnvelopes(inputs) {
|
|
|
1237
1254
|
totalBytes += info.size;
|
|
1238
1255
|
const extension = path2.extname(input.file).toLowerCase();
|
|
1239
1256
|
const legacy = sniffLegacy(content);
|
|
1257
|
+
let parsed = [];
|
|
1240
1258
|
if (legacy?.kind === "legacy") {
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
);
|
|
1246
|
-
continue;
|
|
1247
|
-
}
|
|
1248
|
-
if (legacy?.kind === "malformed") {
|
|
1259
|
+
parsed = parseLegacyValue(legacy.parsed, input.file, {
|
|
1260
|
+
idPrefix: `legacy-${index}`
|
|
1261
|
+
});
|
|
1262
|
+
} else if (legacy?.kind === "malformed") {
|
|
1249
1263
|
parseLegacyJson(content, input.file, { idPrefix: `legacy-${index}` });
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1264
|
+
} else if (looksLikeJUnit(content)) {
|
|
1265
|
+
parsed = await parseJUnitXml(content, input.file, {
|
|
1266
|
+
idPrefix: `junit-${index}`
|
|
1267
|
+
});
|
|
1268
|
+
} else if (looksLikeMessages(content)) {
|
|
1269
|
+
parsed = parseMessages(content, input.file);
|
|
1270
|
+
} else if (input.explicit && extension === ".xml") {
|
|
1271
|
+
await parseJUnitXml(content, input.file, { idPrefix: `junit-${index}` });
|
|
1272
|
+
} else {
|
|
1273
|
+
if (input.explicit && MESSAGES_EXTENSIONS.has(extension) && content.trim().length === 0) {
|
|
1274
|
+
throw new Error(`Input is empty: ${input.file}`);
|
|
1275
|
+
}
|
|
1276
|
+
if (input.explicit) {
|
|
1277
|
+
invalidJson(content, input.file);
|
|
1278
|
+
}
|
|
1279
|
+
if (MESSAGES_EXTENSIONS.has(extension)) {
|
|
1280
|
+
parseMessages(content, input.file);
|
|
1281
|
+
}
|
|
1255
1282
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1283
|
+
groups.push({ file: input.file, envelopes: parsed });
|
|
1284
|
+
}
|
|
1285
|
+
if (groups.every((group) => group.envelopes.length === 0)) {
|
|
1286
|
+
throw new Error("No supported report files found.");
|
|
1287
|
+
}
|
|
1288
|
+
const seenIds = /* @__PURE__ */ new Map();
|
|
1289
|
+
for (const group of groups) {
|
|
1290
|
+
const file = path2.basename(group.file);
|
|
1291
|
+
for (const envelope of group.envelopes) {
|
|
1292
|
+
const ids = [
|
|
1293
|
+
["pickle", envelope.pickle?.id],
|
|
1294
|
+
["testCase", envelope.testCase?.id],
|
|
1295
|
+
["testCaseStarted", envelope.testCaseStarted?.id],
|
|
1296
|
+
["hook", envelope.hook?.id]
|
|
1297
|
+
];
|
|
1298
|
+
for (const step of envelope.testCase?.testSteps ?? []) {
|
|
1299
|
+
ids.push(["testStep", step.id]);
|
|
1300
|
+
}
|
|
1301
|
+
for (const id of collectGherkinIds(envelope.gherkinDocument)) {
|
|
1302
|
+
ids.push(["gherkin", id]);
|
|
1303
|
+
}
|
|
1304
|
+
for (const [kind, id] of ids) {
|
|
1305
|
+
if (!id) continue;
|
|
1306
|
+
const key = `${kind}:${id}`;
|
|
1307
|
+
const previous = seenIds.get(key);
|
|
1308
|
+
if (previous) {
|
|
1309
|
+
throw new Error(
|
|
1310
|
+
`Duplicate Cucumber Messages ${kind} id in ${previous} and ${file}. Merge the streams before splitting or use unique ids.`
|
|
1311
|
+
);
|
|
1312
|
+
}
|
|
1313
|
+
seenIds.set(key, file);
|
|
1314
|
+
}
|
|
1259
1315
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1316
|
+
}
|
|
1317
|
+
return groups;
|
|
1318
|
+
}
|
|
1319
|
+
async function loadEnvelopes(inputs) {
|
|
1320
|
+
return (await loadInputs(inputs)).flatMap((group) => group.envelopes);
|
|
1321
|
+
}
|
|
1322
|
+
function provenanceFor(groups) {
|
|
1323
|
+
const names = /* @__PURE__ */ new Map();
|
|
1324
|
+
for (const group of groups) {
|
|
1325
|
+
if (!group.envelopes.some(
|
|
1326
|
+
(envelope) => envelope.gherkinDocument || envelope.pickle
|
|
1327
|
+
)) {
|
|
1262
1328
|
continue;
|
|
1263
1329
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1330
|
+
const name = path2.basename(group.file);
|
|
1331
|
+
const set = names.get(name) ?? /* @__PURE__ */ new Set();
|
|
1332
|
+
set.add(group.file);
|
|
1333
|
+
names.set(name, set);
|
|
1334
|
+
}
|
|
1335
|
+
const ambiguous = new Set(
|
|
1336
|
+
[...names.entries()].filter(([, files]) => files.size > 1).map(([name]) => name)
|
|
1337
|
+
);
|
|
1338
|
+
const uriFiles = /* @__PURE__ */ new Map();
|
|
1339
|
+
for (const group of groups) {
|
|
1340
|
+
const name = path2.basename(group.file);
|
|
1341
|
+
if (ambiguous.has(name)) continue;
|
|
1342
|
+
for (const envelope of group.envelopes) {
|
|
1343
|
+
for (const uri of [envelope.gherkinDocument?.uri, envelope.pickle?.uri]) {
|
|
1344
|
+
if (!uri) continue;
|
|
1345
|
+
const set = uriFiles.get(uri) ?? /* @__PURE__ */ new Set();
|
|
1346
|
+
set.add(name);
|
|
1347
|
+
uriFiles.set(uri, set);
|
|
1348
|
+
}
|
|
1269
1349
|
}
|
|
1270
1350
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1351
|
+
const provenance = /* @__PURE__ */ new Map();
|
|
1352
|
+
for (const [uri, files] of uriFiles) {
|
|
1353
|
+
if (files.size === 1) provenance.set(uri, [...files][0]);
|
|
1273
1354
|
}
|
|
1274
|
-
return
|
|
1355
|
+
return provenance;
|
|
1275
1356
|
}
|
|
1276
1357
|
|
|
1277
1358
|
// src/render/html.ts
|
|
@@ -1382,6 +1463,9 @@ var STATUS_ORDER = [
|
|
|
1382
1463
|
TestStepResultStatus3.AMBIGUOUS,
|
|
1383
1464
|
TestStepResultStatus3.FAILED
|
|
1384
1465
|
];
|
|
1466
|
+
function statusSeverity(status) {
|
|
1467
|
+
return STATUS_ORDER.indexOf(status.toUpperCase());
|
|
1468
|
+
}
|
|
1385
1469
|
var VALID_STATUS = /* @__PURE__ */ new Set([
|
|
1386
1470
|
"passed",
|
|
1387
1471
|
"failed",
|
|
@@ -1399,12 +1483,22 @@ function durationMs(duration2) {
|
|
|
1399
1483
|
if (!duration2) return 0;
|
|
1400
1484
|
const seconds = Number.isFinite(duration2.seconds) ? duration2.seconds : 0;
|
|
1401
1485
|
const nanos = Number.isFinite(duration2.nanos) ? duration2.nanos : 0;
|
|
1402
|
-
|
|
1486
|
+
const milliseconds = seconds * 1e3 + nanos / 1e6;
|
|
1487
|
+
if (!Number.isFinite(milliseconds) || milliseconds <= 0) return 0;
|
|
1488
|
+
const rounded = Math.round(milliseconds * 1e3) / 1e3;
|
|
1489
|
+
return Number.isFinite(rounded) ? rounded : 0;
|
|
1490
|
+
}
|
|
1491
|
+
function finiteDuration(value) {
|
|
1492
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
1493
|
+
const rounded = Math.round(value * 1e3) / 1e3;
|
|
1494
|
+
return Number.isFinite(rounded) ? rounded : 0;
|
|
1403
1495
|
}
|
|
1404
1496
|
function timestampIso(timestamp2) {
|
|
1405
1497
|
if (!timestamp2) return void 0;
|
|
1406
1498
|
const milliseconds = timestamp2.seconds * 1e3 + timestamp2.nanos / 1e6;
|
|
1407
|
-
|
|
1499
|
+
if (!Number.isFinite(milliseconds)) return void 0;
|
|
1500
|
+
const date = new Date(milliseconds);
|
|
1501
|
+
return Number.isNaN(date.getTime()) ? void 0 : date.toISOString();
|
|
1408
1502
|
}
|
|
1409
1503
|
function normalizeText2(value) {
|
|
1410
1504
|
return (value ?? "").replace(/\r\n/g, "\n");
|
|
@@ -1540,8 +1634,10 @@ function featureTree(document) {
|
|
|
1540
1634
|
visit(document.children ?? []);
|
|
1541
1635
|
return map;
|
|
1542
1636
|
}
|
|
1543
|
-
function buildReportModel(envelopes) {
|
|
1637
|
+
function buildReportModel(envelopes, provenance) {
|
|
1544
1638
|
const features = /* @__PURE__ */ new Map();
|
|
1639
|
+
const featureUris = /* @__PURE__ */ new Map();
|
|
1640
|
+
const featureSeen = /* @__PURE__ */ new Set();
|
|
1545
1641
|
const featureOrder = [];
|
|
1546
1642
|
const scenarioTree = /* @__PURE__ */ new Map();
|
|
1547
1643
|
const featureByScenarioId = /* @__PURE__ */ new Map();
|
|
@@ -1589,8 +1685,12 @@ function buildReportModel(envelopes) {
|
|
|
1589
1685
|
}
|
|
1590
1686
|
if (envelope.gherkinDocument?.feature) {
|
|
1591
1687
|
const feature = envelope.gherkinDocument.feature;
|
|
1592
|
-
|
|
1593
|
-
|
|
1688
|
+
const uri = envelope.gherkinDocument.uri;
|
|
1689
|
+
const key = uri ?? feature.name;
|
|
1690
|
+
if (!features.has(key)) features.set(key, feature);
|
|
1691
|
+
if (!featureSeen.has(feature)) {
|
|
1692
|
+
featureSeen.add(feature);
|
|
1693
|
+
if (uri) featureUris.set(feature, uri);
|
|
1594
1694
|
featureOrder.push(feature);
|
|
1595
1695
|
}
|
|
1596
1696
|
for (const [id, value] of featureTree(feature)) {
|
|
@@ -1728,8 +1828,8 @@ function buildReportModel(envelopes) {
|
|
|
1728
1828
|
featureName: feature?.name ?? pickle.uri,
|
|
1729
1829
|
...tree?.ruleName ? { ruleName: tree.ruleName } : {},
|
|
1730
1830
|
status,
|
|
1731
|
-
durationMs:
|
|
1732
|
-
attempt: latest.attempt,
|
|
1831
|
+
durationMs: finiteDuration(duration2),
|
|
1832
|
+
attempt: Number.isFinite(latest.attempt) ? latest.attempt : 0,
|
|
1733
1833
|
...timestampIso(latest.timestamp) ? { startedAt: timestampIso(latest.timestamp) } : {},
|
|
1734
1834
|
tags: pickle.tags.map((tag) => tag.name),
|
|
1735
1835
|
steps: stepRows,
|
|
@@ -1746,16 +1846,26 @@ function buildReportModel(envelopes) {
|
|
|
1746
1846
|
}
|
|
1747
1847
|
}
|
|
1748
1848
|
const featureRows = [];
|
|
1849
|
+
const inInputOrder = new Set(featureOrder);
|
|
1749
1850
|
const orderedFeatures = [
|
|
1750
1851
|
...featureOrder,
|
|
1751
|
-
...[...featureScenarios.keys()].filter(
|
|
1852
|
+
...[...featureScenarios.keys()].filter(
|
|
1853
|
+
(feature) => !inInputOrder.has(feature)
|
|
1854
|
+
)
|
|
1752
1855
|
];
|
|
1753
1856
|
for (const feature of orderedFeatures) {
|
|
1754
1857
|
const scenarios = featureScenarios.get(feature) ?? [];
|
|
1755
1858
|
if (scenarios.length === 0) continue;
|
|
1756
|
-
const status = scenarios.reduce((worst, scenario) => {
|
|
1757
|
-
|
|
1758
|
-
|
|
1859
|
+
const status = scenarios.some((scenario) => scenario.status !== "passed") ? scenarios.reduce((worst, scenario) => {
|
|
1860
|
+
if (scenario.status === "passed") return worst;
|
|
1861
|
+
return statusSeverity(scenario.status) > statusSeverity(worst) ? scenario.status : worst;
|
|
1862
|
+
}, "unknown") : "passed";
|
|
1863
|
+
const featureUri = featureUris.get(feature) ?? scenarios[0]?.uri ?? "";
|
|
1864
|
+
const sourceFiles = /* @__PURE__ */ new Set([
|
|
1865
|
+
...scenarios.map((scenario) => provenance?.get(scenario.uri)),
|
|
1866
|
+
provenance?.get(featureUri)
|
|
1867
|
+
]);
|
|
1868
|
+
const sourceFile = sourceFiles.size === 1 && !sourceFiles.has(void 0) ? [...sourceFiles][0] : void 0;
|
|
1759
1869
|
featureRows.push({
|
|
1760
1870
|
id: `feature-${featureRows.length + 1}`,
|
|
1761
1871
|
name: feature.name,
|
|
@@ -1764,11 +1874,17 @@ function buildReportModel(envelopes) {
|
|
|
1764
1874
|
description: normalizeText2(feature.description),
|
|
1765
1875
|
tags: feature.tags.map((tag) => tag.name),
|
|
1766
1876
|
status,
|
|
1767
|
-
durationMs:
|
|
1877
|
+
durationMs: finiteDuration(
|
|
1878
|
+
scenarios.reduce((sum, scenario) => sum + scenario.durationMs, 0)
|
|
1879
|
+
),
|
|
1768
1880
|
scenarios,
|
|
1769
|
-
attachments: scenarios.reduce((sum, scenario) => sum + scenario.attachments.length, 0)
|
|
1881
|
+
attachments: scenarios.reduce((sum, scenario) => sum + scenario.attachments.length, 0),
|
|
1882
|
+
...sourceFile ? { sourceFile } : {}
|
|
1770
1883
|
});
|
|
1771
1884
|
}
|
|
1885
|
+
if (featureRows.some((feature) => !feature.sourceFile)) {
|
|
1886
|
+
for (const feature of featureRows) delete feature.sourceFile;
|
|
1887
|
+
}
|
|
1772
1888
|
const attachmentRows = scenarioRows.flatMap((scenario) => scenario.attachments);
|
|
1773
1889
|
const runAttachments = mapAttachments(attachments.get("") ?? []);
|
|
1774
1890
|
const allAttachments = [...attachmentRows, ...runAttachments];
|
|
@@ -1783,7 +1899,9 @@ function buildReportModel(envelopes) {
|
|
|
1783
1899
|
attachments: allAttachments.length,
|
|
1784
1900
|
attachmentBytes: allAttachments.reduce((sum, attachment) => sum + attachment.bytes, 0)
|
|
1785
1901
|
},
|
|
1786
|
-
durationMs:
|
|
1902
|
+
durationMs: finiteDuration(
|
|
1903
|
+
scenarioRows.reduce((sum, scenario) => sum + scenario.durationMs, 0)
|
|
1904
|
+
),
|
|
1787
1905
|
...startedAt ? { startedAt } : {},
|
|
1788
1906
|
...finishedAt ? { finishedAt } : {},
|
|
1789
1907
|
source,
|
|
@@ -1861,7 +1979,15 @@ function durationMs2(duration2) {
|
|
|
1861
1979
|
if (!duration2) return 0;
|
|
1862
1980
|
const seconds = Number.isFinite(duration2.seconds) ? duration2.seconds : 0;
|
|
1863
1981
|
const nanos = Number.isFinite(duration2.nanos) ? duration2.nanos : 0;
|
|
1864
|
-
|
|
1982
|
+
const milliseconds = seconds * 1e3 + nanos / 1e6;
|
|
1983
|
+
if (!Number.isFinite(milliseconds) || milliseconds <= 0) return 0;
|
|
1984
|
+
const rounded = Math.round(milliseconds * 1e3) / 1e3;
|
|
1985
|
+
return Number.isFinite(rounded) ? rounded : 0;
|
|
1986
|
+
}
|
|
1987
|
+
function finiteDuration2(value) {
|
|
1988
|
+
if (!Number.isFinite(value) || value <= 0) return 0;
|
|
1989
|
+
const rounded = Math.round(value * 1e3) / 1e3;
|
|
1990
|
+
return Number.isFinite(rounded) ? rounded : 0;
|
|
1865
1991
|
}
|
|
1866
1992
|
function scenarioStatus(results) {
|
|
1867
1993
|
if (results.length === 0) return "unknown";
|
|
@@ -1871,13 +1997,14 @@ function statusOrdinal(status) {
|
|
|
1871
1997
|
return STATUS_ORDER2.indexOf(status.toUpperCase());
|
|
1872
1998
|
}
|
|
1873
1999
|
function displayUri(uri) {
|
|
1874
|
-
const normalized = uri.replace(/\\/g, "/");
|
|
2000
|
+
const normalized = uri.replace(/\\/g, "/").replace(/^file:\/\/+/i, "");
|
|
1875
2001
|
if (!/^[a-z]:\//i.test(normalized) && !normalized.startsWith("/")) {
|
|
1876
2002
|
return normalized;
|
|
1877
2003
|
}
|
|
1878
2004
|
const marker = normalized.lastIndexOf("/features/");
|
|
1879
2005
|
if (marker >= 0) return normalized.slice(marker + 1);
|
|
1880
|
-
|
|
2006
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
2007
|
+
return parts[parts.length - 1] ?? uri;
|
|
1881
2008
|
}
|
|
1882
2009
|
function featureTree2(document) {
|
|
1883
2010
|
const stepKeywords = /* @__PURE__ */ new Map();
|
|
@@ -2054,7 +2181,7 @@ function summarizeEnvelopes(input) {
|
|
|
2054
2181
|
uri: displayUri(pickle.uri ?? ""),
|
|
2055
2182
|
feature: tree.featureName,
|
|
2056
2183
|
status,
|
|
2057
|
-
durationMs:
|
|
2184
|
+
durationMs: finiteDuration2(scenarioDuration),
|
|
2058
2185
|
attempt: started?.attempt ?? 0,
|
|
2059
2186
|
tags: (pickle.tags ?? []).map((tag) => tag.name),
|
|
2060
2187
|
attachments: scenarioAttachments.length,
|
|
@@ -2074,7 +2201,7 @@ function summarizeEnvelopes(input) {
|
|
|
2074
2201
|
return {
|
|
2075
2202
|
schemaVersion: SUMMARY_SCHEMA_VERSION,
|
|
2076
2203
|
status: overall,
|
|
2077
|
-
durationMs:
|
|
2204
|
+
durationMs: finiteDuration2(totalDuration),
|
|
2078
2205
|
counts: {
|
|
2079
2206
|
features: featureSet.size,
|
|
2080
2207
|
scenarios: scenarioCounts,
|
|
@@ -2107,7 +2234,7 @@ function isLogoDataUri(value) {
|
|
|
2107
2234
|
|
|
2108
2235
|
// src/render/escape.ts
|
|
2109
2236
|
function escapeHtml(value) {
|
|
2110
|
-
return value.replace(/[&<>"']/g, (character) => {
|
|
2237
|
+
return String(value ?? "").replace(/[&<>"']/g, (character) => {
|
|
2111
2238
|
switch (character) {
|
|
2112
2239
|
case "&":
|
|
2113
2240
|
return "&";
|
|
@@ -2217,13 +2344,56 @@ img, video { max-width: 100%; height: auto; }
|
|
|
2217
2344
|
.expand { display: flex; gap: 0.25rem; margin-left: auto; }
|
|
2218
2345
|
.expand button { min-height: 1.875rem; padding: 0 0.5rem; border: 0; background: transparent; color: var(--muted); font-size: 0.75rem; text-decoration: underline; text-underline-offset: 0.16em; }
|
|
2219
2346
|
.live { margin: 0.625rem 0 0; color: var(--muted); font-size: 0.75rem; }
|
|
2347
|
+
.searchNote { margin: 0.5rem 0 0; color: var(--muted); font-size: 0.75rem; }
|
|
2348
|
+
.triageBox { margin: 1.25rem 0 1.5rem; }
|
|
2349
|
+
.triageBox > summary { display: none; }
|
|
2350
|
+
.triageSummary { align-items: baseline; gap: 0.25rem 0.5rem; }
|
|
2351
|
+
.triageSummary .triageTitle { font-weight: 600; }
|
|
2352
|
+
.triageSummaryLead { color: var(--muted); font-size: 0.8125rem; }
|
|
2353
|
+
.triageSummary .chev { margin-left: auto; }
|
|
2354
|
+
.triageBox .triage { margin: 0; }
|
|
2355
|
+
.triage { margin: 1.25rem 0 1.5rem; padding: 1.125rem 1.25rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); }
|
|
2356
|
+
.triage h2 { margin: 0; font-size: 1.125rem; line-height: 1.3; }
|
|
2357
|
+
.triageLead { margin: 0.25rem 0 0.875rem; color: var(--muted); font-size: 0.8125rem; }
|
|
2358
|
+
.triageList { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.875rem; }
|
|
2359
|
+
.triageItem { display: grid; gap: 0.25rem; min-width: 0; padding-top: 0.875rem; border-top: 1px solid var(--line); }
|
|
2360
|
+
.triageItem:first-child { padding-top: 0; border-top: 0; }
|
|
2361
|
+
.triageFeature { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.375rem 0.5rem; min-width: 0; min-height: 1.5rem; padding-block: 0.125rem; color: var(--ink); font-size: 0.875rem; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
|
|
2362
|
+
.triageFeature:hover { text-decoration: underline; text-underline-offset: 0.16em; }
|
|
2363
|
+
.triageCounts { margin: 0; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
|
|
2364
|
+
.triageScenarios { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.875rem; margin: 0.125rem 0 0; padding: 0; list-style: none; }
|
|
2365
|
+
.triageScenarios a { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: baseline; gap: 0 0.375rem; min-width: 0; min-height: 1.5rem; padding-block: 0.125rem; color: var(--ink-2); font-size: 0.8125rem; text-decoration: underline; text-decoration-color: color-mix(in oklab, var(--line-strong) 70%, transparent); text-underline-offset: 0.16em; overflow-wrap: anywhere; }
|
|
2366
|
+
.triageScenarios a:hover { color: var(--ink); text-decoration-color: currentColor; }
|
|
2367
|
+
.triageStatus { flex: none; font-size: 0.6875rem; font-weight: 500; letter-spacing: 0.01em; }
|
|
2368
|
+
.triageStatus.pass { color: var(--pass); } .triageStatus.fail { color: var(--fail); } .triageStatus.pending { color: var(--pending); } .triageStatus.undefined { color: var(--undefined); } .triageStatus.ambiguous, .triageStatus.skipped, .triageStatus.unknown { color: var(--muted); }
|
|
2369
|
+
.triageMore { color: var(--muted); font-size: 0.75rem; }
|
|
2370
|
+
.triageReason { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
|
|
2371
|
+
.triageReasonLabel { color: var(--ink-2); font-weight: 500; }
|
|
2372
|
+
.triageRest { margin-top: 0.75rem; }
|
|
2373
|
+
.triageRest > summary { min-height: 1.5rem; padding-block: 0.125rem; color: var(--accent-text); font-size: 0.8125rem; cursor: pointer; }
|
|
2374
|
+
.triageRest .triageList { margin-top: 0.75rem; }
|
|
2375
|
+
.sources { margin: 0 0 1.5rem; }
|
|
2376
|
+
.sources h2 { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
|
|
2377
|
+
.sourceList { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
|
|
2378
|
+
.sourceItem { min-width: 0; padding: 0.75rem 0.875rem; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface-2); }
|
|
2379
|
+
.sourceHead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.5rem; }
|
|
2380
|
+
.sourceName { color: var(--ink); font-size: 0.8125rem; font-weight: 600; overflow-wrap: anywhere; }
|
|
2381
|
+
.sourceCounts { margin: 0.25rem 0 0.5rem; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
|
|
2382
|
+
.sourceItem .bar { margin: 0; height: 0.25rem; }
|
|
2220
2383
|
.feature { border-bottom: 1px solid var(--line-strong); background: transparent; container-type: inline-size; }
|
|
2221
|
-
.feature > summary { display: grid; grid-template-columns: minmax(5.5rem, max-content) minmax(0, 1fr)
|
|
2384
|
+
.feature > summary { display: grid; grid-template-columns: minmax(5.5rem, max-content) minmax(0, 1fr) 1.25rem; gap: 0.25rem 0.75rem; align-items: start; padding: 1rem 0; list-style: none; cursor: pointer; }
|
|
2385
|
+
.feature > summary .statusCell { grid-column: 1; grid-row: 1 / span 2; align-self: start; }
|
|
2386
|
+
.feature > summary h2 { grid-column: 2; grid-row: 1; }
|
|
2387
|
+
.feature > summary .chev { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
|
|
2388
|
+
.featureShape { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; min-width: 0; }
|
|
2389
|
+
.featureCounts { color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
|
|
2390
|
+
.featureShape .bar { flex: 1 1 6rem; max-width: 16rem; margin: 0; height: 0.25rem; }
|
|
2391
|
+
.featureSource { color: var(--muted); font-size: 0.6875rem; }
|
|
2392
|
+
.featureUri { color: var(--muted); font-size: 0.6875rem; overflow-wrap: anywhere; }
|
|
2222
2393
|
.feature > summary::-webkit-details-marker, .scenarioButton::-webkit-details-marker { display: none; }
|
|
2223
2394
|
.feature > summary:focus-visible, .scenarioButton:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
|
|
2224
2395
|
.feature > summary:hover { background: color-mix(in oklab, var(--surface-2) 70%, var(--paper)); }
|
|
2225
2396
|
.feature h2 { margin: 0; min-width: 0; font-size: 1rem; line-height: 1.3; font-weight: 600; overflow-wrap: break-word; }
|
|
2226
|
-
.feature .fmeta { color: var(--muted); font-size: 0.75rem; text-align: right; font-variant-numeric: tabular-nums; }
|
|
2227
2397
|
.statusCell { display: flex; align-items: center; }
|
|
2228
2398
|
.statusText { display: inline-flex; align-items: center; justify-content: center; min-width: 3.875rem; min-height: 1.375rem; padding: 0 0.4375rem; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface-3); color: var(--muted); font-size: 0.6875rem; font-weight: 500; }
|
|
2229
2399
|
.statusText.pass { color: var(--pass); border-color: color-mix(in oklab, var(--pass) 32%, var(--line)); background: var(--pass-soft); }
|
|
@@ -2237,7 +2407,7 @@ details[open] > summary .chev { transform: rotate(180deg); }
|
|
|
2237
2407
|
.scenario:last-child { border-bottom: 0; }
|
|
2238
2408
|
.scenarioButton { width: 100%; display: grid; grid-template-columns: minmax(5.5rem, max-content) 6rem minmax(0, 1fr) auto 1.25rem; gap: 0.75rem; align-items: center; padding: 0.75rem 0; border: 0; background: transparent; color: inherit; text-align: left; list-style: none; cursor: pointer; }
|
|
2239
2409
|
.scenarioButton:hover { background: color-mix(in oklab, var(--surface-2) 70%, var(--paper)); }
|
|
2240
|
-
details[open] > summary.scenarioButton { background: var(--
|
|
2410
|
+
details[open] > summary.scenarioButton { background: var(--surface-2); }
|
|
2241
2411
|
.scenarioMain { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
|
|
2242
2412
|
.scenarioName { margin: 0; font-size: 0.875rem; line-height: 1.4; font-weight: 500; overflow-wrap: break-word; }
|
|
2243
2413
|
.scenarioSub { display: block; color: var(--muted); font-size: 0.75rem; }
|
|
@@ -2282,7 +2452,7 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
|
|
|
2282
2452
|
.attachmentText summary { cursor: pointer; color: var(--accent-text); font-size: 0.75rem; }
|
|
2283
2453
|
.attachmentText pre { margin: 0.5rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.6875rem/1.45 var(--font-mono); color: var(--ink); }
|
|
2284
2454
|
.fileLink { display: inline-block; margin: 0.3125rem 0; color: var(--accent-text); font-size: 0.75rem; }
|
|
2285
|
-
.meta span, .
|
|
2455
|
+
.meta span, .path, .description, .step, .featureSource, .featureUri, .fileLink, .attachment figcaption, .attachmentText summary, .detailMeta span { overflow-wrap: anywhere; }
|
|
2286
2456
|
.detailMeta { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin-top: 0.75rem; color: var(--muted); font-size: 0.6875rem; font-variant-numeric: tabular-nums; }
|
|
2287
2457
|
.empty { margin: 1.5rem 0; padding: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface-2); color: var(--muted); font-size: 0.875rem; }
|
|
2288
2458
|
.foot { margin-top: 1.75rem; color: var(--muted); font-size: 0.75rem; }
|
|
@@ -2293,12 +2463,19 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
|
|
|
2293
2463
|
.panel h2 { margin: 0 0 0.375rem; font-size: 1.125rem; }
|
|
2294
2464
|
.panel h2.subhead { margin: 1.25rem 0 0.5rem; font-size: 1rem; }
|
|
2295
2465
|
.panel p { margin: 0 0 0.75rem; color: var(--muted); font-size: 0.8125rem; }
|
|
2296
|
-
.featureTable { width: 100%; min-width:
|
|
2466
|
+
.featureTable { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: 0.8125rem; }
|
|
2297
2467
|
.featureTable th { text-align: left; color: var(--muted); font-size: 0.6875rem; font-weight: 500; padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--line-strong); }
|
|
2468
|
+
.featureTable th:not(:first-child) { text-align: right; }
|
|
2469
|
+
.featureTable th[scope="row"] { width: 38%; color: var(--ink); font-size: 0.8125rem; font-weight: 400; overflow-wrap: anywhere; }
|
|
2470
|
+
.featureTable .matrixName { display: block; }
|
|
2471
|
+
.featureTable .matrixUri { display: block; color: var(--muted); font-size: 0.6875rem; overflow-wrap: anywhere; }
|
|
2472
|
+
.featureTable th:first-child, .featureTable td:first-child { width: 38%; overflow-wrap: anywhere; }
|
|
2298
2473
|
.featureTable td { padding: 0.5rem 0.5rem 0.5rem 0; border-bottom: 1px solid var(--line); }
|
|
2299
2474
|
.featureTable td:last-child, .featureTable th:last-child { text-align: right; }
|
|
2300
2475
|
.featureTable tr:last-child td { border-bottom: 0; }
|
|
2301
2476
|
.featureTable .num { text-align: right; font-family: var(--font-mono); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
|
|
2477
|
+
.featureTable .zero { color: var(--muted); }
|
|
2478
|
+
.matrixHint { display: none; }
|
|
2302
2479
|
.legend { display: grid; gap: 0.375rem; margin-top: 0.625rem; }
|
|
2303
2480
|
.legendRow { display: grid; grid-template-columns: 0.625rem minmax(0, 1fr) auto; gap: 0.5rem; align-items: center; font-size: 0.8125rem; border-radius: 5px; padding: 0.375rem 0.5rem; background: var(--surface-3); }
|
|
2304
2481
|
.legendRow.pass { background: var(--pass-soft); } .legendRow.fail { background: var(--fail-soft); } .legendRow.pending { background: var(--pending-soft); } .legendRow.undefined { background: var(--undefined-soft); } .legendRow.ambiguous, .legendRow.skipped, .legendRow.unknown { background: var(--surface-3); }
|
|
@@ -2315,7 +2492,7 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
|
|
|
2315
2492
|
.runHead { grid-template-columns: 1fr; gap: 1.25rem; }
|
|
2316
2493
|
.health { border-left: 0; border-top: 1px solid var(--line-strong); padding: 1rem 0 0; }
|
|
2317
2494
|
.feature > summary { grid-template-columns: 4.75rem minmax(0, 1fr) 1.25rem; }
|
|
2318
|
-
.
|
|
2495
|
+
.featureUri { display: none; }
|
|
2319
2496
|
.scenarioButton { grid-template-columns: minmax(3.5rem, max-content) 2.75rem minmax(0, 1fr) 1.125rem; grid-template-areas: "status thumb title chev" "status thumb meta chev"; gap: 0.25rem 0.5rem; align-items: start; }
|
|
2320
2497
|
.scenarioButton .statusCell { grid-area: status; align-self: start; }
|
|
2321
2498
|
.scenarioButton .thumbCell { grid-area: thumb; align-self: start; }
|
|
@@ -2338,14 +2515,21 @@ details[open] > summary.scenarioButton { background: var(--accent-soft); }
|
|
|
2338
2515
|
.thumb { width: 2.5rem; height: 1.875rem; }
|
|
2339
2516
|
.statusText { min-width: 3.125rem; }
|
|
2340
2517
|
.filter { min-height: 1.75rem; }
|
|
2518
|
+
.matrixHint { display: block; margin: 0 0 0.5rem; font-size: 0.75rem; }
|
|
2519
|
+
.triageBox > summary { display: flex; flex-wrap: wrap; padding: 0.875rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface-2); cursor: pointer; }
|
|
2520
|
+
.triageBox .triage { margin: 0.5rem 0 0; }
|
|
2521
|
+
.triageBox .triage h2, .triageBox .triage .triageLead { display: none; }
|
|
2522
|
+
.sources { display: none; }
|
|
2341
2523
|
}
|
|
2342
2524
|
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
|
|
2343
2525
|
@container (max-width: 16rem) {
|
|
2344
2526
|
.runHead h1 { font-size: 1.3rem; }
|
|
2345
|
-
.feature > summary { grid-template-columns: auto 1fr auto; grid-template-areas: "status . chev" "title title title"; gap: 0.5rem; }
|
|
2527
|
+
.feature > summary { grid-template-columns: auto 1fr auto; grid-template-areas: "status . chev" "title title title" "shape shape shape"; gap: 0.5rem; }
|
|
2346
2528
|
.feature > summary .statusCell { grid-area: status; }
|
|
2347
2529
|
.feature > summary h2 { grid-area: title; }
|
|
2348
2530
|
.feature > summary .chev { grid-area: chev; }
|
|
2531
|
+
.featureShape { grid-area: shape; }
|
|
2532
|
+
.triageScenarios a { grid-template-columns: minmax(0, 1fr); gap: 0.125rem; }
|
|
2349
2533
|
.scenarioButton { grid-template-columns: auto auto 1fr auto; grid-template-areas: "status thumb . chev" "title title title title" "meta meta meta meta"; gap: 0.5rem; }
|
|
2350
2534
|
.scenarioButton .statusCell { grid-area: status; }
|
|
2351
2535
|
.scenarioButton .thumbCell { grid-area: thumb; }
|
|
@@ -2410,6 +2594,7 @@ var STEP_GLYPHS = {
|
|
|
2410
2594
|
unknown: "\xB7"
|
|
2411
2595
|
};
|
|
2412
2596
|
function durationLabel(milliseconds) {
|
|
2597
|
+
if (!Number.isFinite(milliseconds) || milliseconds < 0) return "0 ms";
|
|
2413
2598
|
if (milliseconds < 1e3) return `${Math.round(milliseconds * 100) / 100} ms`;
|
|
2414
2599
|
return `${(milliseconds / 1e3).toFixed(2)} s`;
|
|
2415
2600
|
}
|
|
@@ -2433,11 +2618,140 @@ function displayStatuses(model) {
|
|
|
2433
2618
|
(status) => model.counts.scenarios[status] > 0
|
|
2434
2619
|
);
|
|
2435
2620
|
}
|
|
2621
|
+
var TRIAGE_FEATURE_LIMIT = 20;
|
|
2622
|
+
var TRIAGE_SCENARIO_LIMIT = 3;
|
|
2623
|
+
var SOURCE_LIMIT = 6;
|
|
2624
|
+
var SEARCH_MESSAGE_LIMIT = 2e3;
|
|
2625
|
+
function compareStatus(a, b) {
|
|
2626
|
+
const passed = Number(a === "passed") - Number(b === "passed");
|
|
2627
|
+
return passed !== 0 ? passed : statusSeverity(b) - statusSeverity(a);
|
|
2628
|
+
}
|
|
2629
|
+
function bySeverity(items) {
|
|
2630
|
+
return items.map((item, index) => ({ item, index })).sort((a, b) => {
|
|
2631
|
+
const status = compareStatus(a.item.status, b.item.status);
|
|
2632
|
+
return status !== 0 ? status : a.index - b.index;
|
|
2633
|
+
}).map(({ item }) => item);
|
|
2634
|
+
}
|
|
2635
|
+
function orderFeatures(features) {
|
|
2636
|
+
return bySeverity(features).map((feature) => ({
|
|
2637
|
+
feature,
|
|
2638
|
+
scenarios: bySeverity(feature.scenarios)
|
|
2639
|
+
}));
|
|
2640
|
+
}
|
|
2641
|
+
function countStatuses(scenarios) {
|
|
2642
|
+
const counts = {};
|
|
2643
|
+
for (const scenario of scenarios) {
|
|
2644
|
+
counts[scenario.status] = (counts[scenario.status] ?? 0) + 1;
|
|
2645
|
+
}
|
|
2646
|
+
return counts;
|
|
2647
|
+
}
|
|
2648
|
+
function barWidth(count2, total) {
|
|
2649
|
+
return total === 0 ? 0 : Math.round(count2 / total * 1e3) / 10;
|
|
2650
|
+
}
|
|
2651
|
+
function attentionCounts(scenarios) {
|
|
2652
|
+
const counts = /* @__PURE__ */ new Map();
|
|
2653
|
+
for (const scenario of scenarios) {
|
|
2654
|
+
if (scenario.status === "passed") continue;
|
|
2655
|
+
counts.set(scenario.status, (counts.get(scenario.status) ?? 0) + 1);
|
|
2656
|
+
}
|
|
2657
|
+
return [...counts.entries()].sort((a, b) => statusSeverity(b[0]) - statusSeverity(a[0])).map(([status, count2]) => `${count2} ${status}`).join(", ");
|
|
2658
|
+
}
|
|
2659
|
+
function featureBar(scenarios) {
|
|
2660
|
+
const total = scenarios.length;
|
|
2661
|
+
if (total === 0) return "";
|
|
2662
|
+
const counts = countStatuses(scenarios);
|
|
2663
|
+
const segments = ALL_STATUSES.filter((status) => counts[status]).map(
|
|
2664
|
+
(status) => `<i class="${statusClass(status)}" style="width:${barWidth(counts[status] ?? 0, total)}%"></i>`
|
|
2665
|
+
).join("");
|
|
2666
|
+
return `<span class="bar" aria-hidden="true">${segments}</span>`;
|
|
2667
|
+
}
|
|
2668
|
+
function featureShape(feature, scenarios) {
|
|
2669
|
+
const passed = scenarios.filter(
|
|
2670
|
+
(scenario) => scenario.status === "passed"
|
|
2671
|
+
).length;
|
|
2672
|
+
const attention = attentionCounts(scenarios);
|
|
2673
|
+
const counts = `${passed} of ${scenarios.length} passed${attention ? ` \xB7 ${attention}` : ""}`;
|
|
2674
|
+
const source = feature.sourceFile ? `<span class="featureSource">from ${escapeHtml(feature.sourceFile)}</span>` : "";
|
|
2675
|
+
return `<span class="featureShape"><span class="featureCounts">${counts}</span>${featureBar(scenarios)}${source}<span class="featureUri">${escapeHtml(displayUri(feature.uri))}</span></span>`;
|
|
2676
|
+
}
|
|
2677
|
+
function renderTriageRow({
|
|
2678
|
+
feature,
|
|
2679
|
+
scenarios,
|
|
2680
|
+
index
|
|
2681
|
+
}) {
|
|
2682
|
+
const failing = scenarios.filter(
|
|
2683
|
+
(scenario) => scenario.status !== "passed"
|
|
2684
|
+
);
|
|
2685
|
+
const links = failing.slice(0, TRIAGE_SCENARIO_LIMIT).map((scenario) => {
|
|
2686
|
+
const scenarioIndex = scenarios.indexOf(scenario) + 1;
|
|
2687
|
+
return `<li><a class="triageScenario" href="#scenario-${index + 1}-${scenarioIndex}"><span class="triageStatus ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span><span>${escapeHtml(scenario.name)}</span></a></li>`;
|
|
2688
|
+
}).join("");
|
|
2689
|
+
const more = failing.length > TRIAGE_SCENARIO_LIMIT ? `<li class="triageMore">+${failing.length - TRIAGE_SCENARIO_LIMIT} more in the report</li>` : "";
|
|
2690
|
+
const failed = scenarios.find((scenario) => scenario.status === "failed");
|
|
2691
|
+
const failedStep = failed?.steps.find(
|
|
2692
|
+
(step) => step.status === "failed" && step.message
|
|
2693
|
+
);
|
|
2694
|
+
const reason = failedStep?.message ? `${failedStep.keyword ? `${failedStep.keyword} ` : ""}${failedStep.text} \u2014 ${failedStep.message.split(/\r?\n/)[0].trim().slice(0, 120)}${failedStep.message.split(/\r?\n/)[0].trim().length > 120 ? "\u2026" : ""}` : "";
|
|
2695
|
+
return `<li class="triageItem"><a class="triageFeature" href="#feature-${index + 1}" title="${escapeHtml(displayUri(feature.uri))}"><span class="triageStatus ${statusClass(feature.status)}">${statusLabel(feature.status)}</span><span>${escapeHtml(feature.name)}</span></a><p class="triageCounts">${attentionCounts(scenarios)}</p><ul class="triageScenarios">${links}${more}</ul>${reason ? `<p class="triageReason"><span class="triageReasonLabel">First failure:</span> ${escapeHtml(reason)}</p>` : ""}</li>`;
|
|
2696
|
+
}
|
|
2697
|
+
function renderTriage(features) {
|
|
2698
|
+
const attention = features.map((entry, index) => ({ ...entry, index })).filter(
|
|
2699
|
+
({ scenarios }) => scenarios.some((scenario) => scenario.status !== "passed")
|
|
2700
|
+
);
|
|
2701
|
+
if (attention.length === 0) return "";
|
|
2702
|
+
const shown = attention.slice(0, 5);
|
|
2703
|
+
const rest = attention.slice(5, TRIAGE_FEATURE_LIMIT);
|
|
2704
|
+
const total = features.reduce(
|
|
2705
|
+
(sum, entry) => sum + entry.scenarios.length,
|
|
2706
|
+
0
|
|
2707
|
+
);
|
|
2708
|
+
const need = attention.reduce(
|
|
2709
|
+
(sum, entry) => sum + entry.scenarios.filter((scenario) => scenario.status !== "passed").length,
|
|
2710
|
+
0
|
|
2711
|
+
);
|
|
2712
|
+
const rows = shown.map(renderTriageRow).join("");
|
|
2713
|
+
const restBlock = rest.length ? `<details class="triageRest"><summary>Show ${rest.length} more feature${rest.length === 1 ? "" : "s"}</summary><ol class="triageList">${rest.map(renderTriageRow).join("")}</ol></details>` : "";
|
|
2714
|
+
const remainder = attention.length > TRIAGE_FEATURE_LIMIT ? `<p class="triageMore">${attention.length - TRIAGE_FEATURE_LIMIT} more feature${attention.length - TRIAGE_FEATURE_LIMIT === 1 ? "" : "s"} below.</p>` : "";
|
|
2715
|
+
const lead = `${need} of ${total} scenario${total === 1 ? "" : "s"} ${need === 1 ? "needs" : "need"} attention.`;
|
|
2716
|
+
return `<details class="triageBox" data-triage open><summary class="triageSummary"><span class="triageTitle">Needs attention</span><span class="triageSummaryLead">${lead}</span><span class="chev" aria-hidden="true"></span></summary><nav class="triage" aria-label="Needs attention"><h2 id="triage-heading">Needs attention</h2><p class="triageLead">${lead}</p><ol class="triageList">${rows}</ol>${restBlock}${remainder}</nav></details>`;
|
|
2717
|
+
}
|
|
2718
|
+
function renderSourceStrip(model) {
|
|
2719
|
+
if (model.features.some((feature) => !feature.sourceFile)) return "";
|
|
2720
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2721
|
+
model.features.forEach((feature, index) => {
|
|
2722
|
+
const file = feature.sourceFile;
|
|
2723
|
+
if (!file) return;
|
|
2724
|
+
const group = groups.get(file) ?? { features: [], order: index };
|
|
2725
|
+
group.features.push(feature);
|
|
2726
|
+
groups.set(file, group);
|
|
2727
|
+
});
|
|
2728
|
+
if (groups.size < 2) return "";
|
|
2729
|
+
const entries = [...groups.entries()].map(([file, group]) => ({
|
|
2730
|
+
file,
|
|
2731
|
+
features: group.features.length,
|
|
2732
|
+
scenarios: group.features.flatMap((feature) => feature.scenarios),
|
|
2733
|
+
status: bySeverity(group.features)[0]?.status ?? "unknown",
|
|
2734
|
+
order: group.order
|
|
2735
|
+
}));
|
|
2736
|
+
entries.sort((a, b) => {
|
|
2737
|
+
const status = compareStatus(a.status, b.status);
|
|
2738
|
+
return status !== 0 ? status : a.order - b.order;
|
|
2739
|
+
});
|
|
2740
|
+
const shown = entries.slice(0, SOURCE_LIMIT);
|
|
2741
|
+
const remainder = entries.length - shown.length;
|
|
2742
|
+
const items = shown.map((entry) => {
|
|
2743
|
+
const attention = attentionCounts(entry.scenarios);
|
|
2744
|
+
const counts = `${entry.features} feature${entry.features === 1 ? "" : "s"} \xB7 ${entry.scenarios.length} scenario${entry.scenarios.length === 1 ? "" : "s"}${attention ? ` \xB7 ${attention}` : ""}`;
|
|
2745
|
+
return `<li class="sourceItem"><div class="sourceHead"><span class="triageStatus ${statusClass(entry.status)}">${statusLabel(entry.status)}</span><span class="sourceName">${escapeHtml(entry.file)}</span></div><p class="sourceCounts">${counts}</p>${featureBar(entry.scenarios)}</li>`;
|
|
2746
|
+
}).join("");
|
|
2747
|
+
const more = remainder > 0 ? `<p class="triageMore">${remainder} more input${remainder === 1 ? "" : "s"}</p>` : "";
|
|
2748
|
+
return `<section class="sources" aria-labelledby="sources-heading" data-sources><h2 id="sources-heading">Sources</h2><ul class="sourceList">${items}</ul>${more}</section>`;
|
|
2749
|
+
}
|
|
2436
2750
|
function statusBar(model) {
|
|
2437
2751
|
const total = model.counts.scenarios.total;
|
|
2438
2752
|
if (total === 0) return "";
|
|
2439
2753
|
return `<div class="bar" aria-hidden="true">${displayStatuses(model).map(
|
|
2440
|
-
(status) => `<i class="${statusClass(status)}" style="width:${model.counts.scenarios[status]
|
|
2754
|
+
(status) => `<i class="${statusClass(status)}" style="width:${barWidth(model.counts.scenarios[status], total)}%"></i>`
|
|
2441
2755
|
).join("")}</div>`;
|
|
2442
2756
|
}
|
|
2443
2757
|
function countPills(model) {
|
|
@@ -2488,14 +2802,14 @@ function scenarioText(scenario) {
|
|
|
2488
2802
|
return [
|
|
2489
2803
|
scenario.name,
|
|
2490
2804
|
scenario.featureName,
|
|
2491
|
-
scenario.uri,
|
|
2805
|
+
displayUri(scenario.uri),
|
|
2492
2806
|
scenario.keyword,
|
|
2493
2807
|
scenario.description,
|
|
2494
2808
|
scenario.tags.join(" "),
|
|
2495
|
-
scenario.steps.map((step) => `${step.keyword} ${step.text} ${step.message ?? ""}`).join(" ")
|
|
2809
|
+
scenario.steps.map((step) => `${step.keyword} ${step.text} ${(step.message ?? "").slice(0, SEARCH_MESSAGE_LIMIT)}`).join(" ")
|
|
2496
2810
|
].join(" ");
|
|
2497
2811
|
}
|
|
2498
|
-
function renderScenario(scenario) {
|
|
2812
|
+
function renderScenario(scenario, featureIndex, scenarioIndex) {
|
|
2499
2813
|
const image = scenario.attachments.find(
|
|
2500
2814
|
(attachment) => attachment.kind === "image" && attachment.dataUri
|
|
2501
2815
|
);
|
|
@@ -2504,15 +2818,34 @@ function renderScenario(scenario) {
|
|
|
2504
2818
|
const description = scenario.description ? `<p class="description">${escapeHtml(scenario.description)}</p>` : "";
|
|
2505
2819
|
const extraAttachments = scenario.extraAttachments.length ? `<h4>Attachments</h4>${scenario.extraAttachments.map((attachment) => renderAttachment(attachment, scenario.name)).join("")}` : "";
|
|
2506
2820
|
const copyFailure = scenario.status === "failed" ? '<button class="copyFailure" type="button" data-copy-failure>Copy failure</button>' : "";
|
|
2507
|
-
return `<details class="scenario" data-scenario data-status="${scenario.status}" data-uri="${escapeHtml(scenario.uri)}" data-tags="${escapeHtml(scenario.tags.join(" "))}" data-search="${escapeHtml(scenarioText(scenario))}" ${open ? "open" : ""}><summary class="scenarioButton"><span class="statusCell"><span class="statusText ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span></span><span class="thumbCell">${image ? `<img class="thumb" src="${escapeHtml(image.dataUri ?? "")}" alt="" loading="lazy">` : ""}</span><span class="scenarioMain"><h3 class="scenarioName">${escapeHtml(scenario.name)}</h3><span class="scenarioSub">${scenario.steps.length} step${scenario.steps.length === 1 ? "" : "s"}${scenario.tags.length ? ` <span class="tags">${scenario.tags.map((tag) => `<span class="tag">${escapeHtml(tag)}</span>`).join("")}</span>` : ""}</span></span><span class="rowRight">${durationLabel(scenario.durationMs)}${scenario.attachments.length ? `<br>${scenario.attachments.length} attachment${scenario.attachments.length === 1 ? "" : "s"}` : ""}</span><span class="chev" aria-hidden="true"></span></summary><div class="detailInline">${description}<div class="stepsHead"><h4>Steps</h4>${copyFailure}</div><ol class="steps">${steps}</ol>${extraAttachments}<div class="detailMeta"><span>Feature: ${escapeHtml(scenario.featureName)}</span><span>Attempt: ${scenario.attempt + 1}</span>${scenario.startedAt ? `<span>Started: ${dateLabel(scenario.startedAt)}</span>` : ""}${scenario.ruleName ? `<span>Rule: ${escapeHtml(scenario.ruleName)}</span>` : ""}</div></div></details>`;
|
|
2821
|
+
return `<details class="scenario" id="scenario-${featureIndex + 1}-${scenarioIndex + 1}" data-scenario data-status="${scenario.status}" data-uri="${escapeHtml(displayUri(scenario.uri))}" data-tags="${escapeHtml(scenario.tags.join(" "))}" data-search="${escapeHtml(scenarioText(scenario))}" ${open ? "open" : ""}><summary class="scenarioButton"><span class="statusCell"><span class="statusText ${statusClass(scenario.status)}">${statusLabel(scenario.status)}</span></span><span class="thumbCell">${image ? `<img class="thumb" src="${escapeHtml(image.dataUri ?? "")}" alt="" loading="lazy">` : ""}</span><span class="scenarioMain"><h3 class="scenarioName">${escapeHtml(scenario.name)}</h3><span class="scenarioSub">${scenario.steps.length} step${scenario.steps.length === 1 ? "" : "s"}${scenario.tags.length ? ` <span class="tags">${scenario.tags.map((tag) => `<span class="tag">${escapeHtml(tag)}</span>`).join("")}</span>` : ""}</span></span><span class="rowRight">${durationLabel(scenario.durationMs)}${scenario.attachments.length ? `<br>${scenario.attachments.length} attachment${scenario.attachments.length === 1 ? "" : "s"}` : ""}</span><span class="chev" aria-hidden="true"></span></summary><div class="detailInline">${description}<div class="stepsHead"><h4>Steps</h4>${copyFailure}</div><ol class="steps">${steps}</ol>${extraAttachments}<div class="detailMeta"><span>Feature: ${escapeHtml(scenario.featureName)}</span><span>Attempt: ${scenario.attempt + 1}</span>${scenario.startedAt ? `<span>Started: ${dateLabel(scenario.startedAt)}</span>` : ""}${scenario.ruleName ? `<span>Rule: ${escapeHtml(scenario.ruleName)}</span>` : ""}</div></div></details>`;
|
|
2508
2822
|
}
|
|
2509
|
-
function renderFeature(feature) {
|
|
2510
|
-
const
|
|
2511
|
-
const open = feature.status === "failed" || feature.scenarios.some(
|
|
2823
|
+
function renderFeature({ feature, scenarios }, featureIndex) {
|
|
2824
|
+
const open = feature.status === "failed" || scenarios.some(
|
|
2512
2825
|
(scenario) => scenario.attachments.some((attachment) => attachment.kind === "image")
|
|
2513
2826
|
);
|
|
2514
2827
|
const description = feature.description ? `<p class="description">${escapeHtml(feature.description)}</p>` : "";
|
|
2515
|
-
return `<details class="feature ${feature.status === "failed" ? "has-fail" : "has-pass"}" data-feature ${open ? "open" : ""}><summary><span class="statusCell"><span class="statusText ${statusClass(feature.status)}">${statusLabel(feature.status)}</span></span><h2>${escapeHtml(feature.name)}</h2><span class="
|
|
2828
|
+
return `<details class="feature ${feature.status === "failed" ? "has-fail" : "has-pass"}" id="feature-${featureIndex + 1}" data-feature ${open ? "open" : ""}><summary><span class="statusCell"><span class="statusText ${statusClass(feature.status)}">${statusLabel(feature.status)}</span></span><h2>${escapeHtml(feature.name)}</h2><span class="chev" aria-hidden="true"></span>${featureShape(feature, scenarios)}</summary>${description}<div class="rows">${scenarios.map(
|
|
2829
|
+
(scenario, scenarioIndex) => renderScenario(scenario, featureIndex, scenarioIndex)
|
|
2830
|
+
).join("")}</div></details>`;
|
|
2831
|
+
}
|
|
2832
|
+
function matrixStatuses(model) {
|
|
2833
|
+
return ALL_STATUSES.filter((status) => model.counts.scenarios[status] > 0).sort(
|
|
2834
|
+
compareStatus
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2837
|
+
function renderFeatureMatrix(model) {
|
|
2838
|
+
const statuses = matrixStatuses(model);
|
|
2839
|
+
const head = `<tr><th>Feature</th><th>Total</th>${statuses.map((status) => `<th>${statusLabel(status)}</th>`).join("")}<th>Duration</th></tr>`;
|
|
2840
|
+
const rows = model.features.map((feature) => {
|
|
2841
|
+
const counts = countStatuses(feature.scenarios);
|
|
2842
|
+
const cells = statuses.map((status) => {
|
|
2843
|
+
const count2 = counts[status] ?? 0;
|
|
2844
|
+
return `<td class="num${count2 === 0 ? " zero" : ""}">${count2}</td>`;
|
|
2845
|
+
}).join("");
|
|
2846
|
+
return `<tr><th scope="row"><span class="matrixName">${escapeHtml(feature.name)}</span><span class="matrixUri">${escapeHtml(displayUri(feature.uri))}</span></th><td class="num">${feature.scenarios.length}</td>${cells}<td class="num">${durationLabel(feature.durationMs)}</td></tr>`;
|
|
2847
|
+
}).join("");
|
|
2848
|
+
return `<table class="featureTable"><thead>${head}</thead><tbody>${rows}</tbody></table>`;
|
|
2516
2849
|
}
|
|
2517
2850
|
function metadataLine(metadata) {
|
|
2518
2851
|
return Object.entries(metadata ?? {}).filter(([key, value]) => key.length > 0 && value.length > 0).map(
|
|
@@ -2525,12 +2858,15 @@ function renderReportView(model, options) {
|
|
|
2525
2858
|
const percent = total === 0 ? 0 : Math.round(passed / total * 1e3) / 10;
|
|
2526
2859
|
const meta = metadataLine(options.metadata);
|
|
2527
2860
|
const date = dateLabel(model.startedAt);
|
|
2528
|
-
const
|
|
2861
|
+
const ordered = orderFeatures(model.features);
|
|
2862
|
+
const features = ordered.map((feature, index) => renderFeature(feature, index)).join("");
|
|
2863
|
+
const triage = renderTriage(ordered);
|
|
2864
|
+
const sources = renderSourceStrip(model);
|
|
2529
2865
|
const tags = scenarioTags(model);
|
|
2530
2866
|
const tagFilter = tags.length ? `<label class="tagFilter"><span>Tag</span><select data-tag-filter><option value="">All tags</option>${tags.map((tag) => `<option value="${escapeHtml(tag)}">${escapeHtml(tag)}</option>`).join("")}</select></label>` : "";
|
|
2531
|
-
return `<div class="tabPanel" id="report-view" role="tabpanel" aria-labelledby="view-report" tabindex="0"><main class="shell"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / ${escapeHtml(options.title)}</p><h1>${escapeHtml(options.title)}</h1><p class="meta">${date ? `<span>${date}</span>` : ""}<span>${model.counts.features} feature${model.counts.features === 1 ? "" : "s"}</span><span>${model.counts.scenarios.total} scenarios</span><span>${escapeHtml(model.source)}</span>${meta}</p></div><div class="health"><div class="healthTop"><strong>${percent}%</strong><span>${passed} of ${total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="toolbar"><label class="search"><span aria-hidden="true">\u2315</span><input data-search type="search" placeholder="Search scenario, feature or tag" aria-label="Search scenarios"></label>${tagFilter}<div class="filters">${displayStatuses(model).map(
|
|
2867
|
+
return `<div class="tabPanel" id="report-view" role="tabpanel" aria-labelledby="view-report" tabindex="0"><main class="shell"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / ${escapeHtml(options.title)}</p><h1>${escapeHtml(options.title)}</h1><p class="meta">${date ? `<span>${date}</span>` : ""}<span>${model.counts.features} feature${model.counts.features === 1 ? "" : "s"}</span><span>${model.counts.scenarios.total} scenarios</span><span>${durationLabel(model.durationMs)}</span><span>${escapeHtml(model.source)}</span>${meta}</p></div><div class="health"><div class="healthTop"><strong>${percent}%</strong><span>${passed} of ${total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="toolbar"><label class="search"><span aria-hidden="true">\u2315</span><input data-search type="search" placeholder="Search scenario, feature or tag" aria-label="Search scenarios"></label>${tagFilter}<div class="filters">${displayStatuses(model).map(
|
|
2532
2868
|
(status) => `<button class="filter" type="button" data-status="${status}" aria-pressed="true">${statusLabel(status)} <b>${model.counts.scenarios[status]}</b></button>`
|
|
2533
|
-
).join("")}</div><div class="expand"><button type="button" data-expand="all">Expand all</button><button type="button" data-expand="none">Collapse all</button></div></div><p class="live sr" id="tolkira-live" role="status" aria-live="polite" data-total="${total}"></p><p class="sr" id="tolkira-copy-live" aria-live="polite"></p><div id="feature-list">${features || `<div class="empty">No scenarios in this report.</div>`}</div><div class="empty" id="empty-results" hidden>No scenarios match the current search or filters.</div><p class="foot">Generated by Tolkira. Single file. No network requests. Screenshots are embedded.</p></main></div>`;
|
|
2869
|
+
).join("")}</div><div class="expand"><button type="button" data-expand="all">Expand all</button><button type="button" data-expand="none">Collapse all</button></div></div><p class="live sr" id="tolkira-live" role="status" aria-live="polite" data-total="${total}"></p><p class="sr" id="tolkira-copy-live" aria-live="polite"></p><p class="searchNote" id="tolkira-search-note" hidden></p>${triage}${sources}<div id="feature-list">${features || `<div class="empty">No scenarios in this report.</div>`}</div><div class="empty" id="empty-results" hidden>No scenarios match the current search or filters.</div><p class="foot">Generated by Tolkira. Single file. No network requests. Screenshots are embedded.</p></main></div>`;
|
|
2534
2870
|
}
|
|
2535
2871
|
function renderAnalysisView(model, options, summary) {
|
|
2536
2872
|
const counts = model.counts.scenarios;
|
|
@@ -2551,9 +2887,7 @@ function renderAnalysisView(model, options, summary) {
|
|
|
2551
2887
|
model.environment?.protocol ? `<dt>Protocol</dt><dd>${escapeHtml(model.environment.protocol)}</dd>` : ""
|
|
2552
2888
|
].join("");
|
|
2553
2889
|
const runRows = `<dt>Duration</dt><dd>${durationLabel(model.durationMs)}</dd><dt>Features</dt><dd>${model.counts.features}</dd><dt>Scenarios</dt><dd>${counts.total}</dd><dt>Steps</dt><dd>${model.counts.steps.total}</dd><dt>Attachments</dt><dd>${model.counts.attachments}</dd><dt>Attachment size</dt><dd>${model.counts.attachmentBytes} bytes</dd><dt>Source</dt><dd>${escapeHtml(model.source)}</dd>`;
|
|
2554
|
-
return `<div class="tabPanel" id="analysis-view" role="tabpanel" aria-labelledby="view-analysis" tabindex="0" hidden><main class="shell analysis"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / details</p><h1>Run details</h1><p class="meta">${dateLabel(model.startedAt) ? `<span>${dateLabel(model.startedAt)}</span>` : ""}<span>${escapeHtml(model.source)}</span></p></div><div class="health"><div class="healthTop"><strong>${counts.total === 0 ? 0 : Math.round(counts.passed / counts.total * 1e3) / 10}%</strong><span>${counts.passed} of ${counts.total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="analysisGrid"><section class="panel"><h2>Features</h2><p>Where the run spent its scenarios and steps.</p><div class="tableWrap" tabindex="0" role="region" aria-label="Feature
|
|
2555
|
-
(feature) => `<tr><td>${escapeHtml(feature.name)}</td><td class="num">${feature.scenarios.length}</td><td class="num">${feature.scenarios.filter((scenario) => scenario.status === "passed").length}</td><td class="num">${feature.scenarios.filter((scenario) => scenario.status === "failed").length}</td><td class="num">${durationLabel(feature.durationMs)}</td></tr>`
|
|
2556
|
-
).join("")}</tbody></table></div></section><section class="panel"><h2>Status distribution</h2><p>All scenarios in the run.</p><div class="legend">${displayStatuses(model).map(
|
|
2890
|
+
return `<div class="tabPanel" id="analysis-view" role="tabpanel" aria-labelledby="view-analysis" tabindex="0" hidden><main class="shell analysis"><header class="runHead"><div><p class="path">${escapeHtml(model.source)} / details</p><h1>Run details</h1><p class="meta">${dateLabel(model.startedAt) ? `<span>${dateLabel(model.startedAt)}</span>` : ""}<span>${escapeHtml(model.source)}</span></p></div><div class="health"><div class="healthTop"><strong>${counts.total === 0 ? 0 : Math.round(counts.passed / counts.total * 1e3) / 10}%</strong><span>${counts.passed} of ${counts.total} passed</span></div>${statusBar(model)}${countPills(model)}</div></header><div class="analysisGrid"><section class="panel"><h2>Features</h2><p>Where the run spent its scenarios and steps.</p><p class="matrixHint">Scroll for all status columns.</p><div class="tableWrap" tabindex="0" role="region" aria-label="Feature status matrix">${renderFeatureMatrix(model)}</div></section><section class="panel"><h2>Status distribution</h2><p>All scenarios in the run.</p><div class="legend">${displayStatuses(model).map(
|
|
2557
2891
|
(status) => `<div class="legendRow ${statusClass(status)}"><span class="marker ${statusClass(status)}"></span><span>${statusLabel(status)}</span><b>${counts[status]}</b></div>`
|
|
2558
2892
|
).join("")}</div><h2 class="subhead">Run</h2><dl class="metaList">${runRows}</dl>${environmentRows ? `<h2 class="subhead">Cucumber environment</h2><dl class="metaList">${environmentRows}</dl>` : ""}${customRows ? `<h2 class="subhead">Custom metadata</h2><dl class="metaList">${customRows}</dl>` : ""}</section></div>${model.runAttachments.length ? `<section class="panel" style="margin-top:16px"><h2>Run attachments</h2>${model.runAttachments.map((attachment) => renderAttachment(attachment, "Run attachments")).join("")}</section>` : ""}<section class="panel" style="margin-top:16px"><h2>Agent summary</h2><p>The same run as stable JSON for CI tools and agents.</p><pre class="json" tabindex="0" aria-label="Agent summary JSON">${escapeHtml(JSON.stringify(preview))}</pre></section><p class="foot">Full summary: <code>tolkira ... --json</code></p></main></div>`;
|
|
2559
2893
|
}
|
|
@@ -2586,9 +2920,13 @@ var SCRIPT = `<script>
|
|
|
2586
2920
|
showView(views[next].getAttribute('data-view'));
|
|
2587
2921
|
});
|
|
2588
2922
|
var state = { query: '', hidden: new Set(), tag: '' };
|
|
2923
|
+
var searchOpened = [];
|
|
2589
2924
|
var scenarios = Array.prototype.slice.call(document.querySelectorAll('[data-scenario]'));
|
|
2590
2925
|
var features = Array.prototype.slice.call(document.querySelectorAll('[data-feature]'));
|
|
2591
2926
|
var live = document.getElementById('tolkira-live');
|
|
2927
|
+
var searchNote = document.getElementById('tolkira-search-note');
|
|
2928
|
+
var triage = document.querySelector('[data-triage]');
|
|
2929
|
+
var sources = document.querySelector('[data-sources]');
|
|
2592
2930
|
function apply() {
|
|
2593
2931
|
var query = state.query.toLowerCase();
|
|
2594
2932
|
var tag = state.tag;
|
|
@@ -2608,14 +2946,32 @@ var SCRIPT = `<script>
|
|
|
2608
2946
|
feature.hidden = !any;
|
|
2609
2947
|
if (any && (query || state.hidden.size || tag)) feature.open = true;
|
|
2610
2948
|
});
|
|
2949
|
+
searchOpened.forEach(function (scenario) { scenario.open = false; });
|
|
2950
|
+
searchOpened = [];
|
|
2611
2951
|
if (query) {
|
|
2952
|
+
var opened = 0;
|
|
2612
2953
|
scenarios.forEach(function (scenario) {
|
|
2613
|
-
if (!scenario.hidden
|
|
2954
|
+
if (!scenario.hidden && opened < 20) {
|
|
2955
|
+
if (!scenario.open) searchOpened.push(scenario);
|
|
2956
|
+
scenario.open = true;
|
|
2957
|
+
opened += 1;
|
|
2958
|
+
}
|
|
2614
2959
|
});
|
|
2615
2960
|
}
|
|
2616
2961
|
if (live) live.textContent = visible + ' of ' + scenarios.length + ' scenarios visible';
|
|
2962
|
+
if (searchNote) {
|
|
2963
|
+
if (query && visible > 20) {
|
|
2964
|
+
searchNote.textContent = '20 of ' + visible + ' matches expanded. Use Expand all to open the rest.';
|
|
2965
|
+
searchNote.hidden = false;
|
|
2966
|
+
} else {
|
|
2967
|
+
searchNote.hidden = true;
|
|
2968
|
+
searchNote.textContent = '';
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2617
2971
|
var empty = document.getElementById('empty-results');
|
|
2618
2972
|
if (empty) empty.hidden = visible !== 0;
|
|
2973
|
+
if (triage) triage.hidden = Boolean(query || tag || state.hidden.size);
|
|
2974
|
+
if (sources) sources.hidden = Boolean(query || tag || state.hidden.size);
|
|
2619
2975
|
highlightSearch();
|
|
2620
2976
|
}
|
|
2621
2977
|
function clearHighlights() {
|
|
@@ -2810,7 +3166,32 @@ var SCRIPT = `<script>
|
|
|
2810
3166
|
lightbox.addEventListener('click', function (event) { if (event.target === lightbox) closeDialog(); });
|
|
2811
3167
|
lightbox.addEventListener('close', restoreLightbox);
|
|
2812
3168
|
}
|
|
3169
|
+
function revealHash() {
|
|
3170
|
+
if (!location.hash) return;
|
|
3171
|
+
var id = '';
|
|
3172
|
+
try { id = decodeURIComponent(location.hash.slice(1)); } catch (error) { return; }
|
|
3173
|
+
var target = document.getElementById(id);
|
|
3174
|
+
if (!target) return;
|
|
3175
|
+
var node = target;
|
|
3176
|
+
while (node) {
|
|
3177
|
+
if (node.tagName === 'DETAILS') node.open = true;
|
|
3178
|
+
node = node.parentElement;
|
|
3179
|
+
}
|
|
3180
|
+
var focusTarget = target.tagName === 'DETAILS' ? target.querySelector('summary') : target;
|
|
3181
|
+
if (focusTarget) {
|
|
3182
|
+
try { focusTarget.focus({ preventScroll: true }); } catch (error) { focusTarget.focus(); }
|
|
3183
|
+
}
|
|
3184
|
+
target.scrollIntoView();
|
|
3185
|
+
}
|
|
3186
|
+
var compact = window.matchMedia('(max-width: 560px)');
|
|
3187
|
+
function syncCompact() {
|
|
3188
|
+
if (triage) triage.open = !compact.matches;
|
|
3189
|
+
}
|
|
3190
|
+
if (compact.addEventListener) compact.addEventListener('change', syncCompact);
|
|
3191
|
+
syncCompact();
|
|
3192
|
+
window.addEventListener('hashchange', revealHash);
|
|
2813
3193
|
showView('report');
|
|
3194
|
+
revealHash();
|
|
2814
3195
|
})();
|
|
2815
3196
|
</script>`;
|
|
2816
3197
|
function inlineScriptHashes(html) {
|
|
@@ -2828,7 +3209,7 @@ function csp(hashes) {
|
|
|
2828
3209
|
}
|
|
2829
3210
|
async function renderHtml(envelopes, options) {
|
|
2830
3211
|
const safeEnvelopes = sanitizeEnvelopes(envelopes);
|
|
2831
|
-
const model = buildReportModel(safeEnvelopes);
|
|
3212
|
+
const model = buildReportModel(safeEnvelopes, options.provenance);
|
|
2832
3213
|
const summary = options.summary ?? summarizeEnvelopes(safeEnvelopes);
|
|
2833
3214
|
const logo = isLogoDataUri(options.logo) ? `<img class="logo" src="${escapeHtml(options.logo)}" alt="">` : "";
|
|
2834
3215
|
const accent = isValidAccent(options.accent) ? `<style>:root{--accent:${options.accent}}</style>` : "";
|
|
@@ -2848,10 +3229,11 @@ ${csp(hashes)}
|
|
|
2848
3229
|
}
|
|
2849
3230
|
|
|
2850
3231
|
// src/index.ts
|
|
2851
|
-
var version = "0.
|
|
3232
|
+
var version = "0.2.0";
|
|
2852
3233
|
var phase = "development";
|
|
2853
3234
|
async function generateReport(inputs, options = {}) {
|
|
2854
|
-
const
|
|
3235
|
+
const groups = await loadInputs(inputs);
|
|
3236
|
+
const envelopes = groups.flatMap((group) => group.envelopes);
|
|
2855
3237
|
const summary = summarizeEnvelopes(envelopes);
|
|
2856
3238
|
return {
|
|
2857
3239
|
html: await renderHtml(envelopes, {
|
|
@@ -2859,7 +3241,8 @@ async function generateReport(inputs, options = {}) {
|
|
|
2859
3241
|
metadata: options.metadata,
|
|
2860
3242
|
logo: options.logo,
|
|
2861
3243
|
accent: options.accent,
|
|
2862
|
-
summary
|
|
3244
|
+
summary,
|
|
3245
|
+
provenance: groups.length > 1 ? provenanceFor(groups) : void 0
|
|
2863
3246
|
}),
|
|
2864
3247
|
summary
|
|
2865
3248
|
};
|