// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. /* eslint-disable no-console */ const path = require('path'); const fse = require('fs-extra'); const xml2js = require('xml2js'); /** * Parse a Maestro JUnit XML file and return a summary object * matching the shape produced by report.js generateShortSummary(). * * @param {string} xmlPath - Path to maestro-report.xml * @returns {{stats: object, statsFieldValue: string, flows: Array} | null} */ function parseMaestroReport(xmlPath) { if (!fse.existsSync(xmlPath)) { console.log(`Maestro report not found at ${xmlPath}`); return null; } const xml = fse.readFileSync(xmlPath, 'utf-8'); let parsed; xml2js.parseString(xml, {mergeAttrs: true}, (err, result) => { if (err) { console.log('Failed to parse Maestro XML:', err.message); return; } parsed = result; }); if (!parsed || !parsed.testsuites) { console.log('Maestro XML has unexpected structure'); return null; } const testsuites = parsed.testsuites; let tests = 0; let failures = 0; let errors = 0; let skipped = 0; let duration = 0; const flows = []; const failedNames = []; const suites = testsuites.testsuite || []; for (const suite of suites) { tests += parseInt(suite.tests?.[0] || '0', 10); failures += parseInt(suite.failures?.[0] || '0', 10); errors += parseInt(suite.errors?.[0] || '0', 10); skipped += parseInt(suite.skipped?.[0] || '0', 10); duration += parseFloat(suite.time?.[0] || '0') * 1000; const testcases = suite.testcase || []; for (const tc of testcases) { const name = tc.name?.[0] || 'unknown'; const classname = tc.classname?.[0] || suite.name?.[0] || ''; // The XML's `file` attribute is the flow's full path // (e.g. "detox/maestro/flows/calls/start_call.yml"). We extract the // category (parent directory under flows/) so screenshots whose // filename starts with the category prefix can be matched even // when the flow filename token isn't a substring of the screenshot // name (which is the common case for Maestro screenshots whose // names are author-defined ad-hoc strings). const file = (tc.$ && tc.$.file) || tc.file?.[0] || ''; const categoryMatch = String(file).match(/flows\/([^/]+)\//); const category = categoryMatch ? categoryMatch[1].toLowerCase() : ''; const time = parseFloat(tc.time?.[0] || '0'); let status = 'passed'; let failureMessage = null; if (tc.failure) { status = 'failed'; const failure = tc.failure[0]; failureMessage = (typeof failure === 'string' ? failure : failure._ || failure.message?.[0] || '').toString(); failedNames.push(name); } else if (tc.error) { status = 'error'; const errVal = tc.error[0]; failureMessage = (typeof errVal === 'string' ? errVal : errVal._ || errVal.message?.[0] || '').toString(); failedNames.push(name); } else if (tc.skipped) { status = 'skipped'; } flows.push({name, classname, file, category, time, status, failureMessage}); } } const passes = tests - (failures + errors + skipped); const passPercent = tests > 0 ? ((passes / tests) * 100).toFixed(2) : '0.00'; const now = new Date().toISOString(); const stats = { suites: suites.length, tests, skipped, failures, errors, duration, start: now, end: now, passes, passPercent, }; let statsFieldValue = ` | Key | Value | |:---|:---| | Passing Rate | ${stats.passPercent}% | | Duration | ${(stats.duration / (60 * 1000)).toFixed(4)} mins | | Tests | ${stats.tests} | | :white_check_mark: Passed | ${stats.passes} | | :x: Failed | ${stats.failures} | | :fast_forward: Skipped | ${stats.skipped} | `; if (failedNames.length > 0) { const maxShow = 5; const display = failedNames.length > maxShow ? [...failedNames.slice(0, maxShow - 1).map((f) => `- ${f}`), '- more...'] : failedNames.map((f) => `- ${f}`); statsFieldValue += '###### Failed Tests:\n' + display.join('\n'); } return {stats, statsFieldValue, flows}; } /** * Recursively walk a directory and return relative file paths (POSIX-style). */ function walkFiles(rootDir) { if (!fse.existsSync(rootDir)) { return []; } const collected = []; const stack = [rootDir]; while (stack.length) { const dir = stack.pop(); for (const entry of fse.readdirSync(dir, {withFileTypes: true})) { const full = path.join(dir, entry.name); if (entry.isDirectory()) { stack.push(full); } else if (entry.isFile()) { collected.push(path.relative(rootDir, full).split(path.sep).join('/')); } } } return collected; } /** * Sanitize a flow name to a filesystem-style token used for matching artifact * filenames. Maestro names artifacts using the flow name (minus extension), * with spaces/special-chars replaced. */ function normalizeFlowToken(name) { return name.toLowerCase().replace(/\.ya?ml$/i, '').replace(/[^a-z0-9]+/g, '_').replace(/^_|_$/g, ''); } /** * Score how strongly a screenshot/log path belongs to a given flow. * * Maestro screenshots are named by the flow author via `takeScreenshot:` and * usually combine a category prefix with an ad-hoc state name * (e.g. `calls-mute-initial-state.png`). The simple substring rule * (`lowerToken.includes(token)`) fails because the flow filename token * (`mute_unmute`) is rarely a substring of the screenshot's token * (`calls_mute_initial_state`). * * Scoring: * +100 per full-token substring match (kept so legacy well-named artifacts * like `mute_unmute_step3.png` still attribute correctly). * + 10 per shared word (>= 2 chars) between the flow's name tokens and * the file's name tokens — picks up `mute` in `calls-mute-initial-state`. * + 1 if the screenshot's leading prefix equals the flow's category * (e.g. `calls-...` for a flow under `detox/maestro/flows/calls/`) — a weak * tie-breaker so screenshots stay within their suite. * * Returns 0 when there's no plausible link; bucketing falls back to * `__unattributed` in that case. */ function scoreFlowMatch(flow, fileToken, fileWords, filePrefix) { let score = 0; if (flow.token && fileToken.includes(flow.token)) { score += 100; } if (flow.words.size) { for (const w of fileWords) { if (flow.words.has(w)) { score += 10; } } } if (flow.category && filePrefix && flow.category === filePrefix) { score += 1; } return score; } /** * Build authoritative screenshot → flow mapping from Maestro command logs. * Maestro writes commands-().json under the test-output dir. */ function buildScreenshotMapFromCommandLogs(artifactsDir) { const map = new Map(); if (!fse.existsSync(artifactsDir)) { return map; } const files = walkFiles(artifactsDir).filter((p) => /commands-\(.+\)\.json$/i.test(path.basename(p))); for (const relPath of files) { const absPath = path.join(artifactsDir, relPath); const base = path.basename(relPath); const flowMatch = base.match(/^commands-\((.+)\)\.json$/i); const flowName = flowMatch ? flowMatch[1] : null; if (!flowName) { continue; } let commands; try { commands = fse.readJsonSync(absPath); } catch { continue; } const list = Array.isArray(commands) ? commands : (commands.commands || []); for (const cmd of list) { const shot = cmd.takeScreenshotCommand || cmd.takeScreenshot; const shotPath = shot?.path || shot?.screenshot; if (!shotPath) { continue; } const png = shotPath.endsWith('.png') ? shotPath : `${shotPath}.png`; const rel = png.includes('/') ? png : path.join('screenshots', png); map.set(rel.replace(/\\/g, '/'), flowName); } } return map; } /** * Merge multiple Maestro JUnit XML files into one report (CI batch runner). */ function mergeMaestroJunitReports(xmlPaths, outputPath) { const existing = xmlPaths.filter((p) => fse.existsSync(p)); if (!existing.length) { console.log('No Maestro JUnit files to merge'); return false; } const mergedFlows = []; let device = ''; let totalTime = 0; for (const xmlPath of existing) { const summary = parseMaestroReport(xmlPath); if (!summary) { continue; } totalTime += summary.stats.duration || 0; mergedFlows.push(...summary.flows); if (!device && summary.stats.device) { device = summary.stats.device; } } const tests = mergedFlows.length; const failures = mergedFlows.filter((f) => f.status === 'failed').length; const errors = mergedFlows.filter((f) => f.status === 'error').length; const skipped = mergedFlows.filter((f) => f.status === 'skipped').length; const timeSec = (totalTime / 1000).toFixed(1); const renderTestcase = (f, classname, filePath) => { const statusAttr = f.status === 'passed' ? 'SUCCESS' : f.status.toUpperCase(); const fileAttr = filePath ? ` file="${escapeXmlAttr(filePath)}"` : ''; let innerBlock = ''; if (f.status === 'skipped') { innerBlock = '\n '; } else if (f.status === 'error') { innerBlock = f.failureMessage ? `\n ${escapeXmlText(f.failureMessage)}` : '\n '; } else if (f.failureMessage) { innerBlock = `\n ${escapeXmlText(f.failureMessage)}`; } return ` ${innerBlock}\n `; }; // One testsuite per flow file when every flow has a path — TSIO reads `file` // into suite FilePath; suite name doubles as a readable title. const allHaveFiles = mergedFlows.length > 0 && mergedFlows.every((f) => f.file); let suitesXml; if (allHaveFiles) { const byFile = new Map(); for (const f of mergedFlows) { if (!byFile.has(f.file)) { byFile.set(f.file, []); } byFile.get(f.file).push(f); } suitesXml = [...byFile.entries()].map(([filePath, flows]) => { const suiteFailures = flows.filter((f) => f.status === 'failed').length; const suiteErrors = flows.filter((f) => f.status === 'error').length; const suiteSkipped = flows.filter((f) => f.status === 'skipped').length; const time = flows.reduce((n, f) => n + f.time, 0).toFixed(1); const cases = flows.map((f) => renderTestcase(f, filePath, filePath)).join('\n'); return ` \n${cases}\n `; }).join('\n'); } else { const cases = mergedFlows.map((f) => renderTestcase(f, f.file || f.classname || f.name, f.file || ''), ).join('\n'); suitesXml = ` \n${cases}\n `; } const xml = `\n\n${suitesXml}\n\n`; fse.outputFileSync(outputPath, xml, 'utf-8'); console.log(`Merged ${existing.length} Maestro JUnit files -> ${outputPath} (${tests} tests, ${failures} failures, ${errors} errors, ${skipped} skipped)`); return true; } function escapeXmlAttr(s) { return String(s ?? '').replace(/[&"<>]/g, (c) => ({ '&': '&', '"': '"', '<': '<', '>': '>', }[c])); } function escapeXmlText(s) { return String(s ?? '').replace(/[<>&]/g, (c) => ({ '&': '&', '<': '<', '>': '>', }[c])); } /** * Group artifact files by which flow they belong to. Each file is scored * against every flow (see scoreFlowMatch); the highest-scoring flow wins. * Files with no plausible link land in `__unattributed`. */ function bucketArtifactsByFlow(flows, artifactPaths, commandLogMap = new Map()) { const buckets = {__unattributed: []}; for (const flow of flows) { buckets[flow.name] = []; } const tokenized = flows.map((f) => { const token = normalizeFlowToken(f.name); return { original: f.name, token, words: new Set(token.split('_').filter((w) => w.length >= 1)), category: (f.category || '').toLowerCase(), }; }); for (const relPath of artifactPaths) { const normalized = relPath.replace(/\\/g, '/'); const fromCommandLog = commandLogMap.get(normalized); if (fromCommandLog && buckets[fromCommandLog]) { buckets[fromCommandLog].push(relPath); continue; } const lower = relPath.toLowerCase(); const fileToken = lower.replace(/[^a-z0-9/]+/g, '_'); const fileWords = path.basename(lower). replace(/\.[a-z0-9]+$/i, ''). // strip extension split(/[^a-z0-9]+/). filter((w) => w.length >= 1); const prefixMatch = path.basename(lower).match(/^([a-z0-9]+)[-_]/); const filePrefix = prefixMatch ? prefixMatch[1] : ''; let bestFlow = null; let bestScore = 0; let bestUnique = true; for (const f of tokenized) { const score = scoreFlowMatch(f, fileToken, fileWords, filePrefix); if (score > bestScore) { bestScore = score; bestFlow = f; bestUnique = true; } else if (score === bestScore && score > 0) { bestUnique = false; } } // Only attribute when there's a UNIQUE best match. If multiple flows // tie at the highest score (common for ambiguous ad-hoc screenshot // names like `calls-call-ended.png` that share words with every // calls/* flow), defer to `__unattributed` rather than arbitrarily // picking the first one by iteration order. if (bestFlow && bestUnique) { buckets[bestFlow.original].push(relPath); } else { buckets.__unattributed.push(relPath); } } return buckets; } function escapeHtml(s) { return String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', }[c])); } function formatDuration(seconds) { if (!seconds || seconds < 0.001) { return '—'; } if (seconds < 1) { return `${(seconds * 1000).toFixed(0)} ms`; } if (seconds < 60) { return `${seconds.toFixed(2)} s`; } const m = Math.floor(seconds / 60); const s = seconds - (m * 60); return `${m}m ${s.toFixed(0)}s`; } function isImage(p) { return /\.(png|jpe?g|webp|gif)$/i.test(p); } function isText(p) { return /\.(log|txt|json|yaml|yml|md)$/i.test(p); } function buildFlowSection(flow, files, artifactDirHref) { const statusBadge = { passed: 'PASSED', failed: 'FAILED', error: 'ERROR', skipped: 'SKIPPED', }[flow.status] || '?'; const screenshots = files.filter(isImage).sort(); const logs = files.filter(isText).sort(); const screenshotsHtml = screenshots.length ? `
${screenshots.map((p) => ` ${escapeHtml(p)}
${escapeHtml(path.basename(p))}
`).join('')}
` : '

No screenshots captured for this flow.

'; const logsHtml = logs.length ? `` : ''; const failureBlock = flow.failureMessage ? `
${escapeHtml(flow.failureMessage)}
` : ''; const isOpen = flow.status === 'failed' || flow.status === 'error'; return `
${statusBadge} ${escapeHtml(flow.name)} ${escapeHtml(formatDuration(flow.time))}
${failureBlock} ${screenshotsHtml} ${logsHtml ? `
Log files (${logs.length})${logsHtml}
` : ''}
`; } /** * Generate a self-contained HTML report from the JUnit XML and maestro artifact * directory. Designed to be served as a single S3 object — all CSS is inline, * images are referenced by relative URL so they resolve against the same S3 * prefix when the HTML is opened from S3. * * @param {object} opts * @param {string} opts.xmlPath path to maestro-report.xml * @param {string} opts.artifactsDir path to maestro-artifacts/ dir * @param {string} opts.outputPath where to write maestro-report.html * @param {string} opts.platform 'ios' | 'android' * @param {string} [opts.commitSha] optional, for the header * @returns {boolean} true on success */ function generateMaestroHtmlReport({xmlPath, artifactsDir, outputPath, platform, commitSha = ''}) { const summary = parseMaestroReport(xmlPath); if (!summary) { console.log('Cannot generate HTML report — XML parse failed.'); return false; } const {stats, flows} = summary; const allFiles = walkFiles(artifactsDir); const commandLogMap = buildScreenshotMapFromCommandLogs(artifactsDir); const buckets = bucketArtifactsByFlow(flows, allFiles, commandLogMap); // Artifact links from the HTML are relative to the report file's location. // We place the HTML at the same level as the artifacts dir so the relative // base is 'maestro-artifacts'. const artifactDirHref = 'maestro-artifacts'; const passPct = parseFloat(stats.passPercent); const overallBadge = stats.failures + stats.errors === 0 ? 'ALL PASSED' : 'FAILURES'; const sortedFlows = [...flows].sort((a, b) => { const rank = (s) => ({failed: 0, error: 0, skipped: 1, passed: 2}[s] ?? 3); const r = rank(a.status) - rank(b.status); return r === 0 ? a.name.localeCompare(b.name) : r; }); const flowsHtml = sortedFlows.map((flow) => buildFlowSection(flow, buckets[flow.name] || [], artifactDirHref)).join('\n'); const unattributed = buckets.__unattributed; const unattributedHtml = unattributed.length ? `
FILES Unattributed artifacts (${unattributed.length})
` : ''; const html = ` Maestro ${escapeHtml(platform)} report

