Preserve deployment evidence navigation scope
This commit is contained in:
@@ -19,6 +19,36 @@ const DETAIL_URL = `${BASE_URL}/releases/deployments/DEP-2026-050?tenant=demo-pr
|
||||
const STATE_PATH = path.join(outputDirectory, 'live-frontdoor-auth-state.json');
|
||||
const REPORT_PATH = path.join(outputDirectory, 'live-frontdoor-auth-report.json');
|
||||
const RESULT_PATH = path.join(outputDirectory, 'live-releases-deployments-check.json');
|
||||
const EXPECTED_SCOPE = {
|
||||
tenant: 'demo-prod',
|
||||
regions: 'us-east',
|
||||
environments: 'stage',
|
||||
};
|
||||
|
||||
function collectScopeIssues(url, expectedScope, label) {
|
||||
const issues = [];
|
||||
const parsed = new URL(url);
|
||||
|
||||
for (const [key, expectedValue] of Object.entries(expectedScope)) {
|
||||
const actualValue = parsed.searchParams.get(key);
|
||||
if (actualValue !== expectedValue) {
|
||||
issues.push(`${label} expected ${key}=${expectedValue} but got ${actualValue ?? '(missing)'}`);
|
||||
}
|
||||
}
|
||||
|
||||
const returnTo = parsed.searchParams.get('returnTo');
|
||||
if (returnTo) {
|
||||
const parsedReturnTo = new URL(returnTo, BASE_URL);
|
||||
for (const [key, expectedValue] of Object.entries(expectedScope)) {
|
||||
const actualValue = parsedReturnTo.searchParams.get(key);
|
||||
if (actualValue !== expectedValue) {
|
||||
issues.push(`returnTo from ${label} expected ${key}=${expectedValue} but got ${actualValue ?? '(missing)'}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return issues;
|
||||
}
|
||||
|
||||
async function seedAuthenticatedPage(browser, authReport) {
|
||||
const context = await createAuthenticatedContext(browser, authReport, {
|
||||
@@ -72,6 +102,7 @@ async function main() {
|
||||
artifactDownloadSuggestedFilename: '',
|
||||
logsDownloadSuggestedFilename: '',
|
||||
detailActionStatus: '',
|
||||
scopeIssues: [],
|
||||
};
|
||||
const headerActions = page.locator('.deployment-detail .header-actions button');
|
||||
|
||||
@@ -107,6 +138,11 @@ async function main() {
|
||||
result.proofChainsHref = (await page.locator('.rekor-link').getAttribute('href')) ?? '';
|
||||
await page.goto(new URL(result.proofChainsHref, BASE_URL).toString(), { waitUntil: 'networkidle', timeout: 30_000 });
|
||||
result.proofChainsUrl = page.url();
|
||||
result.scopeIssues.push(
|
||||
...collectScopeIssues(result.replayUrl, EXPECTED_SCOPE, 'replayUrl'),
|
||||
...collectScopeIssues(result.evidenceWorkspaceUrl, EXPECTED_SCOPE, 'evidenceWorkspaceUrl'),
|
||||
...collectScopeIssues(result.proofChainsUrl, EXPECTED_SCOPE, 'proofChainsUrl'),
|
||||
);
|
||||
|
||||
await page.goto(result.detailUrl, { waitUntil: 'networkidle', timeout: 30_000 });
|
||||
await page.getByRole('button', { name: 'Artifacts' }).click();
|
||||
@@ -140,6 +176,10 @@ async function main() {
|
||||
writeFileSync(RESULT_PATH, `${JSON.stringify(result, null, 2)}\n`, 'utf8');
|
||||
await context.close();
|
||||
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
||||
|
||||
if (result.scopeIssues.length > 0) {
|
||||
throw new Error(result.scopeIssues.join('; '));
|
||||
}
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user