Harden canonical route sweep rechecks
This commit is contained in:
@@ -371,6 +371,15 @@ async function inspectRoute(context, routePath) {
|
||||
return record;
|
||||
}
|
||||
|
||||
async function inspectRouteInFreshContext(browser, authReport, routePath) {
|
||||
const context = await createAuthenticatedContext(browser, authReport, { statePath: STATE_PATH });
|
||||
try {
|
||||
return await inspectRoute(context, routePath);
|
||||
} finally {
|
||||
await context.close();
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
mkdirSync(outputDirectory, { recursive: true });
|
||||
|
||||
@@ -389,9 +398,31 @@ async function main() {
|
||||
const routes = [];
|
||||
|
||||
for (const routePath of canonicalRoutes) {
|
||||
const record = await inspectRoute(context, routePath);
|
||||
const firstAttempt = await inspectRoute(context, routePath);
|
||||
let record = firstAttempt;
|
||||
|
||||
if (!firstAttempt.passed) {
|
||||
const retryAttempt = await inspectRouteInFreshContext(browser, authReport, routePath);
|
||||
record = {
|
||||
...retryAttempt,
|
||||
retryUsed: true,
|
||||
retryPassed: retryAttempt.passed,
|
||||
initialFailure: {
|
||||
consoleErrors: firstAttempt.consoleErrors,
|
||||
requestFailures: firstAttempt.requestFailures,
|
||||
responseErrors: firstAttempt.responseErrors,
|
||||
problemTexts: firstAttempt.problemTexts,
|
||||
expectationFailures: firstAttempt.expectationFailures,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
routes.push(record);
|
||||
const status = record.passed ? 'PASS' : 'FAIL';
|
||||
const status = record.passed
|
||||
? record.retryUsed
|
||||
? 'PASS-RECHECK'
|
||||
: 'PASS'
|
||||
: 'FAIL';
|
||||
process.stdout.write(`[live-frontdoor-canonical-route-sweep] ${status} ${routePath} -> ${record.finalUrl}\n`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user