@sun-asterisk/sungen 3.2.6 → 3.2.7
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/cli/commands/delivery.d.ts.map +1 -1
- package/dist/cli/commands/delivery.js +7 -46
- package/dist/cli/commands/delivery.js.map +1 -1
- package/dist/dashboard/snapshot-builder.d.ts.map +1 -1
- package/dist/dashboard/snapshot-builder.js +28 -6
- package/dist/dashboard/snapshot-builder.js.map +1 -1
- package/dist/dashboard/templates/index.html +20 -20
- package/dist/dashboard/types.d.ts +18 -0
- package/dist/dashboard/types.d.ts.map +1 -1
- package/dist/exporters/api-catalog-loader.d.ts +18 -0
- package/dist/exporters/api-catalog-loader.d.ts.map +1 -0
- package/dist/exporters/api-catalog-loader.js +77 -0
- package/dist/exporters/api-catalog-loader.js.map +1 -0
- package/dist/exporters/json-exporter.d.ts +10 -1
- package/dist/exporters/json-exporter.d.ts.map +1 -1
- package/dist/exporters/json-exporter.js +34 -2
- package/dist/exporters/json-exporter.js.map +1 -1
- package/dist/exporters/playwright-report-parser.d.ts +14 -0
- package/dist/exporters/playwright-report-parser.d.ts.map +1 -1
- package/dist/exporters/playwright-report-parser.js +30 -0
- package/dist/exporters/playwright-report-parser.js.map +1 -1
- package/dist/exporters/xlsx-exporter.d.ts +18 -17
- package/dist/exporters/xlsx-exporter.d.ts.map +1 -1
- package/dist/exporters/xlsx-exporter.js +25 -595
- package/dist/exporters/xlsx-exporter.js.map +1 -1
- package/dist/exporters/xlsx-report-builder.d.ts +196 -0
- package/dist/exporters/xlsx-report-builder.d.ts.map +1 -0
- package/dist/exporters/xlsx-report-builder.js +653 -0
- package/dist/exporters/xlsx-report-builder.js.map +1 -0
- package/package.json +3 -3
- package/src/cli/commands/delivery.ts +8 -42
- package/src/dashboard/snapshot-builder.ts +31 -7
- package/src/dashboard/templates/index.html +20 -20
- package/src/dashboard/types.ts +19 -0
- package/src/exporters/api-catalog-loader.ts +44 -0
- package/src/exporters/json-exporter.ts +46 -4
- package/src/exporters/playwright-report-parser.ts +27 -0
- package/src/exporters/xlsx-exporter.ts +34 -658
- package/src/exporters/xlsx-report-builder.ts +806 -0
- package/dist/cli/types.d.ts +0 -9
- package/dist/cli/types.d.ts.map +0 -1
- package/dist/cli/types.js +0 -7
- package/dist/cli/types.js.map +0 -1
- package/dist/generators/gherkin-parser/selector-extractor.d.ts +0 -37
- package/dist/generators/gherkin-parser/selector-extractor.d.ts.map +0 -1
- package/dist/generators/gherkin-parser/selector-extractor.js +0 -108
- package/dist/generators/gherkin-parser/selector-extractor.js.map +0 -1
- package/dist/generators/test-generator/types.d.ts +0 -25
- package/dist/generators/test-generator/types.d.ts.map +0 -1
- package/dist/generators/test-generator/types.js +0 -7
- package/dist/generators/test-generator/types.js.map +0 -1
- package/dist/generators/types.d.ts +0 -119
- package/dist/generators/types.d.ts.map +0 -1
- package/dist/generators/types.js +0 -48
- package/dist/generators/types.js.map +0 -1
- package/dist/orchestrator/figma/node-path-collapser.d.ts +0 -16
- package/dist/orchestrator/figma/node-path-collapser.d.ts.map +0 -1
- package/dist/orchestrator/figma/node-path-collapser.js +0 -37
- package/dist/orchestrator/figma/node-path-collapser.js.map +0 -1
- package/src/cli/types.ts +0 -9
- package/src/generators/gherkin-parser/selector-extractor.ts +0 -142
- package/src/generators/test-generator/types.ts +0 -26
- package/src/generators/types.ts +0 -227
- package/src/orchestrator/figma/node-path-collapser.ts +0 -38
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
*
|
|
2
|
+
* Node-side wrapper around the shared pure workbook builder
|
|
3
|
+
* (`xlsx-report-builder.ts` — the single source of truth for the BM-2-901-13
|
|
4
|
+
* report rendering, also bundled into the dashboard). This module keeps only:
|
|
5
|
+
* - Node file I/O: `writeXlsx` + the `lockEmbeddedImages` post-process
|
|
6
|
+
* - the CLI version lookup (`getPackageVersion`, fs-based) injected as
|
|
7
|
+
* `opts.sungenVersion`
|
|
8
|
+
* - thin adapters mapping core domain types (ScreenSummary / TestCaseRow /
|
|
9
|
+
* LocaleSheet / ApiCatalogEntry) onto the builder input — pure field
|
|
10
|
+
* mapping, no rendering logic.
|
|
11
|
+
* Public API is unchanged: `renderXlsx`, `renderXlsxMultiSheet`, `writeXlsx`,
|
|
12
|
+
* `buildApiDetailRows`, `addApiDetailSheet`, `ApiDetailContext`, `LocaleSheet`.
|
|
10
13
|
*/
|
|
11
14
|
|
|
12
15
|
import * as fs from 'fs';
|
|
@@ -15,41 +18,21 @@ import ExcelJS from 'exceljs';
|
|
|
15
18
|
import JSZip from 'jszip';
|
|
16
19
|
import { ApiCatalogEntry, ApiDetailRow, ScreenSummary, TestCaseRow } from './types';
|
|
17
20
|
import { getPackageVersion } from './package-info';
|
|
18
|
-
import { SUN_LOGO_PNG_BASE64 } from './sun-logo';
|
|
19
21
|
import { deliverableBasename } from './csv-exporter';
|
|
20
22
|
import {
|
|
21
23
|
extractApiCallOrder,
|
|
22
24
|
extractCasesDataset,
|
|
23
25
|
extractConcurrencyInvariant,
|
|
24
26
|
} from './feature-parser';
|
|
27
|
+
import {
|
|
28
|
+
buildApiDetailRows as buildApiDetailRowsPure,
|
|
29
|
+
buildSingleTestcaseWorkbook,
|
|
30
|
+
buildTestcaseWorkbook,
|
|
31
|
+
addApiDetailSheet,
|
|
32
|
+
} from './xlsx-report-builder';
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const HEADER_FONT = 'FF000000'; // black text reads better on the light lavender
|
|
29
|
-
const META_FILL = 'FFDCE6F1'; // soft blue for meta rows
|
|
30
|
-
const CATEGORY_FILL = 'FFD9D2E9'; // same lavender for group dividers (Accessing / GUI / Function)
|
|
31
|
-
const BORDER_COLOR = 'FFBFBFBF';
|
|
32
|
-
|
|
33
|
-
// Shared masthead + table styling (BM-2-901-13 header band, summary band, Overview table).
|
|
34
|
-
const TIMES = 'Times New Roman';
|
|
35
|
-
const ARIAL_FONT = 'Arial';
|
|
36
|
-
const BLACK = { argb: 'FF000000' };
|
|
37
|
-
const WHITE = { argb: 'FFFFFFFF' };
|
|
38
|
-
const LAVENDER = { argb: 'FFD9D2E9' };
|
|
39
|
-
const thinBlack = { style: 'thin' as const, color: BLACK };
|
|
40
|
-
const allBordersBlack = { top: thinBlack, left: thinBlack, bottom: thinBlack, right: thinBlack };
|
|
41
|
-
|
|
42
|
-
type AnyCell = ExcelJS.Cell;
|
|
43
|
-
type AnyRow = ExcelJS.Row;
|
|
44
|
-
|
|
45
|
-
function applyBorder(cell: AnyCell): void {
|
|
46
|
-
cell.border = {
|
|
47
|
-
top: { style: 'thin', color: { argb: BORDER_COLOR } },
|
|
48
|
-
left: { style: 'thin', color: { argb: BORDER_COLOR } },
|
|
49
|
-
bottom: { style: 'thin', color: { argb: BORDER_COLOR } },
|
|
50
|
-
right: { style: 'thin', color: { argb: BORDER_COLOR } },
|
|
51
|
-
};
|
|
52
|
-
}
|
|
34
|
+
// Re-exported unchanged — the implementation lives in the pure builder.
|
|
35
|
+
export { addApiDetailSheet };
|
|
53
36
|
|
|
54
37
|
/**
|
|
55
38
|
* Optional context for the supplementary "API detail" worksheet.
|
|
@@ -69,14 +52,11 @@ export function renderXlsx(
|
|
|
69
52
|
specLink: string,
|
|
70
53
|
apiDetail?: ApiDetailContext,
|
|
71
54
|
): ExcelJS.Workbook {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
addApiDetailSheet(wb, apiDetail.rows);
|
|
78
|
-
}
|
|
79
|
-
return wb;
|
|
55
|
+
return buildSingleTestcaseWorkbook(
|
|
56
|
+
{ sheetName: 'Testcases', summary, rows, specLink },
|
|
57
|
+
apiDetail,
|
|
58
|
+
{ sungenVersion: getPackageVersion() },
|
|
59
|
+
);
|
|
80
60
|
}
|
|
81
61
|
|
|
82
62
|
/**
|
|
@@ -99,491 +79,16 @@ export interface LocaleSheet {
|
|
|
99
79
|
}
|
|
100
80
|
|
|
101
81
|
export function renderXlsxMultiSheet(sheets: LocaleSheet[]): ExcelJS.Workbook {
|
|
102
|
-
|
|
103
|
-
throw new Error('renderXlsxMultiSheet requires at least one locale sheet');
|
|
104
|
-
}
|
|
105
|
-
const wb = new ExcelJS.Workbook();
|
|
106
|
-
wb.creator = 'sungen delivery';
|
|
107
|
-
wb.created = new Date();
|
|
108
|
-
// Overview first — a per-sheet roll-up (Passed/Failed/Pending/N/A/Remain/Total)
|
|
109
|
-
// plus a grand-total row, so QA sees the whole picture before the detail sheets.
|
|
110
|
-
addOverviewSheet(wb, sheets);
|
|
111
|
-
for (const s of sheets) {
|
|
112
|
-
addTestcaseSheet(wb, s.sheetName, s.summary, s.rows, s.specLink);
|
|
113
|
-
}
|
|
114
|
-
return wb;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Render the shared BM-2-901-13 masthead (rows 1-4) onto a worksheet:
|
|
119
|
-
* Sun* logo (A1:C3), TESTCASE title (D1:F3), No/Version/Issue-Date block
|
|
120
|
-
* (G1:H3), company line (A4:F4), ISO line (G4:H4). Every sheet in a delivery
|
|
121
|
-
* workbook — Overview, Auto, Manual — carries this same header band.
|
|
122
|
-
*/
|
|
123
|
-
function renderReportHeaderBand(
|
|
124
|
-
wb: ExcelJS.Workbook,
|
|
125
|
-
ws: ExcelJS.Worksheet,
|
|
126
|
-
titleLabel: string,
|
|
127
|
-
): void {
|
|
128
|
-
const issueDate = (() => {
|
|
129
|
-
const d = new Date();
|
|
130
|
-
return `${String(d.getDate()).padStart(2, '0')}/${String(d.getMonth() + 1).padStart(2, '0')}/${d.getFullYear()}`;
|
|
131
|
-
})();
|
|
132
|
-
|
|
133
|
-
// Ensure rows 1..4 exist before merging.
|
|
134
|
-
for (let r = 1; r <= 4; r++) ws.getRow(r);
|
|
135
|
-
|
|
136
|
-
ws.mergeCells('A1:C3');
|
|
137
|
-
ws.mergeCells('D1:F3');
|
|
138
|
-
ws.mergeCells('G1:H1');
|
|
139
|
-
ws.mergeCells('G2:H2');
|
|
140
|
-
ws.mergeCells('G3:H3');
|
|
141
|
-
ws.mergeCells('A4:F4');
|
|
142
|
-
ws.mergeCells('G4:H4');
|
|
143
|
-
|
|
144
|
-
// A1 (logo band, merged A1:C3) — border + embedded Sun* logo (base64 inline).
|
|
145
|
-
const a1 = ws.getCell('A1');
|
|
146
|
-
a1.alignment = { horizontal: 'center', vertical: 'middle' };
|
|
147
|
-
a1.border = allBordersBlack;
|
|
148
|
-
|
|
149
|
-
try {
|
|
150
|
-
const imageId = wb.addImage({
|
|
151
|
-
buffer: Buffer.from(SUN_LOGO_PNG_BASE64, 'base64') as unknown as ExcelJS.Buffer,
|
|
152
|
-
extension: 'png',
|
|
153
|
-
});
|
|
154
|
-
// Centre a fixed-size 90×51 logo inside A1:C3 using absolute EMU offsets.
|
|
155
|
-
ws.addImage(imageId, {
|
|
156
|
-
tl: { nativeCol: 0, nativeColOff: 1237500, nativeRow: 0, nativeRowOff: 42862 } as unknown as ExcelJS.Anchor,
|
|
157
|
-
ext: { width: 90, height: 51 },
|
|
158
|
-
editAs: 'oneCell',
|
|
159
|
-
} as unknown as ExcelJS.ImageRange);
|
|
160
|
-
} catch { /* logo is decorative — never block export */ }
|
|
161
|
-
|
|
162
|
-
// D1 (TESTCASE title)
|
|
163
|
-
const d1 = ws.getCell('D1');
|
|
164
|
-
d1.value = titleLabel;
|
|
165
|
-
d1.font = { bold: true, size: 18, name: TIMES };
|
|
166
|
-
d1.alignment = { horizontal: 'center', vertical: 'middle', wrapText: true };
|
|
167
|
-
d1.border = allBordersBlack;
|
|
168
|
-
|
|
169
|
-
// G1 — No: BM-2-901-13
|
|
170
|
-
const g1 = ws.getCell('G1');
|
|
171
|
-
g1.value = 'No: BM-2-901-13';
|
|
172
|
-
g1.font = { size: 12, name: TIMES };
|
|
173
|
-
g1.alignment = { vertical: 'middle' };
|
|
174
|
-
g1.border = { top: thinBlack, left: thinBlack, right: thinBlack };
|
|
175
|
-
|
|
176
|
-
// G2 — Version
|
|
177
|
-
const g2 = ws.getCell('G2');
|
|
178
|
-
g2.value = `Version: ${getPackageVersion()}`;
|
|
179
|
-
g2.font = { size: 12, name: TIMES };
|
|
180
|
-
g2.alignment = { vertical: 'middle' };
|
|
181
|
-
g2.border = { left: thinBlack, right: thinBlack };
|
|
182
|
-
|
|
183
|
-
// G3 — Issue Date
|
|
184
|
-
const g3 = ws.getCell('G3');
|
|
185
|
-
g3.value = `Issue Date: ${issueDate}`;
|
|
186
|
-
g3.font = { size: 12, name: TIMES };
|
|
187
|
-
g3.alignment = { vertical: 'middle' };
|
|
188
|
-
g3.border = { left: thinBlack, right: thinBlack, bottom: thinBlack };
|
|
189
|
-
|
|
190
|
-
// A4 — SUN ASTERISK VIETNAM CO., LTD
|
|
191
|
-
const a4 = ws.getCell('A4');
|
|
192
|
-
a4.value = 'SUN ASTERISK VIETNAM CO., LTD';
|
|
193
|
-
a4.font = { bold: true, size: 10, name: TIMES };
|
|
194
|
-
a4.alignment = { vertical: 'middle' };
|
|
195
|
-
a4.border = allBordersBlack;
|
|
196
|
-
|
|
197
|
-
// G4 — ISO/IEC ...
|
|
198
|
-
const g4 = ws.getCell('G4');
|
|
199
|
-
g4.value = 'ISO/IEC 27001:2022 & ISO 9001:2015';
|
|
200
|
-
g4.font = { bold: true, size: 10, name: TIMES };
|
|
201
|
-
g4.alignment = { horizontal: 'right', vertical: 'middle', wrapText: true };
|
|
202
|
-
g4.border = allBordersBlack;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// ---------------------------------------------------------------------------
|
|
206
|
-
// Overview sheet — the first tab in every multi-sheet delivery workbook.
|
|
207
|
-
// Rolls up each testcase sheet's Passed/Failed/Pending/N/A/Remain/Total into
|
|
208
|
-
// one summary table (+ a grand-total row) under the shared masthead. Reads
|
|
209
|
-
// only each sheet's summary — never touches the detail sheets themselves.
|
|
210
|
-
// ---------------------------------------------------------------------------
|
|
211
|
-
|
|
212
|
-
/** Column headers for the Overview roll-up table (cols A..H). */
|
|
213
|
-
const OVERVIEW_HEADERS = ['#', 'Sheet name', 'Passed', 'Failed', 'Pending', 'N/A', 'Remain', 'Total'];
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Prepend an "Overview" worksheet summarizing every sheet in `sheets`.
|
|
217
|
-
*
|
|
218
|
-
* `Remain = Total − Passed − N/A` (i.e. Failed + Pending) so the number
|
|
219
|
-
* reconciles with the "Remaining" cell in each detail sheet's summary band.
|
|
220
|
-
*/
|
|
221
|
-
function addOverviewSheet(wb: ExcelJS.Workbook, sheets: LocaleSheet[]): void {
|
|
222
|
-
const ws = wb.addWorksheet('Overview');
|
|
223
|
-
|
|
224
|
-
// Table starts at column B row 7 (A is a thin left margin). Widths keep the
|
|
225
|
-
// A..H masthead readable AND the count columns tidy.
|
|
226
|
-
ws.columns = [
|
|
227
|
-
{ width: 4 }, // A — left margin
|
|
228
|
-
{ width: 6 }, // B — #
|
|
229
|
-
{ width: 26 }, // C — Sheet name
|
|
230
|
-
{ width: 13 }, // D — Passed
|
|
231
|
-
{ width: 13 }, // E — Failed
|
|
232
|
-
{ width: 13 }, // F — Pending
|
|
233
|
-
{ width: 13 }, // G — N/A
|
|
234
|
-
{ width: 13 }, // H — Remain
|
|
235
|
-
{ width: 13 }, // I — Total
|
|
236
|
-
];
|
|
237
|
-
|
|
238
|
-
const titleScreen = sheets[0]?.summary.screen ?? '';
|
|
239
|
-
renderReportHeaderBand(wb, ws, `${titleScreen.toUpperCase()} TESTCASE`);
|
|
240
|
-
|
|
241
|
-
// Roll-up table: header on row 7, first column B (index 2).
|
|
242
|
-
const HEADER_ROW = 7;
|
|
243
|
-
const FIRST_COL = 2; // column B
|
|
244
|
-
const headerRow = ws.getRow(HEADER_ROW);
|
|
245
|
-
headerRow.height = 20;
|
|
246
|
-
OVERVIEW_HEADERS.forEach((label, i) => {
|
|
247
|
-
const c = headerRow.getCell(FIRST_COL + i);
|
|
248
|
-
c.value = label;
|
|
249
|
-
c.font = { bold: true, size: 10, color: BLACK, name: ARIAL_FONT };
|
|
250
|
-
c.fill = { type: 'pattern', pattern: 'solid', fgColor: LAVENDER };
|
|
251
|
-
c.alignment = { horizontal: 'center', vertical: 'middle', wrapText: true };
|
|
252
|
-
c.border = allBordersBlack;
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
const totals = { passed: 0, failed: 0, pending: 0, na: 0, remain: 0, total: 0 };
|
|
256
|
-
|
|
257
|
-
const writeDataRow = (rowIdx: number, values: ExcelJS.CellValue[], isTotal: boolean): void => {
|
|
258
|
-
const row = ws.getRow(rowIdx);
|
|
259
|
-
values.forEach((v, i) => {
|
|
260
|
-
const c = row.getCell(FIRST_COL + i);
|
|
261
|
-
c.value = v;
|
|
262
|
-
c.font = { bold: isTotal, size: 10, color: BLACK, name: ARIAL_FONT };
|
|
263
|
-
// The '#' + 'Sheet name' columns read left; the counts centre like the band.
|
|
264
|
-
c.alignment = { horizontal: i <= 1 ? 'left' : 'center', vertical: 'middle' };
|
|
265
|
-
c.border = allBordersBlack;
|
|
266
|
-
if (isTotal) c.fill = { type: 'pattern', pattern: 'solid', fgColor: LAVENDER };
|
|
267
|
-
});
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
// Each detail sheet carries a LIVE summary band (row 7): C7 Total · D7 Passed · E7 Failed ·
|
|
271
|
-
// F7 Pending · G7 N/A · H7 Remaining, all COUNTA/COUNTIF over the data area. The Overview
|
|
272
|
-
// REFERENCES those cells (`='<sheet>'!D7`) instead of freezing a number at export time — so when
|
|
273
|
-
// QA adds/edits/removes a row in the Auto or Manual sheet, the roll-up recomputes automatically.
|
|
274
|
-
const qname = (name: string): string => name.replace(/'/g, "''"); // Excel escapes ' by doubling
|
|
275
|
-
const ref = (name: string, cell: string, result: number): ExcelJS.CellFormulaValue =>
|
|
276
|
-
({ formula: `'${qname(name)}'!${cell}`, result });
|
|
277
|
-
|
|
278
|
-
let rowIdx = HEADER_ROW + 1;
|
|
279
|
-
const firstDataRow = rowIdx;
|
|
280
|
-
sheets.forEach((s, i) => {
|
|
281
|
-
const su = s.summary;
|
|
282
|
-
const remain = Math.max(0, su.total - su.passed - su.na);
|
|
283
|
-
writeDataRow(rowIdx, [
|
|
284
|
-
i + 1,
|
|
285
|
-
s.sheetName,
|
|
286
|
-
ref(s.sheetName, 'D7', su.passed),
|
|
287
|
-
ref(s.sheetName, 'E7', su.failed),
|
|
288
|
-
ref(s.sheetName, 'F7', su.pending),
|
|
289
|
-
ref(s.sheetName, 'G7', su.na),
|
|
290
|
-
ref(s.sheetName, 'H7', remain),
|
|
291
|
-
ref(s.sheetName, 'C7', su.total),
|
|
292
|
-
], false);
|
|
293
|
-
totals.passed += su.passed;
|
|
294
|
-
totals.failed += su.failed;
|
|
295
|
-
totals.pending += su.pending;
|
|
296
|
-
totals.na += su.na;
|
|
297
|
-
totals.remain += remain;
|
|
298
|
-
totals.total += su.total;
|
|
299
|
-
rowIdx += 1;
|
|
300
|
-
});
|
|
301
|
-
const lastDataRow = rowIdx - 1;
|
|
302
|
-
|
|
303
|
-
// Grand total = SUM of the per-sheet Overview cells (also live — recomputes with the references
|
|
304
|
-
// above). Overview count columns are D..I (Passed·Failed·Pending·N/A·Remain·Total).
|
|
305
|
-
const sumCol = (col: string, result: number): ExcelJS.CellFormulaValue =>
|
|
306
|
-
({ formula: `SUM(${col}${firstDataRow}:${col}${lastDataRow})`, result });
|
|
307
|
-
writeDataRow(
|
|
308
|
-
rowIdx,
|
|
309
|
-
[
|
|
310
|
-
'', 'Total',
|
|
311
|
-
sumCol('D', totals.passed),
|
|
312
|
-
sumCol('E', totals.failed),
|
|
313
|
-
sumCol('F', totals.pending),
|
|
314
|
-
sumCol('G', totals.na),
|
|
315
|
-
sumCol('H', totals.remain),
|
|
316
|
-
sumCol('I', totals.total),
|
|
317
|
-
],
|
|
318
|
-
true,
|
|
319
|
-
);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* Append one BM-2-901-13 testcase sheet to the given workbook. Sheet content
|
|
324
|
-
* (layout, summary band, data rows, auto-filter, protection) is identical to
|
|
325
|
-
* the single-sheet `renderXlsx` output — only the sheet name differs.
|
|
326
|
-
*/
|
|
327
|
-
function addTestcaseSheet(
|
|
328
|
-
wb: ExcelJS.Workbook,
|
|
329
|
-
sheetName: string,
|
|
330
|
-
summary: ScreenSummary,
|
|
331
|
-
rows: TestCaseRow[],
|
|
332
|
-
specLink: string,
|
|
333
|
-
): void {
|
|
334
|
-
const ws = wb.addWorksheet(sheetName, {
|
|
335
|
-
views: [{ state: 'frozen', ySplit: 0, xSplit: 0 }],
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// -- Column widths matching template_report.xlsx (Sample sheet) --
|
|
339
|
-
ws.columns = [
|
|
340
|
-
{ width: 20 }, // A — TC ID (wider to fit long flow IDs like FLOW-KUDO-…)
|
|
341
|
-
{ width: 12.5 }, // B — Screen/Function
|
|
342
|
-
{ width: 15.38 }, // C — Big item
|
|
343
|
-
{ width: 16.25 }, // D — Medium item
|
|
344
|
-
{ width: 17 }, // E — Test Object
|
|
345
|
-
{ width: 25.5 }, // F — Pre-condition
|
|
346
|
-
{ width: 24.88 }, // G — Test Data
|
|
347
|
-
{ width: 50 }, // H — Steps (widened ~2× — steps are the longest cell)
|
|
348
|
-
{ width: 41 }, // I — Expected results
|
|
349
|
-
{ width: 12 }, // J — Priority
|
|
350
|
-
{ width: 13.5 }, // K — Testcase type
|
|
351
|
-
{ width: 15.88 }, // L — Test Result
|
|
352
|
-
{ width: 13.5 }, // M — Executed Date
|
|
353
|
-
{ width: 16.5 }, // N — Test Executor
|
|
354
|
-
{ width: 23 }, // O — Test Environment
|
|
355
|
-
{ width: 29 }, // P — Note
|
|
356
|
-
];
|
|
357
|
-
|
|
358
|
-
// -- Top metadata band (rows 1-4) — shared BM-2-901-13 masthead --
|
|
359
|
-
renderReportHeaderBand(wb, ws, `${summary.screen.toUpperCase()} TESTCASE`);
|
|
360
|
-
// Materialize rows 5..8 so the summary band + row-9 spacer land at the right offsets.
|
|
361
|
-
for (let r = 5; r <= 8; r++) ws.getRow(r);
|
|
362
|
-
|
|
363
|
-
// -- Row 5: spacer (height auto-fit). --
|
|
364
|
-
|
|
365
|
-
// -- Row 6: Summary headers (cols C..H), lavender fill --
|
|
366
|
-
const sumLabels: Record<string, string> = {
|
|
367
|
-
C: 'Total TCs', D: 'Passed', E: 'Failed', F: 'Pending', G: 'N/A', H: 'Remaining',
|
|
368
|
-
};
|
|
369
|
-
for (const [col, label] of Object.entries(sumLabels)) {
|
|
370
|
-
const c = ws.getCell(`${col}6`);
|
|
371
|
-
c.value = label;
|
|
372
|
-
c.font = { bold: true, size: 10, color: BLACK, name: ARIAL_FONT };
|
|
373
|
-
c.fill = { type: 'pattern', pattern: 'solid', fgColor: LAVENDER };
|
|
374
|
-
c.alignment = { horizontal: 'center', vertical: 'top' };
|
|
375
|
-
c.border = allBordersBlack;
|
|
376
|
-
}
|
|
377
|
-
// No explicit height → Excel auto-fits this row's content.
|
|
378
|
-
|
|
379
|
-
// -- Row 7: Counts (cols C..H), live formulas referencing the data area --
|
|
380
|
-
// The data region begins at row 14 — the row immediately AFTER the column-header row (row 13).
|
|
381
|
-
// Start the ranges there (NOT row 15): the first category divider usually sits at row 14 with a
|
|
382
|
-
// BLANK col A (so COUNTA skips it), but a sheet whose first row after the header is real data —
|
|
383
|
-
// no leading divider — would be UNDER-counted by a range that started at 15. Row 14 covers both.
|
|
384
|
-
const COUNT_RANGE_START = 14;
|
|
385
|
-
const COUNT_RANGE_END = 10000;
|
|
386
|
-
const r7Values: Record<string, ExcelJS.CellValue> = {
|
|
387
|
-
C: { formula: `COUNTA(A${COUNT_RANGE_START}:A${COUNT_RANGE_END})`, result: summary.total } as ExcelJS.CellFormulaValue,
|
|
388
|
-
D: { formula: `COUNTIF(L${COUNT_RANGE_START}:L${COUNT_RANGE_END},"Passed")`, result: summary.passed } as ExcelJS.CellFormulaValue,
|
|
389
|
-
E: { formula: `COUNTIF(L${COUNT_RANGE_START}:L${COUNT_RANGE_END},"Failed")`, result: summary.failed } as ExcelJS.CellFormulaValue,
|
|
390
|
-
F: { formula: `COUNTIF(L${COUNT_RANGE_START}:L${COUNT_RANGE_END},"Pending")`, result: summary.pending } as ExcelJS.CellFormulaValue,
|
|
391
|
-
G: { formula: `COUNTIF(L${COUNT_RANGE_START}:L${COUNT_RANGE_END},"N/A")`, result: summary.na } as ExcelJS.CellFormulaValue,
|
|
392
|
-
H: { formula: 'C7-D7-G7', result: summary.failed + summary.pending } as ExcelJS.CellFormulaValue,
|
|
393
|
-
};
|
|
394
|
-
for (const [col, val] of Object.entries(r7Values)) {
|
|
395
|
-
const c = ws.getCell(`${col}7`);
|
|
396
|
-
c.value = val;
|
|
397
|
-
c.font = { size: 10, color: BLACK, name: ARIAL_FONT };
|
|
398
|
-
c.fill = { type: 'pattern', pattern: 'solid', fgColor: WHITE };
|
|
399
|
-
c.alignment = { horizontal: 'center', vertical: 'top' };
|
|
400
|
-
c.border = allBordersBlack;
|
|
401
|
-
if (col === 'H') c.numFmt = '#,##0';
|
|
402
|
-
}
|
|
403
|
-
// No explicit height → Excel auto-fits.
|
|
404
|
-
|
|
405
|
-
// C8 has no value in the template but still needs a border so the band
|
|
406
|
-
// visually closes underneath "Total TCs".
|
|
407
|
-
const c8 = ws.getCell('C8');
|
|
408
|
-
c8.font = { size: 10, color: BLACK, name: ARIAL_FONT };
|
|
409
|
-
c8.fill = { type: 'pattern', pattern: 'solid', fgColor: WHITE };
|
|
410
|
-
c8.alignment = { horizontal: 'center', vertical: 'top' };
|
|
411
|
-
c8.border = allBordersBlack;
|
|
412
|
-
|
|
413
|
-
// -- Row 8: Percentages (cols D..H), formula = count / (Total − N/A) --
|
|
414
|
-
const r8Values: Record<string, ExcelJS.CellValue> = {
|
|
415
|
-
D: { formula: 'IFERROR(D7/(C7-G7),0)', result: summary.passed / Math.max(1, summary.total - summary.na) } as ExcelJS.CellFormulaValue,
|
|
416
|
-
E: { formula: 'IFERROR(E7/(C7-G7),0)', result: summary.failed / Math.max(1, summary.total - summary.na) } as ExcelJS.CellFormulaValue,
|
|
417
|
-
F: { formula: 'IFERROR(F7/(C7-G7),0)', result: summary.pending / Math.max(1, summary.total - summary.na) } as ExcelJS.CellFormulaValue,
|
|
418
|
-
G: { formula: 'IFERROR(G7/(C7-G7),0)', result: summary.na / Math.max(1, summary.total - summary.na) } as ExcelJS.CellFormulaValue,
|
|
419
|
-
H: { formula: 'IFERROR(H7/(C7-G7),0)', result: (summary.failed + summary.pending) / Math.max(1, summary.total - summary.na) } as ExcelJS.CellFormulaValue,
|
|
420
|
-
};
|
|
421
|
-
for (const [col, val] of Object.entries(r8Values)) {
|
|
422
|
-
const c = ws.getCell(`${col}8`);
|
|
423
|
-
c.value = val;
|
|
424
|
-
c.font = { size: 10, color: BLACK, name: ARIAL_FONT };
|
|
425
|
-
c.fill = { type: 'pattern', pattern: 'solid', fgColor: WHITE };
|
|
426
|
-
c.alignment = { horizontal: 'center', vertical: 'top' };
|
|
427
|
-
c.border = allBordersBlack;
|
|
428
|
-
c.numFmt = '0%';
|
|
429
|
-
}
|
|
430
|
-
// No explicit height → Excel auto-fits.
|
|
431
|
-
|
|
432
|
-
// After rows 1-8 are populated, append a blank row 9 spacer.
|
|
433
|
-
while (ws.rowCount < 9) ws.addRow([]);
|
|
434
|
-
|
|
435
|
-
const specRow = ws.addRow(['Spec/Design link:', specLink]);
|
|
436
|
-
specRow.getCell(1).font = { bold: true };
|
|
437
|
-
specRow.getCell(2).font = { color: { argb: 'FF1F4E78' }, underline: true };
|
|
438
|
-
|
|
439
|
-
ws.addRow([]); // spacer
|
|
440
|
-
|
|
441
|
-
const legendRow = ws.addRow(['*: Mandatory']);
|
|
442
|
-
legendRow.getCell(1).font = { italic: true, color: { argb: 'FF808080' } };
|
|
443
|
-
|
|
444
|
-
// -- Column header row (bold, filled, wrapped) --
|
|
445
|
-
const headerRow = ws.addRow([
|
|
446
|
-
'TC ID*',
|
|
447
|
-
'Screen/Function',
|
|
448
|
-
'Big item',
|
|
449
|
-
'Medium item',
|
|
450
|
-
'Test Object',
|
|
451
|
-
'Pre-condition',
|
|
452
|
-
'Test Data',
|
|
453
|
-
'Steps*',
|
|
454
|
-
'Expected results*',
|
|
455
|
-
'Priority',
|
|
456
|
-
'Testcase type',
|
|
457
|
-
'Test Result*',
|
|
458
|
-
'Executed Date*',
|
|
459
|
-
'Test Executor*',
|
|
460
|
-
'Test Environment',
|
|
461
|
-
'Note\n(Test evidence, DefectID, Actual result)',
|
|
462
|
-
]);
|
|
463
|
-
headerRow.height = 38;
|
|
464
|
-
headerRow.eachCell((cell) => {
|
|
465
|
-
cell.font = { bold: true, color: { argb: HEADER_FONT } };
|
|
466
|
-
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: HEADER_FILL } };
|
|
467
|
-
cell.alignment = { horizontal: 'center', vertical: 'middle', wrapText: true };
|
|
468
|
-
applyBorder(cell);
|
|
469
|
-
});
|
|
470
|
-
|
|
471
|
-
// No freeze — the whole sheet scrolls freely (the masthead + summary band + header scroll away
|
|
472
|
-
// with the data). QA asked for this so the wide Steps/Expected columns aren't pinned under a frozen
|
|
473
|
-
// header on smaller screens.
|
|
474
|
-
ws.views = [{ state: 'normal' }];
|
|
475
|
-
|
|
476
|
-
// -- Data rows grouped by category --
|
|
477
|
-
const order = ['Accessing', 'GUI', 'Function'];
|
|
478
|
-
const grouped = new Map<string, TestCaseRow[]>();
|
|
479
|
-
for (const r of rows) {
|
|
480
|
-
const g = grouped.get(r.category2) || [];
|
|
481
|
-
g.push(r);
|
|
482
|
-
grouped.set(r.category2, g);
|
|
483
|
-
}
|
|
484
|
-
const emittedGroups = new Set<string>();
|
|
485
|
-
|
|
486
|
-
function emitGroup(groupName: string, groupRows: TestCaseRow[]): void {
|
|
487
|
-
// Column A (TC ID) must stay TRULY blank on a divider — never write '' here. COUNTA counts
|
|
488
|
-
// empty-string cells, so an '' in A made the generated total (=COUNTA(A15:A…)) over-count by
|
|
489
|
-
// one per group divider when recalculated (e.g. in Google Sheets). Set only the group name in B;
|
|
490
|
-
// the lavender band still spans every column via the fill loop below (style only, no value).
|
|
491
|
-
const divider = ws.addRow([]);
|
|
492
|
-
divider.getCell(2).value = groupName;
|
|
493
|
-
divider.getCell(2).font = { bold: true };
|
|
494
|
-
divider.eachCell({ includeEmpty: false }, (cell) => {
|
|
495
|
-
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: CATEGORY_FILL } };
|
|
496
|
-
});
|
|
497
|
-
// Fill the full width so the band spans the whole table
|
|
498
|
-
for (let i = 1; i <= COL_COUNT; i++) {
|
|
499
|
-
const c = divider.getCell(i);
|
|
500
|
-
c.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: CATEGORY_FILL } };
|
|
501
|
-
applyBorder(c);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
for (const r of groupRows) {
|
|
505
|
-
const row = ws.addRow([
|
|
506
|
-
r.tcId,
|
|
507
|
-
'',
|
|
508
|
-
'',
|
|
509
|
-
'',
|
|
510
|
-
r.category1,
|
|
511
|
-
r.precondition,
|
|
512
|
-
r.testData,
|
|
513
|
-
r.steps,
|
|
514
|
-
r.expectedResults,
|
|
515
|
-
r.priority,
|
|
516
|
-
r.testcaseType,
|
|
517
|
-
r.testResult,
|
|
518
|
-
r.executedDate,
|
|
519
|
-
r.testExecutor,
|
|
520
|
-
r.testEnvironment,
|
|
521
|
-
r.note,
|
|
522
|
-
]);
|
|
523
|
-
row.alignment = { vertical: 'top', wrapText: true };
|
|
524
|
-
row.eachCell({ includeEmpty: true }, (cell, colNumber) => {
|
|
525
|
-
applyBorder(cell);
|
|
526
|
-
if (colNumber === 1) {
|
|
527
|
-
cell.font = { bold: true };
|
|
528
|
-
}
|
|
529
|
-
if (colNumber === 12) {
|
|
530
|
-
// Test Result — colour-code
|
|
531
|
-
const val = String(cell.value || '');
|
|
532
|
-
if (val === 'Passed') {
|
|
533
|
-
cell.font = { color: { argb: 'FF107C41' }, bold: true };
|
|
534
|
-
} else if (val === 'Failed') {
|
|
535
|
-
cell.font = { color: { argb: 'FFC00000' }, bold: true };
|
|
536
|
-
} else if (val === 'Pending') {
|
|
537
|
-
cell.font = { color: { argb: 'FF996D00' }, bold: true };
|
|
538
|
-
} else if (val === 'N/A') {
|
|
539
|
-
cell.font = { color: { argb: 'FF808080' } };
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
for (const groupName of order) {
|
|
547
|
-
const groupRows = grouped.get(groupName);
|
|
548
|
-
if (!groupRows || groupRows.length === 0) continue;
|
|
549
|
-
emittedGroups.add(groupName);
|
|
550
|
-
emitGroup(groupName, groupRows);
|
|
551
|
-
}
|
|
552
|
-
for (const [groupName, groupRows] of grouped.entries()) {
|
|
553
|
-
if (emittedGroups.has(groupName)) continue;
|
|
554
|
-
emitGroup(groupName, groupRows);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// Auto-filter on the header row so QA can filter by result / priority / category
|
|
558
|
-
ws.autoFilter = {
|
|
559
|
-
from: { row: headerRow.number, column: 1 },
|
|
560
|
-
to: { row: ws.rowCount, column: COL_COUNT },
|
|
561
|
-
};
|
|
562
|
-
|
|
563
|
-
// Sheet protection lets the picLocks on the embedded logo take effect
|
|
564
|
-
// (Excel honours image locks only when the sheet is protected). Empty
|
|
565
|
-
// password — QA can run Review → Unprotect Sheet if they need to edit.
|
|
566
|
-
// `objects: false` here is ExcelJS's inverted semantic that writes
|
|
567
|
-
// `objects="1"` in XML (= objects ARE locked).
|
|
568
|
-
(ws as unknown as { sheetProtection: object }).sheetProtection = {
|
|
569
|
-
sheet: true,
|
|
570
|
-
objects: false,
|
|
571
|
-
scenarios: false,
|
|
572
|
-
};
|
|
82
|
+
return buildTestcaseWorkbook(sheets, { sungenVersion: getPackageVersion() });
|
|
573
83
|
}
|
|
574
84
|
|
|
575
|
-
// ---------------------------------------------------------------------------
|
|
576
|
-
// API detail sheet (api-kind units only)
|
|
577
|
-
// Second worksheet appended after Testcases — never alters the Testcases sheet.
|
|
578
|
-
// ---------------------------------------------------------------------------
|
|
579
|
-
|
|
580
|
-
const API_DETAIL_HEADER_FILL = 'FF2E5984'; // dark blue header for differentiation
|
|
581
|
-
const API_DETAIL_HEADER_FONT = 'FFFFFFFF'; // white text on dark header
|
|
582
|
-
|
|
583
85
|
/**
|
|
584
86
|
* Build ApiDetailRow[] from the apis.yaml catalog + feature-level annotations.
|
|
585
87
|
* Called once per feature file for api-kind units in the delivery pipeline.
|
|
586
88
|
*
|
|
89
|
+
* Delegates to the pure builder, injecting the feature-parser tag extractors
|
|
90
|
+
* (the builder cannot import feature-parser — it must stay browser-safe).
|
|
91
|
+
*
|
|
587
92
|
* @param catalog Parsed apis.yaml keyed by endpoint name
|
|
588
93
|
* @param scenarios Scenario-level tag arrays from parseFeatureMetadata().scenarios
|
|
589
94
|
*/
|
|
@@ -591,138 +96,11 @@ export function buildApiDetailRows(
|
|
|
591
96
|
catalog: Record<string, ApiCatalogEntry>,
|
|
592
97
|
scenarios: Array<{ tags: string[] }>,
|
|
593
98
|
): ApiDetailRow[] {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
const endpoint = entry.path ?? endpointName;
|
|
599
|
-
const datasource = entry.datasource ?? '';
|
|
600
|
-
|
|
601
|
-
// Auth: look for @auth: tag in any scenario that calls this endpoint.
|
|
602
|
-
const authTags = scenarios.flatMap((s) => {
|
|
603
|
-
const calls = extractApiCallOrder(s.tags);
|
|
604
|
-
if (!calls.includes(endpointName)) return [];
|
|
605
|
-
return s.tags.filter((t) => t.startsWith('@auth:'));
|
|
606
|
-
});
|
|
607
|
-
const uniqueAuth = [...new Set(authTags.map((t) => t.slice('@auth:'.length)))];
|
|
608
|
-
const authDatasource = [datasource, ...uniqueAuth].filter(Boolean).join('; ');
|
|
609
|
-
|
|
610
|
-
// Request shape: compose from body + params + encoding.
|
|
611
|
-
const bodyStr = entry.body
|
|
612
|
-
? `body: ${typeof entry.body === 'string' ? entry.body : JSON.stringify(entry.body)}`
|
|
613
|
-
: '';
|
|
614
|
-
const paramsArr = Array.isArray(entry.params) ? entry.params as string[] : [];
|
|
615
|
-
const paramsStr = paramsArr.length > 0 ? `params: [${paramsArr.join(', ')}]` : '';
|
|
616
|
-
const requestShape = [bodyStr, paramsStr].filter(Boolean).join('; ') || '—';
|
|
617
|
-
|
|
618
|
-
// Expected-status matrix: aggregate @cases dataset labels + expected status
|
|
619
|
-
// from scenarios that call this endpoint. Fall back to catalog expect.status.
|
|
620
|
-
const statusEntries: string[] = [];
|
|
621
|
-
for (const sc of scenarios) {
|
|
622
|
-
const calls = extractApiCallOrder(sc.tags);
|
|
623
|
-
if (!calls.includes(endpointName)) continue;
|
|
624
|
-
const dataset = extractCasesDataset(sc.tags);
|
|
625
|
-
if (dataset) {
|
|
626
|
-
// @cases dataset name as label — actual per-row statuses live in test-data.yaml
|
|
627
|
-
statusEntries.push(`@cases:${dataset}`);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
// Show the catalog baseline status plus a pointer to any @cases matrix dataset (the per-row
|
|
631
|
-
// statuses live in test-data; resolving them into this cell is a later enrichment).
|
|
632
|
-
const catalogStatus = entry.expect?.status != null ? String(entry.expect.status) : '';
|
|
633
|
-
const expectedStatusMatrix =
|
|
634
|
-
[catalogStatus, ...new Set(statusEntries)].filter(Boolean).join('; ') || '—';
|
|
635
|
-
|
|
636
|
-
// Flow steps: ordered @api names from flow-tagged scenarios referencing this endpoint.
|
|
637
|
-
const flowStepsSet = new Set<string>();
|
|
638
|
-
for (const sc of scenarios) {
|
|
639
|
-
const calls = extractApiCallOrder(sc.tags);
|
|
640
|
-
if (!calls.includes(endpointName)) continue;
|
|
641
|
-
// All scenarios show their call order; flow scenarios show multi-step chains.
|
|
642
|
-
if (calls.length > 1) {
|
|
643
|
-
flowStepsSet.add(calls.join(' → '));
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
const flowSteps = [...flowStepsSet].join('; ') || '—';
|
|
647
|
-
|
|
648
|
-
// Concurrency invariant: from @concurrent scenarios calling this endpoint.
|
|
649
|
-
const concurrencyParts: string[] = [];
|
|
650
|
-
for (const sc of scenarios) {
|
|
651
|
-
const calls = extractApiCallOrder(sc.tags);
|
|
652
|
-
if (!calls.includes(endpointName)) continue;
|
|
653
|
-
const inv = extractConcurrencyInvariant(sc.tags);
|
|
654
|
-
if (inv) concurrencyParts.push(inv);
|
|
655
|
-
}
|
|
656
|
-
const concurrencyInvariant = concurrencyParts.join('; ') || '—';
|
|
657
|
-
|
|
658
|
-
rows.push({
|
|
659
|
-
endpoint,
|
|
660
|
-
method,
|
|
661
|
-
authDatasource,
|
|
662
|
-
requestShape,
|
|
663
|
-
expectedStatusMatrix,
|
|
664
|
-
flowSteps,
|
|
665
|
-
concurrencyInvariant,
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
return rows;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
/**
|
|
673
|
-
* Append a second "API detail" worksheet to the workbook.
|
|
674
|
-
* Called only for api-kind units; no effect on the Testcases sheet or other sheets.
|
|
675
|
-
*
|
|
676
|
-
* Columns: Endpoint · Method · Auth/Datasource · Request shape ·
|
|
677
|
-
* Expected-status matrix · Flow steps · Concurrency invariant
|
|
678
|
-
*/
|
|
679
|
-
export function addApiDetailSheet(wb: ExcelJS.Workbook, detailRows: ApiDetailRow[]): void {
|
|
680
|
-
const ws = wb.addWorksheet('API detail');
|
|
681
|
-
const ARIAL_FONT = 'Arial';
|
|
682
|
-
|
|
683
|
-
ws.columns = [
|
|
684
|
-
{ header: 'Endpoint', width: 35 },
|
|
685
|
-
{ header: 'Method', width: 10 },
|
|
686
|
-
{ header: 'Auth / Datasource', width: 22 },
|
|
687
|
-
{ header: 'Request shape', width: 40 },
|
|
688
|
-
{ header: 'Expected-status matrix', width: 30 },
|
|
689
|
-
{ header: 'Flow steps', width: 40 },
|
|
690
|
-
{ header: 'Concurrency invariant', width: 35 },
|
|
691
|
-
];
|
|
692
|
-
|
|
693
|
-
// Style the auto-generated header row (row 1).
|
|
694
|
-
const headerRow = ws.getRow(1);
|
|
695
|
-
headerRow.height = 30;
|
|
696
|
-
headerRow.eachCell((cell) => {
|
|
697
|
-
cell.font = { bold: true, color: { argb: API_DETAIL_HEADER_FONT }, name: ARIAL_FONT };
|
|
698
|
-
cell.fill = { type: 'pattern', pattern: 'solid', fgColor: { argb: API_DETAIL_HEADER_FILL } };
|
|
699
|
-
cell.alignment = { horizontal: 'center', vertical: 'middle', wrapText: true };
|
|
700
|
-
applyBorder(cell);
|
|
99
|
+
return buildApiDetailRowsPure(catalog, scenarios, {
|
|
100
|
+
extractApiCallOrder,
|
|
101
|
+
extractCasesDataset,
|
|
102
|
+
extractConcurrencyInvariant,
|
|
701
103
|
});
|
|
702
|
-
|
|
703
|
-
ws.views = [{ state: 'frozen', ySplit: 1 }];
|
|
704
|
-
|
|
705
|
-
for (const r of detailRows) {
|
|
706
|
-
const row = ws.addRow([
|
|
707
|
-
r.endpoint,
|
|
708
|
-
r.method,
|
|
709
|
-
r.authDatasource,
|
|
710
|
-
r.requestShape,
|
|
711
|
-
r.expectedStatusMatrix,
|
|
712
|
-
r.flowSteps,
|
|
713
|
-
r.concurrencyInvariant,
|
|
714
|
-
]);
|
|
715
|
-
row.alignment = { vertical: 'top', wrapText: true };
|
|
716
|
-
row.eachCell({ includeEmpty: true }, (cell) => {
|
|
717
|
-
applyBorder(cell);
|
|
718
|
-
cell.font = { name: ARIAL_FONT };
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
|
|
722
|
-
ws.autoFilter = {
|
|
723
|
-
from: { row: 1, column: 1 },
|
|
724
|
-
to: { row: ws.rowCount, column: 7 },
|
|
725
|
-
};
|
|
726
104
|
}
|
|
727
105
|
|
|
728
106
|
/**
|
|
@@ -753,7 +131,8 @@ export async function writeXlsx(
|
|
|
753
131
|
/**
|
|
754
132
|
* Post-process the workbook buffer: extend `<a:picLocks>` on every drawing
|
|
755
133
|
* with `noMove`, `noResize`, `noSelect`. Combined with the sheet protection
|
|
756
|
-
*
|
|
134
|
+
* set by the builder, the embedded logo can't be dragged, resized, or
|
|
135
|
+
* selected via the UI.
|
|
757
136
|
*/
|
|
758
137
|
export async function lockEmbeddedImages(buffer: Buffer): Promise<Buffer> {
|
|
759
138
|
const zip = await JSZip.loadAsync(buffer);
|
|
@@ -779,6 +158,3 @@ export async function lockEmbeddedImages(buffer: Buffer): Promise<Buffer> {
|
|
|
779
158
|
}
|
|
780
159
|
return zip.generateAsync({ type: 'nodebuffer', compression: 'DEFLATE' });
|
|
781
160
|
}
|
|
782
|
-
|
|
783
|
-
void applyBorder;
|
|
784
|
-
void ({} as AnyRow);
|