Verify deployed repeat QA run reports
This commit is contained in:
@@ -124,14 +124,27 @@ try {
|
|||||||
assert(typeof qaReport.generatedAt === 'string' && qaReport.generatedAt.length > 0, `Expected deployed QA report timestamp: ${JSON.stringify(qaReport)}`);
|
assert(typeof qaReport.generatedAt === 'string' && qaReport.generatedAt.length > 0, `Expected deployed QA report timestamp: ${JSON.stringify(qaReport)}`);
|
||||||
console.log(`Verified QA report ${releaseManifest.qaReport} with ${qaReport.results.length} battles`);
|
console.log(`Verified QA report ${releaseManifest.qaReport} with ${qaReport.results.length} battles`);
|
||||||
}
|
}
|
||||||
|
let deployedQaRepeatReport;
|
||||||
if (releaseManifest.qaRepeatReport) {
|
if (releaseManifest.qaRepeatReport) {
|
||||||
const qaRepeatReport = await readJsonAsset(targetUrl, releaseManifest.qaRepeatReport);
|
const qaRepeatReport = await readJsonAsset(targetUrl, releaseManifest.qaRepeatReport);
|
||||||
|
deployedQaRepeatReport = qaRepeatReport;
|
||||||
assert(qaRepeatReport.app === 'heros_web', `Expected deployed QA repeat report app id: ${JSON.stringify(qaRepeatReport)}`);
|
assert(qaRepeatReport.app === 'heros_web', `Expected deployed QA repeat report app id: ${JSON.stringify(qaRepeatReport)}`);
|
||||||
assert(Array.isArray(qaRepeatReport.runs) && qaRepeatReport.runs.length > 0, `Expected deployed QA repeat report runs: ${JSON.stringify(qaRepeatReport)}`);
|
assert(Array.isArray(qaRepeatReport.runs) && qaRepeatReport.runs.length > 0, `Expected deployed QA repeat report runs: ${JSON.stringify(qaRepeatReport)}`);
|
||||||
assert(
|
assert(
|
||||||
typeof qaRepeatReport.summary?.runs === 'number' && qaRepeatReport.summary.runs === qaRepeatReport.runs.length,
|
typeof qaRepeatReport.summary?.runs === 'number' && qaRepeatReport.summary.runs === qaRepeatReport.runs.length,
|
||||||
`Expected deployed QA repeat report run summary: ${JSON.stringify(qaRepeatReport)}`
|
`Expected deployed QA repeat report run summary: ${JSON.stringify(qaRepeatReport)}`
|
||||||
);
|
);
|
||||||
|
for (const run of qaRepeatReport.runs) {
|
||||||
|
const runReportAsset = distAssetPath(run.path);
|
||||||
|
assert(runReportAsset, `Expected repeat QA run ${run.run} to include a report path: ${JSON.stringify(run)}`);
|
||||||
|
const runReport = await readJsonAsset(targetUrl, runReportAsset);
|
||||||
|
assert(runReport.app === 'heros_web', `Expected deployed QA repeat run report app id at ${runReportAsset}: ${JSON.stringify(runReport)}`);
|
||||||
|
assert(Array.isArray(runReport.results) && runReport.results.length > 0, `Expected deployed QA repeat run results at ${runReportAsset}: ${JSON.stringify(runReport)}`);
|
||||||
|
assert(
|
||||||
|
typeof runReport.summary?.victories === 'number' && typeof runReport.summary?.failures === 'number',
|
||||||
|
`Expected deployed QA repeat run summary at ${runReportAsset}: ${JSON.stringify(runReport)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
console.log(`Verified QA repeat report ${releaseManifest.qaRepeatReport} with ${qaRepeatReport.runs.length} runs`);
|
console.log(`Verified QA repeat report ${releaseManifest.qaRepeatReport} with ${qaRepeatReport.runs.length} runs`);
|
||||||
}
|
}
|
||||||
if (releaseManifest.releaseDashboard) {
|
if (releaseManifest.releaseDashboard) {
|
||||||
@@ -141,6 +154,10 @@ try {
|
|||||||
assert(dashboard.includes('Repeated Battle Outcomes'), `Expected deployed release dashboard battle outcomes section: ${dashboard.slice(0, 800)}`);
|
assert(dashboard.includes('Repeated Battle Outcomes'), `Expected deployed release dashboard battle outcomes section: ${dashboard.slice(0, 800)}`);
|
||||||
assert(dashboard.includes('Process Failures'), `Expected deployed release dashboard process failure metric: ${dashboard.slice(0, 800)}`);
|
assert(dashboard.includes('Process Failures'), `Expected deployed release dashboard process failure metric: ${dashboard.slice(0, 800)}`);
|
||||||
assert(dashboard.includes('Repeat Runs'), `Expected deployed release dashboard repeat runs section: ${dashboard.slice(0, 800)}`);
|
assert(dashboard.includes('Repeat Runs'), `Expected deployed release dashboard repeat runs section: ${dashboard.slice(0, 800)}`);
|
||||||
|
for (const run of deployedQaRepeatReport?.runs ?? []) {
|
||||||
|
const runReportAsset = distAssetPath(run.path);
|
||||||
|
assert(dashboard.includes(runReportAsset), `Expected deployed release dashboard to link repeat run report ${runReportAsset}: ${dashboard.slice(0, 1200)}`);
|
||||||
|
}
|
||||||
console.log(`Verified release dashboard ${releaseManifest.releaseDashboard}`);
|
console.log(`Verified release dashboard ${releaseManifest.releaseDashboard}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,6 +207,13 @@ async function readTextAsset(pageUrl, assetPath) {
|
|||||||
return response.text();
|
return response.text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function distAssetPath(filePath) {
|
||||||
|
if (!filePath) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
return String(filePath).replaceAll('\\', '/').replace(/^dist\//, '').replace(/^\/+/, '');
|
||||||
|
}
|
||||||
|
|
||||||
function assert(condition, message) {
|
function assert(condition, message) {
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
throw new Error(message);
|
throw new Error(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user