Maestro ${escapeHtml(platform)} report ${overallBadge}

${escapeHtml(stats.tests)} tests · ${escapeHtml(stats.passPercent)}% passing · ${escapeHtml(formatDuration(stats.duration / 1000))}${commitSha ? ' · ' + escapeHtml(commitSha.slice(0, 7)) : ''}
Tests
${escapeHtml(stats.tests)}
Passed
${escapeHtml(stats.passes)}
Failed
${escapeHtml(stats.failures + stats.errors)}
Duration
${escapeHtml(formatDuration(stats.duration / 1000))}

Flows (${flows.length})

${flowsHtml || '

No flows reported.

'} ${unattributedHtml}
`; fse.outputFileSync(outputPath, html, 'utf-8'); console.log(`Wrote maestro HTML report: ${outputPath} (${allFiles.length} artifact files, ${flows.length} flows)`); return true; } /** * Convert a Maestro JUnit XML report into Jest --json shape. * Prefer uploading JUnit with framework=maestro (TSIO #76+). Kept for local/ * tooling that still wants a Jest-shaped artifact. * * @param {string} xmlPath * @param {string} outputPath * @returns {boolean} */ function writeMaestroJestJsonForTsio(xmlPath, outputPath) { const summary = parseMaestroReport(xmlPath); if (!summary || !summary.flows.length) { console.log(`writeMaestroJestJsonForTsio: no flows parsed from ${xmlPath}`); return false; } const now = Date.now(); const byFile = new Map(); for (const flow of summary.flows) { const fileKey = flow.file || flow.classname || flow.name || 'maestro'; if (!byFile.has(fileKey)) { byFile.set(fileKey, []); } let jestStatus = 'failed'; if (flow.status === 'passed') { jestStatus = 'passed'; } else if (flow.status === 'skipped') { jestStatus = 'pending'; } const durationMs = Math.round((flow.time || 0) * 1000); byFile.get(fileKey).push({ ancestorTitles: flow.classname && flow.classname !== flow.name ? [flow.classname] : [], duration: durationMs, failureDetails: flow.failureMessage ? [{error: flow.failureMessage}] : [], failureMessages: flow.failureMessage ? [flow.failureMessage] : [], fullName: flow.classname && flow.classname !== flow.name ? `${flow.classname} ${flow.name}` : flow.name, invocations: 1, location: null, numPassingAsserts: jestStatus === 'passed' ? 1 : 0, retryReasons: [], status: jestStatus, title: flow.name, }); } let numFailedTests = 0; let numPassedTests = 0; let numPendingTests = 0; const testResults = []; for (const [fileKey, assertionResults] of byFile.entries()) { for (const ar of assertionResults) { if (ar.status === 'passed') { numPassedTests += 1; } else if (ar.status === 'pending') { numPendingTests += 1; } else { numFailedTests += 1; } } const fileFailed = assertionResults.some((ar) => ar.status === 'failed'); testResults.push({ assertionResults, endTime: now, message: fileFailed ? 'failed' : '', name: fileKey.includes('/') ? fileKey : `maestro/flows/${fileKey}`, startTime: now, status: fileFailed ? 'failed' : 'passed', summary: '', }); } const numTotalTests = numFailedTests + numPassedTests + numPendingTests; const payload = { numFailedTestSuites: testResults.filter((t) => t.status === 'failed').length, numFailedTests, numPassedTestSuites: testResults.filter((t) => t.status === 'passed').length, numPassedTests, numPendingTestSuites: 0, numPendingTests, numRuntimeErrorTestSuites: 0, numTodoTests: 0, numTotalTestSuites: testResults.length, numTotalTests, openHandles: [], snapshot: { added: 0, didUpdate: false, failure: false, filesAdded: 0, filesRemoved: 0, filesRemovedList: [], filesUnmatched: 0, filesUpdated: 0, matched: 0, total: 0, unchecked: 0, uncheckedKeysByFile: [], unmatched: 0, updated: 0, }, startTime: now, success: numFailedTests === 0, testResults, wasInterrupted: false, }; fse.outputFileSync(outputPath, JSON.stringify(payload, null, 2)); console.log( `Wrote Maestro→Jest JSON for TSIO -> ${outputPath} ` + `(${numTotalTests} tests, ${numFailedTests} failed)`, ); return true; } /** * When the batch runner exits before merging (e.g. set -e abort), reconstruct * maestro-report.xml from maestro-batch-*.xml so PR status reflects real counts. */ function mergeMaestroBatchReportsFromDir(buildDir, outputPath) { if (fse.existsSync(outputPath)) { return outputPath; } if (!fse.existsSync(buildDir)) { return null; } const batchFiles = fse.readdirSync(buildDir). filter((name) => /^maestro-batch-\d+\.xml$/.test(name)). sort((a, b) => { const num = (file) => parseInt(file.match(/maestro-batch-(\d+)\.xml/)[1], 10); return num(a) - num(b); }). map((name) => path.join(buildDir, name)); if (!batchFiles.length) { return null; } console.log(`Merging ${batchFiles.length} batch JUnit files from ${buildDir}`); mergeMaestroJunitReports(batchFiles, outputPath); return fse.existsSync(outputPath) ? outputPath : null; } /** * Build screenshot → flow mapping by reading `takeScreenshot:` names from each * flow YAML referenced in the JUnit report. Used when Maestro command logs are * absent (common after --flatten-debug-output / partial artifact uploads). * * @param {Array<{name: string, file?: string}>} flows * @param {string} [repoRoot] * @returns {Map} */ function buildScreenshotMapFromFlowYamls(flows, repoRoot = process.cwd()) { const map = new Map(); const roots = [ repoRoot, path.resolve(repoRoot, '..'), ].filter(Boolean); for (const flow of flows) { if (!flow.file || !flow.name) { continue; } let yamlText = null; for (const root of roots) { const candidate = path.resolve(root, flow.file); if (fse.existsSync(candidate)) { try { yamlText = fse.readFileSync(candidate, 'utf8'); } catch { yamlText = null; } break; } } if (!yamlText) { continue; } for (const match of yamlText.matchAll(/takeScreenshot:\s*['"]?([^\s#'"]+)/g)) { const shot = match[1]; if (!shot) { continue; } const png = shot.endsWith('.png') ? shot : `${shot}.png`; const rel = png.includes('/') ? png.replace(/\\/g, '/') : path.join('screenshots', png).replace(/\\/g, '/'); map.set(rel, flow.name); map.set(path.basename(rel), flow.name); } } return map; } /** * Stage Maestro screenshots into per-flow folders for TSIO linking. * * Maestro writes takeScreenshot PNGs as flat `screenshots/.png`, which * cannot match JUnit full_title (` > `). TSIO's linker * matches folder-derived test_name against full_title, so we copy images to * `//.png` using the same attribution as the * HTML report (command logs + YAML takeScreenshot map + scoreFlowMatch). * * @param {{xmlPath: string, artifactsDir: string, outputDir: string, repoRoot?: string}} opts * @returns {{copied: number, flows: number}} */ function prepareMaestroScreenshotsForTsio({xmlPath, artifactsDir, outputDir, repoRoot}) { const summary = parseMaestroReport(xmlPath); if (!summary || !summary.flows.length) { console.log(`prepareMaestroScreenshotsForTsio: no flows in ${xmlPath}`); return {copied: 0, flows: 0}; } const allFiles = walkFiles(artifactsDir).filter(isImage); const commandLogMap = buildScreenshotMapFromCommandLogs(artifactsDir); const yamlMap = buildScreenshotMapFromFlowYamls(summary.flows, repoRoot || process.cwd()); // Command logs win when present; YAML map fills the gaps. const combinedMap = new Map([...yamlMap, ...commandLogMap]); const buckets = bucketArtifactsByFlow(summary.flows, allFiles, combinedMap); fse.emptyDirSync(outputDir); let copied = 0; for (const [flowName, files] of Object.entries(buckets)) { if (flowName === '__unattributed' || !files.length) { continue; } for (const rel of files) { const src = path.join(artifactsDir, rel); const dest = path.join(outputDir, flowName, path.basename(rel)); fse.ensureDirSync(path.dirname(dest)); fse.copySync(src, dest, {overwrite: true}); copied += 1; } } // Keep unattributed images discoverable (won't link to a case). const orphaned = buckets.__unattributed || []; for (const rel of orphaned) { const src = path.join(artifactsDir, rel); const dest = path.join(outputDir, '__unattributed', path.basename(rel)); fse.ensureDirSync(path.dirname(dest)); fse.copySync(src, dest, {overwrite: true}); copied += 1; } console.log(`prepareMaestroScreenshotsForTsio: copied ${copied} image(s) for ${summary.flows.length} flow(s) -> ${outputDir}`); return {copied, flows: summary.flows.length}; } module.exports = { parseMaestroReport, generateMaestroHtmlReport, mergeMaestroJunitReports, mergeMaestroBatchReportsFromDir, writeMaestroJestJsonForTsio, buildScreenshotMapFromCommandLogs, buildScreenshotMapFromFlowYamls, prepareMaestroScreenshotsForTsio, };