Harden live route ownership verification

This commit is contained in:
master
2026-03-10 17:27:26 +02:00
parent 6ef5ff5b43
commit bb8327087d
2 changed files with 30 additions and 9 deletions

View File

@@ -190,6 +190,16 @@ async function runSidebarCheck(page) {
}
async function runWatchlistLabelCheck(page, returnTo, expectedLabel) {
const evaluate = async () => {
const labelVisible = await page.getByText(`Return to ${expectedLabel}`, { exact: false }).first().isVisible().catch(() => false);
const snapshot = await captureSnapshot(page, `watchlist-return:${expectedLabel}`);
return {
ok: labelVisible,
snapshot,
};
};
await page.goto(
`https://stella-ops.local/setup/trust-signing/watchlist/alerts?${scopeQuery}&alertId=alert-001&scope=tenant&tab=alerts&returnTo=${encodeURIComponent(returnTo)}`,
{
@@ -199,14 +209,22 @@ async function runWatchlistLabelCheck(page, returnTo, expectedLabel) {
);
await settle(page);
const labelVisible = await page.getByText(`Return to ${expectedLabel}`, { exact: false }).first().isVisible().catch(() => false);
let result = await evaluate();
if (
!result.ok
&& new URL(page.url()).pathname === '/setup/trust-signing/watchlist/alerts'
&& (result.snapshot.title === 'StellaOps' || !result.snapshot.heading)
) {
await page.waitForTimeout(2_000);
result = await evaluate();
}
return {
kind: 'watchlist-return',
route: page.url(),
ok: labelVisible,
ok: result.ok,
expectedLabel,
snapshot: await captureSnapshot(page, `watchlist-return:${expectedLabel}`),
snapshot: result.snapshot,
};
}